diff options
author | Sage Weil <sage@newdream.net> | 2010-06-10 16:20:33 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-08-01 23:11:39 -0400 |
commit | 3b454c4945c756686e91d77eeefac80cb5d21baf (patch) | |
tree | bd55ec2db3c234cf2fb1eebcf1ace3e4b9e2bc35 /fs/ceph/caps.c | |
parent | 38e8883ee31667d901feb9106f4863af35948c91 (diff) |
ceph: simplify caps revocation, fix for multimds
The caps revocation should either initiate writeback, invalidateion, or
call check_caps to ack or do the dirty work. The primary question is
whether we can get away with only checking the auth cap or whether all
caps need to be checked.
The old code was doing...something else. At the very least, revocations
from non-auth MDSs could break by triggering the "check auth cap only"
case.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index a5b5725931bf..82ffde618af0 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -2278,8 +2278,8 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2278 | * try to invalidate (once). (If there are dirty buffers, we | 2278 | * try to invalidate (once). (If there are dirty buffers, we |
2279 | * will invalidate _after_ writeback.) | 2279 | * will invalidate _after_ writeback.) |
2280 | */ | 2280 | */ |
2281 | if (((cap->issued & ~newcaps) & (CEPH_CAP_FILE_CACHE| | 2281 | if (((cap->issued & ~newcaps) & CEPH_CAP_FILE_CACHE) && |
2282 | CEPH_CAP_FILE_LAZYIO)) && | 2282 | (newcaps & CEPH_CAP_FILE_LAZYIO) == 0 && |
2283 | !ci->i_wrbuffer_ref) { | 2283 | !ci->i_wrbuffer_ref) { |
2284 | if (try_nonblocking_invalidate(inode) == 0) { | 2284 | if (try_nonblocking_invalidate(inode) == 0) { |
2285 | revoked_rdcache = 1; | 2285 | revoked_rdcache = 1; |
@@ -2371,16 +2371,22 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2371 | 2371 | ||
2372 | /* revocation, grant, or no-op? */ | 2372 | /* revocation, grant, or no-op? */ |
2373 | if (cap->issued & ~newcaps) { | 2373 | if (cap->issued & ~newcaps) { |
2374 | dout("revocation: %s -> %s\n", ceph_cap_string(cap->issued), | 2374 | int revoking = cap->issued & ~newcaps; |
2375 | ceph_cap_string(newcaps)); | 2375 | |
2376 | if ((used & ~newcaps) & CEPH_CAP_FILE_BUFFER) | 2376 | dout("revocation: %s -> %s (revoking %s)\n", |
2377 | writeback = 1; /* will delay ack */ | 2377 | ceph_cap_string(cap->issued), |
2378 | else if (dirty & ~newcaps) | 2378 | ceph_cap_string(newcaps), |
2379 | check_caps = 1; /* initiate writeback in check_caps */ | 2379 | ceph_cap_string(revoking)); |
2380 | else if (((used & ~newcaps) & (CEPH_CAP_FILE_CACHE| | 2380 | if (revoking & CEPH_CAP_FILE_BUFFER) |
2381 | CEPH_CAP_FILE_LAZYIO)) == 0 || | 2381 | writeback = 1; /* initiate writeback; will delay ack */ |
2382 | revoked_rdcache) | 2382 | else if (revoking == CEPH_CAP_FILE_CACHE && |
2383 | check_caps = 2; /* send revoke ack in check_caps */ | 2383 | (newcaps & CEPH_CAP_FILE_LAZYIO) == 0 && |
2384 | queue_invalidate) | ||
2385 | ; /* do nothing yet, invalidation will be queued */ | ||
2386 | else if (cap == ci->i_auth_cap) | ||
2387 | check_caps = 1; /* check auth cap only */ | ||
2388 | else | ||
2389 | check_caps = 2; /* check all caps */ | ||
2384 | cap->issued = newcaps; | 2390 | cap->issued = newcaps; |
2385 | cap->implemented |= newcaps; | 2391 | cap->implemented |= newcaps; |
2386 | } else if (cap->issued == newcaps) { | 2392 | } else if (cap->issued == newcaps) { |