Merge tag 'sunxi-dt-for-3.16-2' of https://github.com/mripard/linux into for-next
[firefly-linux-kernel-4.4.55.git] / fs / ceph / caps.c
index 17543383545c162f58425fbc8629a99f1c5a717e..2e5e648eb5c3dc3bd82bea5ce8dead051864cf75 100644 (file)
@@ -622,8 +622,10 @@ retry:
 
        if (flags & CEPH_CAP_FLAG_AUTH) {
                if (ci->i_auth_cap == NULL ||
-                   ceph_seq_cmp(ci->i_auth_cap->mseq, mseq) < 0)
+                   ceph_seq_cmp(ci->i_auth_cap->mseq, mseq) < 0) {
                        ci->i_auth_cap = cap;
+                       cap->mds_wanted = wanted;
+               }
                ci->i_cap_exporting_issued = 0;
        } else {
                WARN_ON(ci->i_auth_cap == cap);
@@ -885,7 +887,10 @@ int __ceph_caps_mds_wanted(struct ceph_inode_info *ci)
                cap = rb_entry(p, struct ceph_cap, ci_node);
                if (!__cap_is_valid(cap))
                        continue;
-               mds_wanted |= cap->mds_wanted;
+               if (cap == ci->i_auth_cap)
+                       mds_wanted |= cap->mds_wanted;
+               else
+                       mds_wanted |= (cap->mds_wanted & ~CEPH_CAP_ANY_FILE_WR);
        }
        return mds_wanted;
 }