]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: remove useless unsafe_sync_write
authorXiubo Li <xiubli@redhat.com>
Sat, 1 Aug 2020 13:06:25 +0000 (21:06 +0800)
committerXiubo Li <xiubli@redhat.com>
Thu, 6 Aug 2020 08:23:35 +0000 (16:23 +0800)
With the RWRef supporting, before _unmount() could continue all the
the sync write(the "readers") must have finished.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
src/client/Client.cc
src/client/Client.h

index f20b20bfc11b0f59d0b764bebe8707b476572c3a..873ef844bc565cc3bd2afb85ce7db201bc497ac9 100755 (executable)
@@ -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<InodeRef> 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);
index 1437d8f29b01a5f17e838cb13730c69ea31dd346..a8ddb2c28b899dd91c5968e5c6840641fc6fc7a4 100644 (file)
@@ -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