From e6054a2024c888391aff754fced5af18ff0efc81 Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Fri, 8 Nov 2024 14:29:05 -0800 Subject: smb: No need to wait for work when cleaning up cached directories It isn't possible for cfids_laundromat_worker(), invalidate_all_cached_dirs(), and cached_dir_lease_break() to race with each other. Each holds the spinlock while walking the list of cfids, and removes entries from the list. cfids_laundromat_worker() and invalidate_all_cached_dirs() will never see a cfid that has pending work. Signed-off-by: Paul Aurich Signed-off-by: Steve French --- fs/smb/client/cached_dir.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c index 06eb19dabb0e..de1e41abdaf2 100644 --- a/fs/smb/client/cached_dir.c +++ b/fs/smb/client/cached_dir.c @@ -518,7 +518,6 @@ void invalidate_all_cached_dirs(struct cifs_tcon *tcon) list_for_each_entry_safe(cfid, q, &entry, entry) { list_del(&cfid->entry); - cancel_work_sync(&cfid->lease_break); /* * Drop the ref-count from above, either the lease-ref (if there * was one) or the extra one acquired. @@ -596,6 +595,8 @@ static void free_cached_dir(struct cached_fid *cfid) { struct cached_dirent *dirent, *q; + WARN_ON(work_pending(&cfid->lease_break)); + dput(cfid->dentry); cfid->dentry = NULL; @@ -642,11 +643,6 @@ static void cfids_laundromat_worker(struct work_struct *work) list_for_each_entry_safe(cfid, q, &entry, entry) { list_del(&cfid->entry); - /* - * Cancel and wait for the work to finish in case we are racing - * with it. - */ - cancel_work_sync(&cfid->lease_break); /* * Drop the ref-count from above, either the lease-ref (if there * was one) or the extra one acquired. -- cgit v1.2.3