summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Aurich <paul@darkrain42.org>2024-11-08 14:29:05 -0800
committerSteve French <stfrench@microsoft.com>2024-11-10 22:50:38 -0600
commite6054a2024c888391aff754fced5af18ff0efc81 (patch)
tree41cbf18c778140d40a397116e3e61196530699fa
parent417536fd86a4ee6395f4bdf731f4f729d6b26744 (diff)
downloadlinux-e6054a2024c888391aff754fced5af18ff0efc81.tar.gz
linux-e6054a2024c888391aff754fced5af18ff0efc81.tar.bz2
linux-e6054a2024c888391aff754fced5af18ff0efc81.zip
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 <paul@darkrain42.org> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/cached_dir.c8
1 files 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;
@@ -643,11 +644,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.
*/