]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Client: always pass a Fh to _do_filelock
authorGreg Farnum <gfarnum@redhat.com>
Thu, 1 Sep 2016 23:55:00 +0000 (16:55 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:57 +0000 (16:33 -0700)
We weren't passing in the Fh as a signal we were releasing locks (ie, don't
remove the lock ranges in question rather than adding htem to our accounting).
But that was a little weird and doesn't work when we're pulling perms out of
the Fh.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/client/Client.h

index c3ce432be220827714b7bccf03387094e4e3b2da..f05bfb3e81d484b415f927bf58f4e3c793d029dd 100644 (file)
@@ -8958,7 +8958,7 @@ int Client::statfs(const char *path, struct statvfs *stbuf,
 }
 
 int Client::_do_filelock(Inode *in, Fh *fh, int lock_type, int op, int sleep,
-                        struct flock *fl, uint64_t owner)
+                        struct flock *fl, uint64_t owner, bool removing)
 {
   ldout(cct, 10) << "_do_filelock ino " << in->ino
                 << (lock_type == CEPH_LOCK_FCNTL ? " fcntl" : " flock")
@@ -9047,7 +9047,7 @@ int Client::_do_filelock(Inode *in, Fh *fh, int lock_type, int op, int sleep,
       }
       _update_lock_state(fl, owner, lock_state);
 
-      if (fh) {
+      if (!removing) {
        if (lock_type == CEPH_LOCK_FCNTL) {
          if (!fh->fcntl_locks)
            fh->fcntl_locks = new ceph_lock_state_t(cct, CEPH_LOCK_FCNTL);
@@ -9162,7 +9162,8 @@ void Client::_release_filelocks(Fh *fh)
     fl.l_start = p->second.start;
     fl.l_len = p->second.length;
     fl.l_pid = p->second.pid;
-    _do_filelock(in, NULL, p->first, CEPH_MDS_OP_SETFILELOCK, 0, &fl, p->second.owner);
+    _do_filelock(in, fh, p->first, CEPH_MDS_OP_SETFILELOCK, 0, &fl,
+                p->second.owner, true);
   }
 }
 
index 6d80b4afecd185ac3c603f089ba824a9be943d2b..c9574c8961c5ff0ee25f511dc3b4c658bc2bc8e6 100644 (file)
@@ -896,7 +896,7 @@ private:
   }
 
   int _do_filelock(Inode *in, Fh *fh, int lock_type, int op, int sleep,
-                  struct flock *fl, uint64_t owner);
+                  struct flock *fl, uint64_t owner, bool removing=false);
   int _interrupt_filelock(MetaRequest *req);
   void _encode_filelocks(Inode *in, bufferlist& bl);
   void _release_filelocks(Fh *fh);