diff mbox series

[SMB3] fix stat when special device file and mounted with modefromsid

Message ID CAH2r5mu2s3Fu+_mWTiXFp+JYTAWZZrPCDyDNtWAhit2DjB890g@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series [SMB3] fix stat when special device file and mounted with modefromsid | expand

Commit Message

Steve French Oct. 21, 2020, 4:03 a.m. UTC
When mounting with modefromsid mount option, it was possible to
get the error on stat of a fifo or char or block device:
        "cannot stat <filename>: Operation not supported"

Special devices can be stored as reparse points by some servers
(e.g. Windows NFS server and when using the SMB3.1.1 POSIX
Extensions) but when the modefromsid mount option is used
the client attempts to get the ACL for the file which requires
opening with OPEN_REPARSE_POINT create option.



--
Thanks,

Steve

Comments

ronnie sahlberg Oct. 21, 2020, 4:19 a.m. UTC | #1
Receiver-by me.

Should we set up a test for this in the buildbot?

On Wed, Oct 21, 2020 at 2:05 PM Steve French via samba-technical
<samba-technical@lists.samba.org> wrote:
>
> When mounting with modefromsid mount option, it was possible to
> get the error on stat of a fifo or char or block device:
>         "cannot stat <filename>: Operation not supported"
>
> Special devices can be stored as reparse points by some servers
> (e.g. Windows NFS server and when using the SMB3.1.1 POSIX
> Extensions) but when the modefromsid mount option is used
> the client attempts to get the ACL for the file which requires
> opening with OPEN_REPARSE_POINT create option.
>
>
>
> --
> Thanks,
>
> Steve
Steve French Oct. 21, 2020, 5:21 a.m. UTC | #2
We probably should if we could create special files to Windows using
reparse points (or just set them up manually).  I created these by
doing mknod and mkfifo over NFS to Windows and then doing directory
listings and stat over SM3 mounts

On Tue, Oct 20, 2020 at 11:19 PM ronnie sahlberg
<ronniesahlberg@gmail.com> wrote:
>
> Receiver-by me.
>
> Should we set up a test for this in the buildbot?
>
> On Wed, Oct 21, 2020 at 2:05 PM Steve French via samba-technical
> <samba-technical@lists.samba.org> wrote:
> >
> > When mounting with modefromsid mount option, it was possible to
> > get the error on stat of a fifo or char or block device:
> >         "cannot stat <filename>: Operation not supported"
> >
> > Special devices can be stored as reparse points by some servers
> > (e.g. Windows NFS server and when using the SMB3.1.1 POSIX
> > Extensions) but when the modefromsid mount option is used
> > the client attempts to get the ACL for the file which requires
> > opening with OPEN_REPARSE_POINT create option.
> >
> >
> >
> > --
> > Thanks,
> >
> > Steve
diff mbox series

Patch

From de3fe18663801dded6987441664cd54b3276703a Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Tue, 20 Oct 2020 22:53:57 -0500
Subject: [PATCH] smb3: fix stat when special device file and mounted with
 modefromsid

When mounting with modefromsid mount option, it was possible to
get the error on stat of a fifo or char or block device:
        "cannot stat <filename>: Operation not supported"

Special devices can be stored as reparse points by some servers
(e.g. Windows NFS server and when using the SMB3.1.1 POSIX
Extensions) but when the modefromsid mount option is used
the client attempts to get the ACL for the file which requires
opening with OPEN_REPARSE_POINT create option.

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2ops.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 2c3cfb2e8e72..7e3edcda054e 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -3099,6 +3099,12 @@  get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
 
 	rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, NULL,
 		       NULL);
+	if (rc == -EOPNOTSUPP) {
+		oparms.create_options |= OPEN_REPARSE_POINT;
+		rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL,
+				NULL, NULL);
+		cifs_dbg(VFS, "open retry rc %d\n", rc); /* BB removeme */
+	}
 	kfree(utf16_path);
 	if (!rc) {
 		rc = SMB2_query_acl(xid, tlink_tcon(tlink), fid.persistent_fid,
-- 
2.25.1