From: Enzo Matsumiya <ematsumiya@suse.de>
Date: Wed, 18 May 2022 11:41:05 -0300
Subject: [PATCH] cifs: return ENOENT for DFS lookup_cache_entry()
Git-commit: 337b8b0e4343567221ef8d88aac5e418208d4ac1
References: bsc#1190317
Patch-mainline: v5.18
EEXIST didn't make sense to use when dfs_cache_find() couldn't find a
cache entry nor retrieve a referral target.
It also doesn't make sense cifs_dfs_query_info_nonascii_quirk() to
emulate ENOENT anymore.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/connect.c | 6 ++++--
fs/cifs/dfs_cache.c | 6 +++---
2 files changed, 7 insertions(+), 5 deletions(-)
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -4753,8 +4753,9 @@ cifs_are_all_path_components_accessible(
}
/*
- * Check if path is remote (e.g. a DFS share). Return -EREMOTE if it is,
- * otherwise 0.
+ * Check if path is remote (i.e. a DFS share).
+ *
+ * Return -EREMOTE if it is, otherwise 0 or -errno.
*/
static int is_path_remote(struct mount_ctx *mnt_ctx)
{
@@ -5032,6 +5033,7 @@ int cifs_mount(struct cifs_sb_info *cifs
if (!isdfs)
goto out;
+ /* proceed as DFS mount */
uuid_gen(&mnt_ctx.mount_id);
rc = connect_dfs_root(&mnt_ctx, &tl);
dfs_cache_free_tgts(&tl);
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -651,7 +651,7 @@ static struct cache_entry *__lookup_cach
return ce;
}
}
- return ERR_PTR(-EEXIST);
+ return ERR_PTR(-ENOENT);
}
/*
@@ -659,7 +659,7 @@ static struct cache_entry *__lookup_cach
*
* Use whole path components in the match. Must be called with htable_rw_lock held.
*
- * Return ERR_PTR(-EEXIST) if the entry is not found.
+ * Return ERR_PTR(-ENOENT) if the entry is not found.
*/
static struct cache_entry *lookup_cache_entry(const char *path)
{
@@ -707,7 +707,7 @@ static struct cache_entry *lookup_cache_
while (e > s && *e != sep)
e--;
}
- return ERR_PTR(-EEXIST);
+ return ERR_PTR(-ENOENT);
}
/**