diff options
| -rw-r--r-- | fs/ceph/caps.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index e7af6479c9bc..92643b828c50 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
| @@ -1973,8 +1973,7 @@ retry_locked: | |||
| 1973 | goto ack; | 1973 | goto ack; |
| 1974 | 1974 | ||
| 1975 | /* things we might delay */ | 1975 | /* things we might delay */ |
| 1976 | if ((cap->issued & ~retain) == 0 && | 1976 | if ((cap->issued & ~retain) == 0) |
| 1977 | cap->mds_wanted == want) | ||
| 1978 | continue; /* nope, all good */ | 1977 | continue; /* nope, all good */ |
| 1979 | 1978 | ||
| 1980 | if (no_delay) | 1979 | if (no_delay) |
| @@ -3051,7 +3050,8 @@ static void handle_cap_grant(struct inode *inode, | |||
| 3051 | int used, wanted, dirty; | 3050 | int used, wanted, dirty; |
| 3052 | u64 size = le64_to_cpu(grant->size); | 3051 | u64 size = le64_to_cpu(grant->size); |
| 3053 | u64 max_size = le64_to_cpu(grant->max_size); | 3052 | u64 max_size = le64_to_cpu(grant->max_size); |
| 3054 | int check_caps = 0; | 3053 | unsigned char check_caps = 0; |
| 3054 | bool was_stale = cap->cap_gen < session->s_cap_gen; | ||
| 3055 | bool wake = false; | 3055 | bool wake = false; |
| 3056 | bool writeback = false; | 3056 | bool writeback = false; |
| 3057 | bool queue_trunc = false; | 3057 | bool queue_trunc = false; |
| @@ -3203,13 +3203,20 @@ static void handle_cap_grant(struct inode *inode, | |||
| 3203 | ceph_cap_string(wanted), | 3203 | ceph_cap_string(wanted), |
| 3204 | ceph_cap_string(used), | 3204 | ceph_cap_string(used), |
| 3205 | ceph_cap_string(dirty)); | 3205 | ceph_cap_string(dirty)); |
| 3206 | if (wanted != le32_to_cpu(grant->wanted)) { | 3206 | |
| 3207 | dout("mds wanted %s -> %s\n", | 3207 | if ((was_stale || le32_to_cpu(grant->op) == CEPH_CAP_OP_IMPORT) && |
| 3208 | ceph_cap_string(le32_to_cpu(grant->wanted)), | 3208 | (wanted & ~(cap->mds_wanted | newcaps))) { |
| 3209 | ceph_cap_string(wanted)); | 3209 | /* |
| 3210 | /* imported cap may not have correct mds_wanted */ | 3210 | * If mds is importing cap, prior cap messages that update |
| 3211 | if (le32_to_cpu(grant->op) == CEPH_CAP_OP_IMPORT) | 3211 | * 'wanted' may get dropped by mds (migrate seq mismatch). |
| 3212 | check_caps = 1; | 3212 | * |
| 3213 | * We don't send cap message to update 'wanted' if what we | ||
| 3214 | * want are already issued. If mds revokes caps, cap message | ||
| 3215 | * that releases caps also tells mds what we want. But if | ||
| 3216 | * caps got revoked by mds forcedly (session stale). We may | ||
| 3217 | * haven't told mds what we want. | ||
| 3218 | */ | ||
| 3219 | check_caps = 1; | ||
| 3213 | } | 3220 | } |
| 3214 | 3221 | ||
| 3215 | /* revocation, grant, or no-op? */ | 3222 | /* revocation, grant, or no-op? */ |
