ksmbd: add user namespace support
authorHyunchul Lee <hyc.lee@gmail.com>
Wed, 30 Jun 2021 09:25:53 +0000 (18:25 +0900)
committerNamjae Jeon <namjae.jeon@samsung.com>
Fri, 2 Jul 2021 07:27:10 +0000 (16:27 +0900)
commitaf34983e831587472333e47c86a350a2360c6093
tree0db387e95eb0372e4e6ebb6304671603d0c9690a
parentef24c962d0f29036041a007a75bcd0f50233c83e
ksmbd: add user namespace support

For user namespace support, call vfs functions
with struct user_namespace got from struct path.

This patch have been tested mannually as below.

Create an id-mapped mount using the mount-idmapped utility
(https://github.com/brauner/mount-idmapped).
$ mount-idmapped --map-mount b:1003:1002:1 /home/foo <EXPORT DIR>/foo
(the user, "foo" is 1003, and the user "bar" is 1002).

And  mount the export directory using cifs with the user, "bar".
succeed to create/delete/stat/read/write files and directory in
the <EXPORT DIR>/foo. But fail with a bind mount for /home/foo.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/ksmbd/ndr.c
fs/ksmbd/ndr.h
fs/ksmbd/oplock.c
fs/ksmbd/smb2pdu.c
fs/ksmbd/smb_common.c
fs/ksmbd/smb_common.h
fs/ksmbd/smbacl.c
fs/ksmbd/smbacl.h
fs/ksmbd/vfs.c
fs/ksmbd/vfs.h
fs/ksmbd/vfs_cache.c