* Bug with mount.cifs and mapchars
@ 2023-05-24 1:42 Tyler Spivey
2023-05-24 8:40 ` Steve French
0 siblings, 1 reply; 2+ messages in thread
From: Tyler Spivey @ 2023-05-24 1:42 UTC (permalink / raw)
To: linux-cifs
Hi.
Note: I'm not subscribed, please CC.
I'm trying to mount a Windows 10 share from Linux with mapchars,
but it still uses the SFM mapping.
Linux storage 5.15.0-72-generic #79-Ubuntu SMP Wed Apr 19 08:22:18 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
mount.cifs version: 6.14
Command line: mount //192.168.145.1/e e -o username=tyler,uid=tyler,mapchars
This also failed under Arch:
Linux arch1 6.3.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 21 May 2023 16:15:22 +0000 x86_64 GNU/Linux
mount.cifs version: 7.0
If I create a file called test? in a directory, the ?
shows up on the Windows machine as u+f025 (SFM mapping).
With mapchars, I would expect u+f03f (SFU mapping).
Looking at the kernel source for version 6.3.3,
it looks like sfu_remap needs to be set for this to work.
However, I can't find anything which sets it (mapchars doesn't seem to
be hooked up to it).
Thanks,
Tyler
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bug with mount.cifs and mapchars
2023-05-24 1:42 Bug with mount.cifs and mapchars Tyler Spivey
@ 2023-05-24 8:40 ` Steve French
0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2023-05-24 8:40 UTC (permalink / raw)
To: Tyler Spivey; +Cc: linux-cifs, ronnie sahlberg, David Howells
[-- Attachment #1: Type: text/plain, Size: 2005 bytes --]
Good catch. The conversion of cifs.ko to the new mount API in the
5.11 kernel and later broke this mount option. Patch is attached to
fix it.
Patch is attached but here is the description:
There are two ways that (reserved for other OS like Windows)
special characters
have been mapped in the past ("SFU" and "SFM" mappings). The default
for Linux has been to use "mapposix" (ie the SFM mapping) but
the conversion to the new mount API in the 5.11 kernel broke
the ability to override the default mapping of the reserved
characters (like '?' and '*' and '\') via "mapchars" mount option.
This patch fixes that - so can now mount with "mapchars"
mount option to override the default ("mapposix" ie SFM) mapping.
Reported-by: Tyler Spivey <tspivey8@gmail.com>
Fixes: 24e0a1eff9e2b ("cifs: switch to new mount api")
Signed-off-by: Steve French <stfrench@microsoft.com>
On Tue, May 23, 2023 at 8:48 PM Tyler Spivey <tspivey8@gmail.com> wrote:
>
> Hi.
>
> Note: I'm not subscribed, please CC.
>
> I'm trying to mount a Windows 10 share from Linux with mapchars,
> but it still uses the SFM mapping.
>
> Linux storage 5.15.0-72-generic #79-Ubuntu SMP Wed Apr 19 08:22:18 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
> mount.cifs version: 6.14
> Command line: mount //192.168.145.1/e e -o username=tyler,uid=tyler,mapchars
>
> This also failed under Arch:
>
> Linux arch1 6.3.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 21 May 2023 16:15:22 +0000 x86_64 GNU/Linux
> mount.cifs version: 7.0
>
> If I create a file called test? in a directory, the ?
> shows up on the Windows machine as u+f025 (SFM mapping).
> With mapchars, I would expect u+f03f (SFU mapping).
>
> Looking at the kernel source for version 6.3.3,
> it looks like sfu_remap needs to be set for this to work.
> However, I can't find anything which sets it (mapchars doesn't seem to
> be hooked up to it).
>
> Thanks,
> Tyler
--
Thanks,
Steve
[-- Attachment #2: 0001-cifs-mapchars-mount-option-ignored.patch --]
[-- Type: text/x-patch, Size: 1511 bytes --]
From 30f4283f452756905926052700efe4225256c71d Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Wed, 24 May 2023 03:26:19 -0500
Subject: [PATCH] cifs: mapchars mount option ignored
There are two ways that (Windows, reserved) special characters have
been mapped in the past ("SFU" and "SFM" mappings). The default
for Linux has been to use "mapposix" (ie the SFM mapping) but
the conversion to the new mount API in the 5.11 kernel broke
the ability to override the default mapping of the reserved
characters (like '?' and '*' and '\') via "mapchars" mount option.
This patch fixes that - so can now mount with "mapchars"
mount option to override the default ("mapposix" ie SFM) mapping.
Reported-by: Tyler Spivey <tspivey8@gmail.com>
Fixes: 24e0a1eff9e2b ("cifs: switch to new mount api")
Signed-off-by: Steve French <stfrench@microsoft.com>
---
fs/cifs/fs_context.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
index ace11a1a7c8a..1bda75609b64 100644
--- a/fs/cifs/fs_context.c
+++ b/fs/cifs/fs_context.c
@@ -904,6 +904,14 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
ctx->sfu_remap = false; /* disable SFU mapping */
}
break;
+ case Opt_mapchars:
+ if (result.negated)
+ ctx->sfu_remap = false;
+ else {
+ ctx->sfu_remap = true;
+ ctx->remap = false; /* disable SFM (mapposix) mapping */
+ }
+ break;
case Opt_user_xattr:
if (result.negated)
ctx->no_xattr = 1;
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-24 8:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-24 1:42 Bug with mount.cifs and mapchars Tyler Spivey
2023-05-24 8:40 ` Steve French
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.