Skip to content

Commit d4e2d49

Browse files
committed
bluestore: Fix _setattr() with rare memory alignments
Fix an issue in BlueStore_setattr whereby if a buffer was contiguous and non-partial, then bluestore could completely drop the attribute. setattr seems to be rarely used outside of new EC. In new EC it is only used on non-primary shards, so this was only ever seen if the non-primary happened to be on the same OSD as the primary - this is transient and rare that scrubbing would actually catche the issue. Fixes: https://tracker.ceph.com/issues/71623 Signed-off-by: Alex Ainscow <[email protected]>
1 parent 3c9defa commit d4e2d49

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/os/bluestore/BlueStore.cc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18039,6 +18039,8 @@ int BlueStore::_remove(TransContext *txc,
1803918039
return r;
1804018040
}
1804118041

18042+
18043+
1804218044
int BlueStore::_setattr(TransContext *txc,
1804318045
CollectionRef& c,
1804418046
OnodeRef& o,
@@ -18049,18 +18051,13 @@ int BlueStore::_setattr(TransContext *txc,
1804918051
<< " " << name << " (" << val.length() << " bytes)"
1805018052
<< dendl;
1805118053
int r = 0;
18052-
if (!val.length()) {
18053-
auto& b = o->onode.attrs[name.c_str()] = bufferptr("", 0);
18054-
b.reassign_to_mempool(mempool::mempool_bluestore_cache_meta);
18055-
} else if (!val.is_contiguous()) {
18056-
val.rebuild();
18057-
auto& b = o->onode.attrs[name.c_str()] = val.front();
18058-
b.reassign_to_mempool(mempool::mempool_bluestore_cache_meta);
18059-
} else if (val.front().is_partial()) {
18054+
18055+
if (!val.is_contiguous() || val.front().is_partial()) {
1806018056
val.rebuild();
18061-
auto& b = o->onode.attrs[name.c_str()] = val.front();
18062-
b.reassign_to_mempool(mempool::mempool_bluestore_cache_meta);
1806318057
}
18058+
auto& b = o->onode.attrs[name.c_str()] = val.front();
18059+
b.reassign_to_mempool(mempool::mempool_bluestore_cache_meta);
18060+
1806418061
txc->write_onode(o);
1806518062
dout(10) << __func__ << " " << c->cid << " " << o->oid
1806618063
<< " " << name << " (" << val.length() << " bytes)"

0 commit comments

Comments
 (0)