Project

General

Profile

Feature #8307

Creating a pool with erasure code allows me to create invalid ec profile names.

Added by Pauline Middelink almost 6 years ago. Updated almost 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Monitor
Target version:
% Done:

100%

Source:
other
Tags:
Backport:
firefly
Reviewed:
Affected Versions:
Pull request ID:

Description

Lets much around with the cmdline

[root@storage ~]# ceph osd pool create ec 128 128 erasure erasure-code-k=9 erasure-code-m=1
Error EINVAL: cannot determine the erasure code plugin because there is no 'plugin' entry in the erasure_code_profile {}failed to load plugin using profile erasure-code-k=9

Fine. Expected an error, that webpage was old.

[root@storage ~]# ceph osd erasure-code-profile ls
default
erasure-code-k=9

Hmm. What's this? erasure-code-k=9 was created? Lets get rid of it.

[root@storage ~]# ceph osd erasure-code-profile rm erasure-code-k=9
Invalid command: invalid chars = in erasure-code-k=9
osd erasure-code-profile rm <name> : remove erasure code profile <name>
Error EINVAL: invalid command

[root@storage ~]# ceph osd erasure-code-profile rm "erasure-code-k=9"
Invalid command: invalid chars = in erasure-code-k=9
osd erasure-code-profile rm <name> : remove erasure code profile <name>
Error EINVAL: invalid command

Associated revisions

Revision ff2eb234 (diff)
Added by Loic Dachary almost 6 years ago

erasure-code: pool create must not create profiles

If a non existent profile is provided as an argument to osd pool create,
it must exit on error and not create the profile as a side effect.

http://tracker.ceph.com/issues/8307 refs: #8307

Signed-off-by: Loic Dachary <>

Revision 3c638111 (diff)
Added by Loic Dachary almost 6 years ago

erasure-code: OSDMonitor::get_erasure_code is a const

If it is not, the non const version of OSDMap::get_erasure_code_profile
is called and a profile is created as a side effect, which is not
intended.

http://tracker.ceph.com/issues/8307 refs: #8307

Signed-off-by: Loic Dachary <>

Revision a67c1c1c (diff)
Added by Loic Dachary almost 6 years ago

erasure-code: OSDMonitor::get_erasure_code is a const

If it is not, the non const version of OSDMap::get_erasure_code_profile
is called and a profile is created as a side effect, which is not
intended.

http://tracker.ceph.com/issues/8307 refs: #8307

Signed-off-by: Loic Dachary <>
(cherry picked from commit 3c638111a4943758b6089c63a42aabbf281ac257)

Revision a7119c31 (diff)
Added by Loic Dachary almost 6 years ago

erasure-code: pool create must not create profiles

If a non existent profile is provided as an argument to osd pool create,
it must exit on error and not create the profile as a side effect.

http://tracker.ceph.com/issues/8307 refs: #8307

Signed-off-by: Loic Dachary <>
(cherry picked from commit ff2eb234e63cd281b40405cb3397da5babda943f)

History

#1 Updated by Josh Durgin almost 6 years ago

  • Project changed from rbd to Ceph
  • Category set to Monitor

#2 Updated by Ian Colle almost 6 years ago

  • Assignee set to Joao Eduardo Luis

#3 Updated by Joao Eduardo Luis almost 6 years ago

  • Assignee changed from Joao Eduardo Luis to Loic Dachary

OSDMonitor::get_erasure_code() is calling OSDMap::get_erasure_code_profile(), which according to gdb ends up hitting the non-const version of the function.

Given there's no guard on the function to make sure the element exists in the map, we end up modifying the in-memory osdmap:

map<string,string> &get_erasure_code_profile(const string &name) {
  return erasure_code_profiles[name]; // < that adds 'name' to the map with an empty value
}

Loic suggested I'd assign this to him and I am doing as such.

We should add a unit test to cover this case in the future.

#4 Updated by Loic Dachary almost 6 years ago

  • Status changed from New to In Progress
  • Assignee changed from Loic Dachary to Joao Eduardo Luis

#5 Updated by Loic Dachary almost 6 years ago

  • Assignee changed from Joao Eduardo Luis to Loic Dachary

#6 Updated by Loic Dachary almost 6 years ago

  • Status changed from In Progress to Fix Under Review

#7 Updated by Loic Dachary almost 6 years ago

  • Target version set to 0.83
  • % Done changed from 0 to 80
  • Backport set to firefly

#8 Updated by Loic Dachary almost 6 years ago

  • Status changed from Fix Under Review to Resolved
  • % Done changed from 80 to 100

#9 Updated by Loic Dachary almost 6 years ago

  • Status changed from Resolved to Pending Backport
  • % Done changed from 100 to 90

#11 Updated by Loic Dachary almost 6 years ago

  • Tracker changed from Bug to Feature
  • Target version changed from 0.83 to 0.82

#12 Updated by Loic Dachary almost 6 years ago

  • Status changed from Pending Backport to Fix Under Review

#13 Updated by Ian Colle almost 6 years ago

  • Target version changed from 0.82 to 0.83 cont.

#14 Updated by Loic Dachary almost 6 years ago

  • Status changed from Fix Under Review to Resolved
  • % Done changed from 90 to 100

Also available in: Atom PDF