Skip to content

Commit 1a33418

Browse files
committed
Merge tag '6.15-rc5-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client fixes from Steve French: - Fix dentry leak which can cause umount crash - Add warning for parse contexts error on compounded operation * tag '6.15-rc5-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: smb: client: Avoid race in open_cached_dir with lease breaks smb3 client: warn when parse contexts returns error on compounded operation
2 parents 0e1329d + 3ca02e6 commit 1a33418

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

fs/smb/client/cached_dir.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ static struct cached_fid *find_or_create_cached_dir(struct cached_fids *cfids,
2929
{
3030
struct cached_fid *cfid;
3131

32-
spin_lock(&cfids->cfid_list_lock);
3332
list_for_each_entry(cfid, &cfids->entries, entry) {
3433
if (!strcmp(cfid->path, path)) {
3534
/*
@@ -38,25 +37,20 @@ static struct cached_fid *find_or_create_cached_dir(struct cached_fids *cfids,
3837
* being deleted due to a lease break.
3938
*/
4039
if (!cfid->time || !cfid->has_lease) {
41-
spin_unlock(&cfids->cfid_list_lock);
4240
return NULL;
4341
}
4442
kref_get(&cfid->refcount);
45-
spin_unlock(&cfids->cfid_list_lock);
4643
return cfid;
4744
}
4845
}
4946
if (lookup_only) {
50-
spin_unlock(&cfids->cfid_list_lock);
5147
return NULL;
5248
}
5349
if (cfids->num_entries >= max_cached_dirs) {
54-
spin_unlock(&cfids->cfid_list_lock);
5550
return NULL;
5651
}
5752
cfid = init_cached_dir(path);
5853
if (cfid == NULL) {
59-
spin_unlock(&cfids->cfid_list_lock);
6054
return NULL;
6155
}
6256
cfid->cfids = cfids;
@@ -74,7 +68,6 @@ static struct cached_fid *find_or_create_cached_dir(struct cached_fids *cfids,
7468
*/
7569
cfid->has_lease = true;
7670

77-
spin_unlock(&cfids->cfid_list_lock);
7871
return cfid;
7972
}
8073

@@ -187,8 +180,10 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
187180
if (!utf16_path)
188181
return -ENOMEM;
189182

183+
spin_lock(&cfids->cfid_list_lock);
190184
cfid = find_or_create_cached_dir(cfids, path, lookup_only, tcon->max_cached_dirs);
191185
if (cfid == NULL) {
186+
spin_unlock(&cfids->cfid_list_lock);
192187
kfree(utf16_path);
193188
return -ENOENT;
194189
}
@@ -197,7 +192,6 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
197192
* Otherwise, it is either a new entry or laundromat worker removed it
198193
* from @cfids->entries. Caller will put last reference if the latter.
199194
*/
200-
spin_lock(&cfids->cfid_list_lock);
201195
if (cfid->has_lease && cfid->time) {
202196
spin_unlock(&cfids->cfid_list_lock);
203197
*ret_cfid = cfid;

fs/smb/client/smb2inode.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,8 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
666666
/* smb2_parse_contexts() fills idata->fi.IndexNumber */
667667
rc = smb2_parse_contexts(server, &rsp_iov[0], &oparms->fid->epoch,
668668
oparms->fid->lease_key, &oplock, &idata->fi, NULL);
669+
if (rc)
670+
cifs_dbg(VFS, "rc: %d parsing context of compound op\n", rc);
669671
}
670672

671673
for (i = 0; i < num_cmds; i++) {

0 commit comments

Comments
 (0)