From: Greg Farnum Date: Thu, 1 Sep 2016 23:55:00 +0000 (-0700) Subject: Client: always pass a Fh to _do_filelock X-Git-Tag: v11.0.1~36^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a8f214f7ebc3834e22aab3ce61ac05673471250a;p=ceph.git Client: always pass a Fh to _do_filelock 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 --- diff --git a/src/client/Client.cc b/src/client/Client.cc index c3ce432be220..f05bfb3e81d4 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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); } } diff --git a/src/client/Client.h b/src/client/Client.h index 6d80b4afecd1..c9574c8961c5 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -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);