ceph: set mds_want according to cap import message
authorYan, Zheng <zheng.z.yan@intel.com>
Wed, 27 Feb 2013 01:26:09 +0000 (09:26 +0800)
committerSage Weil <sage@inktank.com>
Thu, 2 May 2013 04:14:32 +0000 (21:14 -0700)
MDS ignores cap update message if migrate_seq mismatch, so when
receiving a cap import message with higher migrate_seq, set mds_want
according to the cap import message.

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

index 0d54368490db1d955ad4ea0627745a7a995e892b..ea1f177739b2bd2cbf64f6d3878f557383fd061e 100644 (file)
@@ -553,6 +553,7 @@ retry:
                cap->implemented = 0;
                cap->mds = mds;
                cap->mds_wanted = 0;
+               cap->mseq = 0;
 
                cap->ci = ci;
                __insert_cap_node(ci, cap);
@@ -628,7 +629,10 @@ retry:
        cap->cap_id = cap_id;
        cap->issued = issued;
        cap->implemented |= issued;
-       cap->mds_wanted |= wanted;
+       if (mseq > cap->mseq)
+               cap->mds_wanted = wanted;
+       else
+               cap->mds_wanted |= wanted;
        cap->seq = seq;
        cap->issue_seq = seq;
        cap->mseq = mseq;