Commit 61c347ba authored by David Howells's avatar David Howells

afs: Clear AFS_VNODE_CB_PROMISED if we detect callback expiry

Fix afs_validate() to clear AFS_VNODE_CB_PROMISED on a vnode if we detect
any condition that causes the callback promise to be broken implicitly,
including server break (cb_s_break), volume break (cb_v_break) or callback
expiry.

Fixes: ae3b7361 ("afs: Fix validation/callback interaction")
Reported-by: default avatarMarc Dionne <marc.dionne@auristor.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent f642404a
...@@ -571,7 +571,7 @@ bool afs_check_validity(struct afs_vnode *vnode) ...@@ -571,7 +571,7 @@ bool afs_check_validity(struct afs_vnode *vnode)
struct afs_server *server; struct afs_server *server;
struct afs_volume *volume = vnode->volume; struct afs_volume *volume = vnode->volume;
time64_t now = ktime_get_real_seconds(); time64_t now = ktime_get_real_seconds();
bool valid; bool valid, need_clear = false;
unsigned int cb_break, cb_s_break, cb_v_break; unsigned int cb_break, cb_s_break, cb_v_break;
int seq = 0; int seq = 0;
...@@ -589,10 +589,13 @@ bool afs_check_validity(struct afs_vnode *vnode) ...@@ -589,10 +589,13 @@ bool afs_check_validity(struct afs_vnode *vnode)
vnode->cb_v_break != cb_v_break) { vnode->cb_v_break != cb_v_break) {
vnode->cb_s_break = cb_s_break; vnode->cb_s_break = cb_s_break;
vnode->cb_v_break = cb_v_break; vnode->cb_v_break = cb_v_break;
need_clear = true;
valid = false; valid = false;
} else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) { } else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) {
need_clear = true;
valid = false; valid = false;
} else if (vnode->cb_expires_at - 10 <= now) { } else if (vnode->cb_expires_at - 10 <= now) {
need_clear = true;
valid = false; valid = false;
} else { } else {
valid = true; valid = true;
...@@ -607,6 +610,15 @@ bool afs_check_validity(struct afs_vnode *vnode) ...@@ -607,6 +610,15 @@ bool afs_check_validity(struct afs_vnode *vnode)
} while (need_seqretry(&vnode->cb_lock, seq)); } while (need_seqretry(&vnode->cb_lock, seq));
done_seqretry(&vnode->cb_lock, seq); done_seqretry(&vnode->cb_lock, seq);
if (need_clear) {
write_seqlock(&vnode->cb_lock);
if (cb_break == vnode->cb_break)
__afs_break_callback(vnode);
write_sequnlock(&vnode->cb_lock);
valid = false;
}
return valid; return valid;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment