ceph: check migrate seq before changing auth cap
authorYan, Zheng <[email protected]>
Fri, 31 May 2013 08:37:11 +0000 (16:37 +0800)
committerSage Weil <[email protected]>
Wed, 3 Jul 2013 22:32:48 +0000 (15:32 -0700)
We may receive old request reply from the exporter MDS after receiving
the importer MDS' cap import message.

Signed-off-by: Yan, Zheng <[email protected]>
Reviewed-by: Sage Weil <[email protected]>
fs/ceph/caps.c

index 54c290b083ab75c3a082d7c909ab8312d15a8448..790f88b15daf11f696f352f331f2e8e410b182e8 100644 (file)
@@ -612,9 +612,11 @@ retry:
                __cap_delay_requeue(mdsc, ci);
        }
 
-       if (flags & CEPH_CAP_FLAG_AUTH)
-               ci->i_auth_cap = cap;
-       else if (ci->i_auth_cap == cap) {
+       if (flags & CEPH_CAP_FLAG_AUTH) {
+               if (ci->i_auth_cap == NULL ||
+                   ceph_seq_cmp(ci->i_auth_cap->mseq, mseq) < 0)
+                       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)) {