mirror of
https://github.com/ceph/ceph
synced 2025-03-09 01:38:58 +00:00
osd: check OSDSuperblock in mkfs() when it already have superblock
When we remove the ready flag from osd directory, it will execute mkfs again. It will read superblock but can not check osd id and cluster fsid correctly. It need to decode the superblock that we read from osd. It will always failure now, so I modify it for read osd id and fsid correctly. http://tracker.ceph.com/issues/13586 Fixes: #13586 Signed-off-by: Vicente Cheng <freeze.bilsted@gmail.com>
This commit is contained in:
parent
e684e4252f
commit
7fcd423706
@ -1351,7 +1351,11 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
|
||||
bufferlist sbbl;
|
||||
ret = store->read(coll_t::meta(), OSD_SUPERBLOCK_POBJECT, 0, 0, sbbl);
|
||||
if (ret >= 0) {
|
||||
/* if we already have superblock, check content of superblock */
|
||||
dout(0) << " have superblock" << dendl;
|
||||
bufferlist::iterator p;
|
||||
p = sbbl.begin();
|
||||
::decode(sb, p);
|
||||
if (whoami != sb.whoami) {
|
||||
derr << "provided osd id " << whoami << " != superblock's " << sb.whoami << dendl;
|
||||
ret = -EINVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user