From d9aea98220df67d09cb79d290eeb47bfcf8b8820 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 23 Mar 2021 16:08:27 -0700 Subject: [PATCH] Shutdown locking before transactions Shutting down the lock client waits for invalidation work and prevents future work from being queued. We're currently shutting down the subsystems that lock calls before lock itself, leading to crashes if we happen to have invalidations executing as we unmount. Shutting down locking before its dependencies fixes this. This was hit in testing during the inode deletion fixes because it created the perfect race by acquiring locks during unmount so that the server was very unlikely to send invalidations on behalf to one mount on behalf of another as they both unmounted. Signed-off-by: Zach Brown --- kmod/src/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kmod/src/super.c b/kmod/src/super.c index b72cc18b..96bc6aca 100644 --- a/kmod/src/super.c +++ b/kmod/src/super.c @@ -251,6 +251,8 @@ static void scoutfs_put_super(struct super_block *sb) scoutfs_unlock(sb, sbi->rid_lock, SCOUTFS_LOCK_WRITE); sbi->rid_lock = NULL; + scoutfs_lock_shutdown(sb); + scoutfs_shutdown_trans(sb); scoutfs_client_destroy(sb); scoutfs_inode_destroy(sb); @@ -258,7 +260,6 @@ static void scoutfs_put_super(struct super_block *sb) scoutfs_forest_destroy(sb); scoutfs_quorum_destroy(sb); - scoutfs_lock_shutdown(sb); scoutfs_server_destroy(sb); scoutfs_recov_destroy(sb); scoutfs_net_destroy(sb);