Skip to content

Commit e82bf6d

Browse files
committed
bluestore: Fix _setattr() with rare memory alignments
Fix case bufferlist is length 0. Signed-off-by: Adam Kupczyk <[email protected]>
1 parent 04ad137 commit e82bf6d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/os/bluestore/BlueStore.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18051,11 +18051,15 @@ int BlueStore::_setattr(TransContext *txc,
1805118051
<< " " << name << " (" << val.length() << " bytes)"
1805218052
<< dendl;
1805318053
int r = 0;
18054-
18055-
if (!val.is_contiguous() || val.front().is_partial()) {
18056-
val.rebuild();
18054+
auto& b = o->onode.attrs[name.c_str()];
18055+
if (val.length() == 0) {
18056+
b = bufferptr("", 0);
18057+
} else {
18058+
if (!val.is_contiguous() || val.front().is_partial()) {
18059+
val.rebuild();
18060+
}
18061+
b = val.front();
1805718062
}
18058-
auto& b = o->onode.attrs[name.c_str()] = val.front();
1805918063
b.reassign_to_mempool(mempool::mempool_bluestore_cache_meta);
1806018064

1806118065
txc->write_onode(o);

0 commit comments

Comments
 (0)