Skip to content

Commit

Permalink
smb: client: remove unnecessary checks in open_cached_dir()
Browse files Browse the repository at this point in the history
Checks inside open_cached_dir() can be removed because if dir caching is
disabled then tcon->cfids is necessarily NULL. Therefore, all other checks
are redundant.

Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Reviewed-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
Henrique Carvalho authored and Steve French committed Nov 25, 2024
1 parent 228a115 commit f6e8883
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fs/smb/client/cached_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,17 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
const char *npath;
int retries = 0, cur_sleep = 1;

if (tcon == NULL || tcon->cfids == NULL || tcon->nohandlecache ||
is_smb1_server(tcon->ses->server) || (dir_cache_timeout == 0))
if (cifs_sb->root == NULL)
return -ENOENT;

if (tcon == NULL)
return -EOPNOTSUPP;

ses = tcon->ses;
cfids = tcon->cfids;

if (cifs_sb->root == NULL)
return -ENOENT;
if (cfids == NULL)
return -EOPNOTSUPP;

replay_again:
/* reinitialize for possible replay */
Expand Down

0 comments on commit f6e8883

Please sign in to comment.