aboutsummaryrefslogtreecommitdiffstats
path: root/fs/afs/inode.c
diff options
context:
space:
mode:
authorDavid Howells <[email protected]>2024-05-24 14:26:11 +0000
committerChristian Brauner <[email protected]>2024-05-27 11:12:13 +0000
commitf89ea63f1c65d3e93b255f14f9d9e05df87955fa (patch)
treed413765b7c77af900f3550e127a3124a9f23ab41 /fs/afs/inode.c
parentafs: Don't cross .backup mountpoint from backup volume (diff)
downloadkernel-f89ea63f1c65d3e93b255f14f9d9e05df87955fa.tar.gz
kernel-f89ea63f1c65d3e93b255f14f9d9e05df87955fa.zip
netfs, 9p: Fix race between umount and async request completion
There's a problem in 9p's interaction with netfslib whereby a crash occurs because the 9p_fid structs get forcibly destroyed during client teardown (without paying attention to their refcounts) before netfslib has finished with them. However, it's not a simple case of deferring the clunking that p9_fid_put() does as that requires the p9_client record to still be present. The problem is that netfslib has to unlock pages and clear the IN_PROGRESS flag before destroying the objects involved - including the fid - and, in any case, nothing checks to see if writeback completed barring looking at the page flags. Fix this by keeping a count of outstanding I/O requests (of any type) and waiting for it to quiesce during inode eviction. Reported-by: [email protected] Link: https://lore.kernel.org/all/[email protected]/ Reported-by: [email protected] Link: https://lore.kernel.org/all/[email protected]/ Reported-by: [email protected] Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: David Howells <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: [email protected] Reviewed-by: Dominique Martinet <[email protected]> cc: Eric Van Hensbergen <[email protected]> cc: Latchesar Ionkov <[email protected]> cc: Christian Schoenebeck <[email protected]> cc: Jeff Layton <[email protected]> cc: Steve French <[email protected]> cc: Hillf Danton <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] cc: [email protected] cc: [email protected] Reported-and-tested-by: [email protected] Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'fs/afs/inode.c')
-rw-r--r--fs/afs/inode.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 94fc049aff58..15bb7989c387 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -648,6 +648,7 @@ void afs_evict_inode(struct inode *inode)
ASSERTCMP(inode->i_ino, ==, vnode->fid.vnode);
+ netfs_wait_for_outstanding_io(inode);
truncate_inode_pages_final(&inode->i_data);
afs_set_cache_aux(vnode, &aux);