]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: protect InodeRef with client_lock 11225/head
authorYan, Zheng <zyan@redhat.com>
Mon, 26 Sep 2016 13:20:26 +0000 (21:20 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 26 Sep 2016 13:20:26 +0000 (21:20 +0800)
Fixes: http://tracker.ceph.com/issues/17392
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/client/Client.cc

index 94213eada7f916fa51bccef520653f13ce17363b..f0a36e643eb5208cea6868c05af7c984f309649f 100644 (file)
@@ -9947,8 +9947,6 @@ int Client::ll_getattrx(Inode *in, struct ceph_statx *stx, unsigned int want,
 int Client::_ll_setattrx(Inode *in, struct ceph_statx *stx, int mask, int uid,
                       int gid, InodeRef *inp)
 {
-  Mutex::Locker lock(client_lock);
-
   vinodeno_t vino = _get_vino(in);
 
   ldout(cct, 3) << "ll_setattrx " << vino << " mask " << hex << mask << dec
@@ -9978,6 +9976,7 @@ int Client::_ll_setattrx(Inode *in, struct ceph_statx *stx, int mask, int uid,
 int Client::ll_setattrx(Inode *in, struct ceph_statx *stx, int mask, int uid,
                       int gid)
 {
+  Mutex::Locker lock(client_lock);
   InodeRef target(in);
   int res = _ll_setattrx(in, stx, mask, uid, gid, &target);
   if (res == 0) {
@@ -9993,9 +9992,9 @@ int Client::ll_setattr(Inode *in, struct stat *attr, int mask, int uid,
                       int gid)
 {
   struct ceph_statx stx;
-
   stat_to_statx(attr, &stx);
 
+  Mutex::Locker lock(client_lock);
   InodeRef target(in);
   int res = _ll_setattrx(in, &stx, mask, uid, gid, &target);
   if (res == 0) {