*** WORK IN PROGRESS *** If a lease break is received right as a filesystem is being unmounted, it's possible for cifs_kill_sb() to race with a queued smb2_cached_lease_break(). Since the cfid is no longer on the cfids->entries list, close_all_cached_dirs() cannot drop the dentry, leading to the unmount to report these BUGs: BUG: Dentry ffff88814f37e358{i=1000000000080,n=/} still in use (2) [unmount of cifs cifs] VFS: Busy inodes after unmount of cifs (cifs) ------------[ cut here ]------------ kernel BUG at fs/super.c:661! Flush anything in the cifsiod_wq workqueue in close_all_cached_dirs. Fixes: ebe98f1447bb ("cifs: enable caching of directories for which a lease is held") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Paul Aurich <paul@xxxxxxxxxxxxxx> --- fs/smb/client/cached_dir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c index de1e41abdaf2..931108b3bb4a 100644 --- a/fs/smb/client/cached_dir.c +++ b/fs/smb/client/cached_dir.c @@ -482,10 +482,13 @@ void close_all_cached_dirs(struct cifs_sb_info *cifs_sb) list_for_each_entry(cfid, &cfids->entries, entry) { dput(cfid->dentry); cfid->dentry = NULL; } } + + /* Flush any pending lease breaks */ + flush_workqueue(cifsiod_wq); } /* * Invalidate all cached dirs when a TCON has been reset * due to a session loss. -- 2.45.2