ceph: check mds_wanted for imported cap
authorYan, Zheng <zheng.z.yan@intel.com>
Fri, 4 Jan 2013 07:30:10 +0000 (15:30 +0800)
committerAlex Elder <elder@inktank.com>
Thu, 17 Jan 2013 18:42:38 +0000 (12:42 -0600)
The MDS may have incorrect wanted caps after importing caps. So the
client should check the value mds has and send cap update if necessary.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Sage Weil <sage@inktank.com>
fs/ceph/caps.c

index 40b5bbe..1e1e020 100644 (file)
@@ -2429,7 +2429,9 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
                dout("mds wanted %s -> %s\n",
                     ceph_cap_string(le32_to_cpu(grant->wanted)),
                     ceph_cap_string(wanted));
-               grant->wanted = cpu_to_le32(wanted);
+               /* imported cap may not have correct mds_wanted */
+               if (le32_to_cpu(grant->op) == CEPH_CAP_OP_IMPORT)
+                       check_caps = 1;
        }
 
        cap->seq = seq;