Re: [PATCH v2 2/3] smb: client: remove unnecessary checks in open_cached_dir()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/22, Henrique Carvalho wrote:
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@xxxxxxxx>
---
V1 -> V2: Split patch and addressed review comments

fs/smb/client/cached_dir.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c
index 8b510c858f4ff..85a8cc04e2c81 100644
--- a/fs/smb/client/cached_dir.c
+++ b/fs/smb/client/cached_dir.c
@@ -162,15 +162,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;

Callers of open_cached_dir() seems to only handle its return value as
0 or -ENOENT, but if cifs_sb->root is NULL at this point (even though
unlikely), it's definitely neither.

Maybe returning something different here (e.g. -EIO) and handling it
properly in a follow up patch would be good.

+
+	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 */

Reviewed-by: Enzo Matsumiya <ematsumiya@xxxxxxx>


Cheers




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux