From b47374177c31c21bc56f833681380ccb67c0cb65 Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Sat, 1 Aug 2020 21:06:25 +0800 Subject: [PATCH] client: remove useless unsafe_sync_write With the RWRef supporting, before _unmount() could continue all the the sync write(the "readers") must have finished. Signed-off-by: Xiubo Li --- src/client/Client.cc | 19 ------------------- src/client/Client.h | 2 -- 2 files changed, 21 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index f20b20bfc11..873ef844bc5 100755 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -6250,14 +6250,6 @@ void Client::_unmount(bool abort) _ll_drop_pins(); - mount_cond.wait(lock, [this] { - if (unsafe_sync_write > 0) { - ldout(cct, 0) << unsafe_sync_write << " unsafe_sync_writes, waiting" - << dendl; - } - return unsafe_sync_write <= 0; - }); - if (cct->_conf->client_oc) { // flush/release all buffered data std::list anchor; @@ -9664,16 +9656,7 @@ int Client::_read_sync(Fh *f, uint64_t off, uint64_t len, bufferlist *bl, */ void Client::_sync_write_commit(Inode *in) { - ceph_assert(unsafe_sync_write > 0); - unsafe_sync_write--; - put_cap_ref(in, CEPH_CAP_FILE_BUFFER); - - ldout(cct, 15) << __func__ << " unsafe_sync_write = " << unsafe_sync_write << dendl; - if (unsafe_sync_write == 0 && is_unmounting()) { - ldout(cct, 10) << __func__ << " -- no more unsafe writes, unmount can proceed" << dendl; - mount_cond.notify_all(); - } } int Client::write(int fd, const char *buf, loff_t size, loff_t offset) @@ -9934,7 +9917,6 @@ int64_t Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf, // simple, non-atomic sync write C_SaferCond onfinish("Client::_write flock"); - unsafe_sync_write++; get_cap_ref(in, CEPH_CAP_FILE_BUFFER); // released by onsafe callback filer->write_trunc(in->ino, &in->layout, in->snaprealm->get_snap_context(), @@ -13922,7 +13904,6 @@ int Client::_fallocate(Fh *fh, int mode, int64_t offset, int64_t length) C_SaferCond onfinish("Client::_punch_hole flock"); - unsafe_sync_write++; get_cap_ref(in, CEPH_CAP_FILE_BUFFER); _invalidate_inode_cache(in, offset, length); diff --git a/src/client/Client.h b/src/client/Client.h index 1437d8f29b0..a8ddb2c28b8 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -1379,8 +1379,6 @@ private: int local_osd = -ENXIO; epoch_t local_osd_epoch = 0; - int unsafe_sync_write = 0; - // mds requests ceph_tid_t last_tid = 0; ceph_tid_t oldest_tid = 0; // oldest incomplete mds request, excluding setfilelock requests -- 2.47.3