Skip to content

Commit 47fc249

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
cifs: improve handlecaching
Only track the dentry for the root handle Signed-off-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent aea6794 commit 47fc249

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fs/cifs/cached_dir.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
4747
if (cifs_sb->root == NULL)
4848
return -ENOENT;
4949

50-
if (strlen(path))
50+
if (!path[0])
51+
dentry = cifs_sb->root;
52+
else
5153
return -ENOENT;
5254

53-
dentry = cifs_sb->root;
54-
5555
cfid = &tcon->cfids->cfid;
5656
mutex_lock(&cfid->fid_mutex);
5757
if (cfid->is_valid) {
@@ -177,7 +177,8 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
177177
cfid->tcon = tcon;
178178
cfid->is_valid = true;
179179
cfid->dentry = dentry;
180-
dget(dentry);
180+
if (dentry)
181+
dget(dentry);
181182
kref_init(&cfid->refcount);
182183

183184
/* BB TBD check to see if oplock level check can be removed below */

0 commit comments

Comments
 (0)