ceph: implemented caps should always be superset of issued caps
authorSage Weil <sage@newdream.net>
Mon, 8 Mar 2010 23:27:53 +0000 (15:27 -0800)
committerSage Weil <sage@newdream.net>
Sun, 21 Mar 2010 04:33:06 +0000 (21:33 -0700)
Added assertion, and cleared one case where the implemented caps were
not following the issued caps.

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

index db122bb357b89f413c485d532c5cba8a83944b39..57d9b44a8820cee3ce3fbb5ce37ebbb57260d1c0 100644 (file)
@@ -2334,6 +2334,7 @@ static int handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
                           revoked_rdcache)
                        reply = 2;     /* send revoke ack in check_caps */
                cap->issued = newcaps;
+               cap->implemented |= newcaps;
        } else if (cap->issued == newcaps) {
                dout("caps unchanged: %s -> %s\n",
                     ceph_cap_string(cap->issued), ceph_cap_string(newcaps));
@@ -2346,6 +2347,7 @@ static int handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
                                              * pending revocation */
                wake = 1;
        }
+       BUG_ON(cap->issued & ~cap->implemented);
 
        spin_unlock(&inode->i_lock);
        if (writeback)