mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 22:51:42 +00:00
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>
This commit is contained in:
parent
38e8883ee3
commit
3b454c4945
@ -2278,8 +2278,8 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
|
|||||||
* try to invalidate (once). (If there are dirty buffers, we
|
* try to invalidate (once). (If there are dirty buffers, we
|
||||||
* will invalidate _after_ writeback.)
|
* will invalidate _after_ writeback.)
|
||||||
*/
|
*/
|
||||||
if (((cap->issued & ~newcaps) & (CEPH_CAP_FILE_CACHE|
|
if (((cap->issued & ~newcaps) & CEPH_CAP_FILE_CACHE) &&
|
||||||
CEPH_CAP_FILE_LAZYIO)) &&
|
(newcaps & CEPH_CAP_FILE_LAZYIO) == 0 &&
|
||||||
!ci->i_wrbuffer_ref) {
|
!ci->i_wrbuffer_ref) {
|
||||||
if (try_nonblocking_invalidate(inode) == 0) {
|
if (try_nonblocking_invalidate(inode) == 0) {
|
||||||
revoked_rdcache = 1;
|
revoked_rdcache = 1;
|
||||||
@ -2371,16 +2371,22 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
|
|||||||
|
|
||||||
/* revocation, grant, or no-op? */
|
/* revocation, grant, or no-op? */
|
||||||
if (cap->issued & ~newcaps) {
|
if (cap->issued & ~newcaps) {
|
||||||
dout("revocation: %s -> %s\n", ceph_cap_string(cap->issued),
|
int revoking = cap->issued & ~newcaps;
|
||||||
ceph_cap_string(newcaps));
|
|
||||||
if ((used & ~newcaps) & CEPH_CAP_FILE_BUFFER)
|
dout("revocation: %s -> %s (revoking %s)\n",
|
||||||
writeback = 1; /* will delay ack */
|
ceph_cap_string(cap->issued),
|
||||||
else if (dirty & ~newcaps)
|
ceph_cap_string(newcaps),
|
||||||
check_caps = 1; /* initiate writeback in check_caps */
|
ceph_cap_string(revoking));
|
||||||
else if (((used & ~newcaps) & (CEPH_CAP_FILE_CACHE|
|
if (revoking & CEPH_CAP_FILE_BUFFER)
|
||||||
CEPH_CAP_FILE_LAZYIO)) == 0 ||
|
writeback = 1; /* initiate writeback; will delay ack */
|
||||||
revoked_rdcache)
|
else if (revoking == CEPH_CAP_FILE_CACHE &&
|
||||||
check_caps = 2; /* send revoke ack in check_caps */
|
(newcaps & CEPH_CAP_FILE_LAZYIO) == 0 &&
|
||||||
|
queue_invalidate)
|
||||||
|
; /* do nothing yet, invalidation will be queued */
|
||||||
|
else if (cap == ci->i_auth_cap)
|
||||||
|
check_caps = 1; /* check auth cap only */
|
||||||
|
else
|
||||||
|
check_caps = 2; /* check all caps */
|
||||||
cap->issued = newcaps;
|
cap->issued = newcaps;
|
||||||
cap->implemented |= newcaps;
|
cap->implemented |= newcaps;
|
||||||
} else if (cap->issued == newcaps) {
|
} else if (cap->issued == newcaps) {
|
||||||
|
Loading…
Reference in New Issue
Block a user