* [PATCH] cifs: print TIDs as hex
2022-05-18 14:41 [PATCH] cifs: don't call cifs_dfs_query_info_nonascii_quirk() if nodfs was set Enzo Matsumiya
@ 2022-05-18 14:41 ` Enzo Matsumiya
2022-05-18 16:22 ` Paulo Alcantara
2022-05-18 14:41 ` [PATCH] cifs: return ENOENT for DFS lookup_cache_entry() Enzo Matsumiya
2022-05-18 16:20 ` [PATCH] cifs: don't call cifs_dfs_query_info_nonascii_quirk() if nodfs was set Paulo Alcantara
2 siblings, 1 reply; 7+ messages in thread
From: Enzo Matsumiya @ 2022-05-18 14:41 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore, Enzo Matsumiya
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
fs/cifs/connect.c | 2 +-
fs/cifs/smb2misc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 9cd866d929a9..f3b165413ab7 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1789,7 +1789,7 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx)
goto out;
}
- cifs_dbg(FYI, "IPC tcon rc = %d ipc tid = %d\n", rc, tcon->tid);
+ cifs_dbg(FYI, "IPC tcon rc=%d ipc tid=0x%x\n", rc, tcon->tid);
ses->tcon_ipc = tcon;
out:
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 3fe47a88f47d..15b5d2565e79 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -798,7 +798,7 @@ smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid,
if (tcon->ses)
server = tcon->ses->server;
- cifs_server_dbg(FYI, "tid=%u: tcon is closing, skipping async close retry of fid %llu %llu\n",
+ cifs_server_dbg(FYI, "tid=0x%x: tcon is closing, skipping async close retry of fid %llu %llu\n",
tcon->tid, persistent_fid, volatile_fid);
return 0;
--
2.36.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] cifs: return ENOENT for DFS lookup_cache_entry()
2022-05-18 14:41 [PATCH] cifs: don't call cifs_dfs_query_info_nonascii_quirk() if nodfs was set Enzo Matsumiya
2022-05-18 14:41 ` [PATCH] cifs: print TIDs as hex Enzo Matsumiya
@ 2022-05-18 14:41 ` Enzo Matsumiya
2022-05-18 16:23 ` Paulo Alcantara
2022-05-18 16:20 ` [PATCH] cifs: don't call cifs_dfs_query_info_nonascii_quirk() if nodfs was set Paulo Alcantara
2 siblings, 1 reply; 7+ messages in thread
From: Enzo Matsumiya @ 2022-05-18 14:41 UTC (permalink / raw)
To: linux-cifs; +Cc: smfrench, pc, ronniesahlberg, nspmangalore, Enzo Matsumiya
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>
---
fs/cifs/connect.c | 6 ++++--
fs/cifs/dfs_cache.c | 6 +++---
fs/cifs/misc.c | 6 +-----
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 1ef3d16a8bda..9cd866d929a9 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3420,8 +3420,9 @@ cifs_are_all_path_components_accessible(struct TCP_Server_Info *server,
}
/*
- * 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)
{
@@ -3711,6 +3712,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
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);
diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
index 956f8e5cf3e7..c5dd6f7305bd 100644
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -654,7 +654,7 @@ static struct cache_entry *__lookup_cache_entry(const char *path, unsigned int h
return ce;
}
}
- return ERR_PTR(-EEXIST);
+ return ERR_PTR(-ENOENT);
}
/*
@@ -662,7 +662,7 @@ static struct cache_entry *__lookup_cache_entry(const char *path, unsigned int h
*
* 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)
{
@@ -710,7 +710,7 @@ static struct cache_entry *lookup_cache_entry(const char *path)
while (e > s && *e != sep)
e--;
}
- return ERR_PTR(-EEXIST);
+ return ERR_PTR(-ENOENT);
}
/**
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index afaf59c22193..a5b5b15e658a 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -1309,7 +1309,7 @@ int cifs_update_super_prepath(struct cifs_sb_info *cifs_sb, char *prefix)
* for "\<server>\<dfsname>\<linkpath>" DFS reference,
* where <dfsname> contains non-ASCII unicode symbols.
*
- * Check such DFS reference and emulate -ENOENT if it is actual.
+ * Check such DFS reference.
*/
int cifs_dfs_query_info_nonascii_quirk(const unsigned int xid,
struct cifs_tcon *tcon,
@@ -1341,10 +1341,6 @@ int cifs_dfs_query_info_nonascii_quirk(const unsigned int xid,
cifs_dbg(FYI, "DFS ref '%s' is found, emulate -EREMOTE\n",
dfspath);
rc = -EREMOTE;
- } else if (rc == -EEXIST) {
- cifs_dbg(FYI, "DFS ref '%s' is not found, emulate -ENOENT\n",
- dfspath);
- rc = -ENOENT;
} else {
cifs_dbg(FYI, "%s: dfs_cache_find returned %d\n", __func__, rc);
}
--
2.36.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] cifs: return ENOENT for DFS lookup_cache_entry()
2022-05-18 14:41 ` [PATCH] cifs: return ENOENT for DFS lookup_cache_entry() Enzo Matsumiya
@ 2022-05-18 16:23 ` Paulo Alcantara
0 siblings, 0 replies; 7+ messages in thread
From: Paulo Alcantara @ 2022-05-18 16:23 UTC (permalink / raw)
To: Enzo Matsumiya, linux-cifs
Cc: smfrench, ronniesahlberg, nspmangalore, Enzo Matsumiya
Enzo Matsumiya <ematsumiya@suse.de> writes:
> 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>
> ---
> fs/cifs/connect.c | 6 ++++--
> fs/cifs/dfs_cache.c | 6 +++---
> fs/cifs/misc.c | 6 +-----
> 3 files changed, 8 insertions(+), 10 deletions(-)
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cifs: don't call cifs_dfs_query_info_nonascii_quirk() if nodfs was set
2022-05-18 14:41 [PATCH] cifs: don't call cifs_dfs_query_info_nonascii_quirk() if nodfs was set Enzo Matsumiya
2022-05-18 14:41 ` [PATCH] cifs: print TIDs as hex Enzo Matsumiya
2022-05-18 14:41 ` [PATCH] cifs: return ENOENT for DFS lookup_cache_entry() Enzo Matsumiya
@ 2022-05-18 16:20 ` Paulo Alcantara
2022-05-18 16:24 ` Enzo Matsumiya
2 siblings, 1 reply; 7+ messages in thread
From: Paulo Alcantara @ 2022-05-18 16:20 UTC (permalink / raw)
To: Enzo Matsumiya, linux-cifs
Cc: smfrench, ronniesahlberg, nspmangalore, Enzo Matsumiya
Enzo Matsumiya <ematsumiya@suse.de> writes:
> Also return EOPNOTSUPP if path is remote but nodfs was set.
>
> Fixes: a2809d0e1696 ("cifs: quirk for STATUS_OBJECT_NAME_INVALID returned for non-ASCII dfs refs")
> Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
> ---
> fs/cifs/connect.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 42e14f408856..1ef3d16a8bda 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -3432,6 +3432,7 @@ static int is_path_remote(struct mount_ctx *mnt_ctx)
> struct cifs_tcon *tcon = mnt_ctx->tcon;
> struct smb3_fs_context *ctx = mnt_ctx->fs_ctx;
> char *full_path;
> + bool nodfs = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS;
>
> if (!server->ops->is_path_accessible)
> return -EOPNOTSUPP;
> @@ -3449,14 +3450,20 @@ static int is_path_remote(struct mount_ctx *mnt_ctx)
> rc = server->ops->is_path_accessible(xid, tcon, cifs_sb,
> full_path);
> #ifdef CONFIG_CIFS_DFS_UPCALL
> - if (rc == -ENOENT && is_tcon_dfs(tcon))
> + if (nodfs) {
> + if (rc == -EREMOTE)
> + rc = -EOPNOTSUPP;
> + goto out;
> + }
> +
> + /* path *might* exist with non-ASCII characters in DFS root
> + * try again with full path (only if nodfs is not set) */
> + if (rc == -ENOENT && is_tcon_dfs(tcon) && !nodfs)
You can get rid of !nodfs check since it is useless. The comment might
be kept, though.
Other than that,
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Steve, please mark it for stable.
^ permalink raw reply [flat|nested] 7+ messages in thread