cifs: add SMB3 change notification support
authorSteve French <stfrench@microsoft.com>
Thu, 6 Feb 2020 12:00:14 +0000 (06:00 -0600)
committerSteve French <stfrench@microsoft.com>
Thu, 6 Feb 2020 15:14:28 +0000 (09:14 -0600)
commitd26c2ddd33569667e3eeb577c4c1d966ca9192e2
tree2b6285e86f3d90cf6f49fba3c160f76faf5d70d7
parent343a1b777a92af3022c95ab6c188bef4a6e9ff97
cifs: add SMB3 change notification support

A commonly used SMB3 feature is change notification, allowing an
app to be notified about changes to a directory. The SMB3
Notify request blocks until the server detects a change to that
directory or its contents that matches the completion flags
that were passed in and the "watch_tree" flag (which indicates
whether subdirectories under this directory should be also
included).  See MS-SMB2 2.2.35 for additional detail.

To use this simply pass in the following structure to ioctl:

 struct __attribute__((__packed__)) smb3_notify {
        uint32_t completion_filter;
        bool    watch_tree;
 } __packed;

 using CIFS_IOC_NOTIFY  0x4005cf09
 or equivalently _IOW(CIFS_IOCTL_MAGIC, 9, struct smb3_notify)

SMB3 change notification is supported by all major servers.
The ioctl will block until the server detects a change to that
directory or its subdirectories (if watch_tree is set).

Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Acked-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
fs/cifs/cifs_ioctl.h
fs/cifs/cifsglob.h
fs/cifs/ioctl.c
fs/cifs/smb2ops.c
fs/cifs/smb2pdu.c