ceph: move dirty inode to migrating list when clearing auth caps
authorYan, Zheng <zheng.z.yan@intel.com>
Fri, 4 Jan 2013 06:28:07 +0000 (14:28 +0800)
committerAlex Elder <elder@inktank.com>
Thu, 17 Jan 2013 18:42:37 +0000 (12:42 -0600)
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Sage Weil <sage@inktank.com>
fs/ceph/caps.c

index a1d9bb30c1bf9fc5460286ff465e2bcbc338bf30..a9fe2d5784c9ab952833541152ac3c6f661b80f0 100644 (file)
@@ -611,8 +611,16 @@ retry:
 
        if (flags & CEPH_CAP_FLAG_AUTH)
                ci->i_auth_cap = cap;
-       else if (ci->i_auth_cap == cap)
+       else if (ci->i_auth_cap == cap) {
                ci->i_auth_cap = NULL;
+               spin_lock(&mdsc->cap_dirty_lock);
+               if (!list_empty(&ci->i_dirty_item)) {
+                       dout(" moving %p to cap_dirty_migrating\n", inode);
+                       list_move(&ci->i_dirty_item,
+                                 &mdsc->cap_dirty_migrating);
+               }
+               spin_unlock(&mdsc->cap_dirty_lock);
+       }
 
        dout("add_cap inode %p (%llx.%llx) cap %p %s now %s seq %d mds%d\n",
             inode, ceph_vinop(inode), cap, ceph_cap_string(issued),