OSDN Git Service

smb3: enable swap on SMB3 mounts
authorSteve French <stfrench@microsoft.com>
Fri, 10 Apr 2020 02:42:18 +0000 (21:42 -0500)
committerSteve French <stfrench@microsoft.com>
Fri, 10 Apr 2020 18:32:32 +0000 (13:32 -0500)
commit4e8aea30f7751ce7c4b158aa0c04e7744d281cc3
tree97609c93ac38f8b665e4996a457d82108cb5a4b1
parent1dc94b7381bd5f71aa417487abaf3bd3d70938c4
smb3: enable swap on SMB3 mounts

Add experimental support for allowing a swap file to be on an SMB3
mount.  There are use cases where swapping over a secure network
filesystem is preferable. In some cases there are no local
block devices large enough, and network block devices can be
hard to setup and secure.  And in some cases there are no
local block devices at all (e.g. with the recent addition of
remote boot over SMB3 mounts).

There are various enhancements that can be added later e.g.:
- doing a mandatory byte range lock over the swapfile (until
the Linux VFS is modified to notify the file system that an open
is for a swapfile, when the file can be opened "DENY_ALL" to prevent
others from opening it).
- pinning more buffers in the underlying transport to minimize memory
allocations in the TCP stack under the fs
- documenting how to create ACLs (on the server) to secure the
swapfile (or adding additional tools to cifs-utils to make it easier)

Signed-off-by: Steve French <stfrench@microsoft.com>
Acked-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
fs/cifs/cifsfs.c
fs/cifs/cifsglob.h
fs/cifs/file.c
fs/cifs/inode.c