From: Igor Fedotov Date: Tue, 12 Apr 2022 22:49:32 +0000 (+0300) Subject: os/bluestore: fix no metadata sync for truncate X-Git-Tag: v18.0.0~82^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=73a7e92f0f6bfcfc3ebb94d1b767a044c2856f92;p=ceph.git os/bluestore: fix no metadata sync for truncate Fixes: https://tracker.ceph.com/issues/55307 Signed-off-by: Igor Fedotov --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 38cc5d54179b..284906372c59 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -3402,6 +3402,7 @@ int BlueFS::truncate(FileWriter *h, uint64_t offset)/*_WF_L*/ std::lock_guard ll(log.lock); vselector->sub_usage(h->file->vselector_hint, h->file->fnode.size); h->file->fnode.size = offset; + h->file->is_dirty = true; vselector->add_usage(h->file->vselector_hint, h->file->fnode.size); log.t.op_file_update_inc(h->file->fnode); return 0; @@ -3413,7 +3414,8 @@ int BlueFS::fsync(FileWriter *h)/*_WF_WD_WLD_WLNF_WNF*/ std::unique_lock hl(h->lock); uint64_t old_dirty_seq = 0; { - dout(10) << __func__ << " " << h << " " << h->file->fnode << dendl; + dout(10) << __func__ << " " << h << " " << h->file->fnode + << " dirty " << h->file->is_dirty << dendl; int r = _flush_F(h, true); if (r < 0) return r;