Skip to content

Commit 17ef15f

Browse files
hac-vsmfrench
authored andcommitted
smb: client: remove unused fid_lock
The fid_lock in struct cached_fid does not currently provide any real synchronization. Previously, it had the intention to prevent a double release of the dentry, but every change to cfid->dentry is already protected either by cfid_list_lock (while the entry is in the list) or happens after the cfid has been removed (so no other thread should find it). Since there is no scenario in which fid_lock prevents any race, it is vestigial and can be removed along with its associated spin_lock()/spin_unlock() calls. Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com> Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 5676398 commit 17ef15f

2 files changed

Lines changed: 3 additions & 15 deletions

File tree

fs/smb/client/cached_dir.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -524,10 +524,9 @@ void close_all_cached_dirs(struct cifs_sb_info *cifs_sb)
524524
spin_unlock(&cifs_sb->tlink_tree_lock);
525525
goto done;
526526
}
527-
spin_lock(&cfid->fid_lock);
527+
528528
tmp_list->dentry = cfid->dentry;
529529
cfid->dentry = NULL;
530-
spin_unlock(&cfid->fid_lock);
531530

532531
list_add_tail(&tmp_list->entry, &entry);
533532
}
@@ -610,14 +609,9 @@ static void cached_dir_put_work(struct work_struct *work)
610609
{
611610
struct cached_fid *cfid = container_of(work, struct cached_fid,
612611
put_work);
613-
struct dentry *dentry;
614-
615-
spin_lock(&cfid->fid_lock);
616-
dentry = cfid->dentry;
612+
dput(cfid->dentry);
617613
cfid->dentry = NULL;
618-
spin_unlock(&cfid->fid_lock);
619614

620-
dput(dentry);
621615
queue_work(serverclose_wq, &cfid->close_work);
622616
}
623617

@@ -675,7 +669,6 @@ static struct cached_fid *init_cached_dir(const char *path)
675669
INIT_LIST_HEAD(&cfid->entry);
676670
INIT_LIST_HEAD(&cfid->dirents.entries);
677671
mutex_init(&cfid->dirents.de_mutex);
678-
spin_lock_init(&cfid->fid_lock);
679672
kref_init(&cfid->refcount);
680673
return cfid;
681674
}
@@ -742,7 +735,6 @@ static void cfids_laundromat_worker(struct work_struct *work)
742735
{
743736
struct cached_fids *cfids;
744737
struct cached_fid *cfid, *q;
745-
struct dentry *dentry;
746738
LIST_HEAD(entry);
747739

748740
cfids = container_of(work, struct cached_fids, laundromat_work.work);
@@ -769,12 +761,9 @@ static void cfids_laundromat_worker(struct work_struct *work)
769761
list_for_each_entry_safe(cfid, q, &entry, entry) {
770762
list_del(&cfid->entry);
771763

772-
spin_lock(&cfid->fid_lock);
773-
dentry = cfid->dentry;
764+
dput(cfid->dentry);
774765
cfid->dentry = NULL;
775-
spin_unlock(&cfid->fid_lock);
776766

777-
dput(dentry);
778767
if (cfid->is_open) {
779768
spin_lock(&cifs_tcp_ses_lock);
780769
++cfid->tcon->tc_count;

fs/smb/client/cached_dir.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ struct cached_fid {
4444
unsigned long last_access_time; /* jiffies of when last accessed */
4545
struct kref refcount;
4646
struct cifs_fid fid;
47-
spinlock_t fid_lock;
4847
struct cifs_tcon *tcon;
4948
struct dentry *dentry;
5049
struct work_struct put_work;

0 commit comments

Comments
 (0)