ceph: only queue capsnap if caps are dirty
authorSage Weil <sage@newdream.net>
Tue, 26 Jul 2011 18:26:41 +0000 (11:26 -0700)
committerSage Weil <sage@newdream.net>
Tue, 26 Jul 2011 18:26:41 +0000 (11:26 -0700)
We used to go into this branch if i_wrbuffer_ref_head was non-zero.  This
was an ancient check from before we were careful about dealing with all
kinds of caps (and not just dirty pages).  It is cleaner to only queue a
capsnap if there is an actual dirty cap.  If we are racing with...
something...we will end up here with ci->i_wrbuffer_refs but no dirty
caps.

Reviewed-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/snap.c

index ac030c9d99593d66fe8895bd3aad1a3db1cf53e6..e2643719133323a07a8e69f0f631c306e80f7532 100644 (file)
@@ -465,9 +465,8 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci)
                   cap_snap.  lucky us. */
                dout("queue_cap_snap %p already pending\n", inode);
                kfree(capsnap);
-       } else if (ci->i_wrbuffer_ref_head ||
-                  (dirty & (CEPH_CAP_AUTH_EXCL|CEPH_CAP_XATTR_EXCL|
-                            CEPH_CAP_FILE_EXCL|CEPH_CAP_FILE_WR))) {
+       } else if (dirty & (CEPH_CAP_AUTH_EXCL|CEPH_CAP_XATTR_EXCL|
+                           CEPH_CAP_FILE_EXCL|CEPH_CAP_FILE_WR)) {
                struct ceph_snap_context *snapc = ci->i_head_snapc;
 
                /*
@@ -480,7 +479,6 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci)
                dout("queue_cap_snap %p cap_snap %p queuing under %p %s\n",
                     inode, capsnap, snapc, ceph_cap_string(dirty));
                ihold(inode);
-               BUG_ON(dirty == 0);
 
                atomic_set(&capsnap->nref, 1);
                capsnap->ci = ci;