mbox series

[0/7] cifs: Improve mount option -o reparse and support for native Windows sockets

Message ID 20241006100046.30772-1-pali@kernel.org (mailing list archive)
Headers show
Series cifs: Improve mount option -o reparse and support for native Windows sockets | expand

Message

Pali Rohár Oct. 6, 2024, 10 a.m. UTC
This patch series improves choosing reparse format when creating new
special files.

In following table is behavior of creating new special files before
this patch series. In columns are mount options, in rows are file types
and in each cell is reparse format which is created.

          -o reparse=default  -o reparse=nfs  -o reparse=wsl
symlink      native              native          native
socket       nfs                 nfs             wsl
fifo         nfs                 nfs             wsl
block        nfs                 nfs             wsl
char         nfs                 nfs             wsl


After this patch series the table looks like:

          -o reparse=default  -o reparse=nfs  -o reparse=wsl  -o reparse=native+nfs  -o reparse=native+wsl  -o reparse=native  -o reparse=none
symlink      native              nfs             wsl             native                 native                 native             -disallowed-
socket       native              nfs             wsl             native                 native                 native             -disallowed-
fifo         nfs                 nfs             wsl             nfs                    wsl                    -disallowed-       -disallowed-
block        nfs                 nfs             wsl             nfs                    wsl                    -disallowed-       -disallowed-
char         nfs                 nfs             wsl             nfs                    wsl                    -disallowed-       -disallowed-


The default behavior when no option is specified (which is same as
-o reparse=default) changes only for creating new sockets which are
now created in its native NTFS form with IO_REPARSE_TAG_AF_UNIX reparse
tag.

The nfs and wsl behavior is changed to always create new special files
in its own formats.

There are new options native+nfs and native+wsl which creates by default
in native form (symlinks + sockets) and fallbacks to nfs/wsl for other
types (fifo, char, block). This is probably the most useful for
interoperability. Mount option -o reparse=default is now same as
-o reparse=native+nfs

For completeness there are also new options -o reparse=native which
allows to creating only native types used by Windows applications
(symlinks and sockets) and option -o reparse=none to completely disable
creating new reparse points.


Pali Rohár (7):
  cifs: Add mount option -o reparse=native
  cifs: Add mount option -o reparse=none
  cifs: Add support for creating native Windows sockets
  cifs: Add support for creating NFS-style symlinks
  cifs: Improve guard for excluding $LXDEV xattr
  cifs: Add support for creating WSL-style symlinks
  cifs: Validate content of WSL reparse point buffers

 fs/smb/client/cifsglob.h   |  18 +++-
 fs/smb/client/fs_context.c |  16 +++
 fs/smb/client/fs_context.h |   4 +
 fs/smb/client/reparse.c    | 211 +++++++++++++++++++++++++++++++------
 fs/smb/client/reparse.h    |   2 +
 5 files changed, 218 insertions(+), 33 deletions(-)

Comments

Steve French Oct. 7, 2024, 4:23 a.m. UTC | #1
this table looks potentially very helpful - my main focus is making sure
1) that symlinks work in the "native" windows format
2) that we recognize special files created in the various forms
(reparse nfs or wsl, and also sfu)
3) that the reparse=nfs case works with or without the posix
extensions chosen on the mount
4) that we can create special files in reparse=nfs and wsl, and also
sfu - use cases

On Sun, Oct 6, 2024 at 5:01 AM Pali Rohár <pali@kernel.org> wrote:
>
> This patch series improves choosing reparse format when creating new
> special files.
>
> In following table is behavior of creating new special files before
> this patch series. In columns are mount options, in rows are file types
> and in each cell is reparse format which is created.
>
>           -o reparse=default  -o reparse=nfs  -o reparse=wsl
> symlink      native              native          native
> socket       nfs                 nfs             wsl
> fifo         nfs                 nfs             wsl
> block        nfs                 nfs             wsl
> char         nfs                 nfs             wsl
>
>
> After this patch series the table looks like:
>
>           -o reparse=default  -o reparse=nfs  -o reparse=wsl  -o reparse=native+nfs  -o reparse=native+wsl  -o reparse=native  -o reparse=none
> symlink      native              nfs             wsl             native                 native                 native             -disallowed-
> socket       native              nfs             wsl             native                 native                 native             -disallowed-
> fifo         nfs                 nfs             wsl             nfs                    wsl                    -disallowed-       -disallowed-
> block        nfs                 nfs             wsl             nfs                    wsl                    -disallowed-       -disallowed-
> char         nfs                 nfs             wsl             nfs                    wsl                    -disallowed-       -disallowed-
>
>
> The default behavior when no option is specified (which is same as
> -o reparse=default) changes only for creating new sockets which are
> now created in its native NTFS form with IO_REPARSE_TAG_AF_UNIX reparse
> tag.
>
> The nfs and wsl behavior is changed to always create new special files
> in its own formats.
>
> There are new options native+nfs and native+wsl which creates by default
> in native form (symlinks + sockets) and fallbacks to nfs/wsl for other
> types (fifo, char, block). This is probably the most useful for
> interoperability. Mount option -o reparse=default is now same as
> -o reparse=native+nfs
>
> For completeness there are also new options -o reparse=native which
> allows to creating only native types used by Windows applications
> (symlinks and sockets) and option -o reparse=none to completely disable
> creating new reparse points.
>
>
> Pali Rohár (7):
>   cifs: Add mount option -o reparse=native
>   cifs: Add mount option -o reparse=none
>   cifs: Add support for creating native Windows sockets
>   cifs: Add support for creating NFS-style symlinks
>   cifs: Improve guard for excluding $LXDEV xattr
>   cifs: Add support for creating WSL-style symlinks
>   cifs: Validate content of WSL reparse point buffers
>
>  fs/smb/client/cifsglob.h   |  18 +++-
>  fs/smb/client/fs_context.c |  16 +++
>  fs/smb/client/fs_context.h |   4 +
>  fs/smb/client/reparse.c    | 211 +++++++++++++++++++++++++++++++------
>  fs/smb/client/reparse.h    |   2 +
>  5 files changed, 218 insertions(+), 33 deletions(-)
>
> --
> 2.20.1
>
>