summaryrefslogtreecommitdiffstats
path: root/fs/cifs
AgeCommit message (Collapse)Author
2020-12-18Add SMB 2 support for getting and setting SACLsBoris Protopopov
Fix passing of the additional security info via version operations. Force new open when getting SACL and avoid reuse of files that were previously open without sufficient privileges to access SACLs. Signed-off-by: Boris Protopopov <pboris@amazon.com> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-18SMB3: Add support for getting and setting SACLsBoris Protopopov
Add SYSTEM_SECURITY access flag and use with smb2 when opening files for getting/setting SACLs. Add "system.cifs_ntsd_full" extended attribute to allow user-space access to the functionality. Avoid multiple server calls when setting owner, DACL, and SACL. Signed-off-by: Boris Protopopov <pboris@amazon.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-18cifs: Avoid error pointer dereferenceSamuel Cabrero
The patch 7d6535b72042: "cifs: Simplify reconnect code when dfs upcall is enabled" leads to the following static checker warning: fs/cifs/connect.c:160 reconn_set_next_dfs_target() error: 'server->hostname' dereferencing possible ERR_PTR() Avoid dereferencing the error pointer by early returning on error condition. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Samuel Cabrero <scabrero@suse.de> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-18cifs: Re-indent cifs_swn_reconnect()Dan Carpenter
This code is slightly nicer if we flip the cifs_sockaddr_equal() around and pull all the code in one tab. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Samuel Cabrero <scabrero@suse.de> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-18cifs: Unlock on errors in cifs_swn_reconnect()Dan Carpenter
There are three error paths which need to unlock before returning. Fixes: 121d947d4fe1 ("cifs: Handle witness client move notification") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Samuel Cabrero <scabrero@suse.de> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-18cifs: Delete a stray unlock in cifs_swn_reconnect()Dan Carpenter
The unlock is done in the caller, this is a stray which leads to a double unlock bug. Fixes: bf80e5d4259a ("cifs: Send witness register and unregister commands to userspace daemon") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Samuel Cabrero <scabrero@suse.de> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-17Merge tag '5.11-rc-smb3' of git://git.samba.org/sfrench/cifs-2.6Linus Torvalds
Pull cifs updates from Steve French: "The largest part are for support of the newer mount API which has been needed for cifs/smb3 mounts for a long time due to the new API's better handling of remount, and better error reporting. There are three additional small cleanup patches for this being tested, that are not included yet. This series also includes addition of support for the SMB3 witness protocol which can provide important notifications from the server to client on server address or export or network changes. This can be useful for example in order to be notified before the failure - when a server's IP address changes (in the future it will allow us to support server notifications of when a share is moved). It also includes three patches for stable e.g. some that better handle some confusing error messages during session establishment" * tag '5.11-rc-smb3' of git://git.samba.org/sfrench/cifs-2.6: (55 commits) cifs: update internal module version number cifs: Fix support for remount when not changing rsize/wsize cifs: handle "guest" mount parameter cifs: correct four aliased mount parms to allow use of previous names cifs: Tracepoints and logs for tracing credit changes. cifs: fix use after free in cifs_smb3_do_mount() cifs: fix rsize/wsize to be negotiated values cifs: Fix some error pointers handling detected by static checker smb3: remind users that witness protocol is experimental cifs: update super_operations to show_devname cifs: fix uninitialized variable in smb3_fs_context_parse_param cifs: update mnt_cifs_flags during reconfigure cifs: move update of flags into a separate function cifs: remove ctx argument from cifs_setup_cifs_sb cifs: do not allow changing posix_paths during remount cifs: uncomplicate printing the iocharset parameter cifs: don't create a temp nls in cifs_setup_ipc cifs: simplify handling of cifs_sb/ctx->local_nls cifs: we do not allow changing username/password/unc/... during remount cifs: add initial reconfigure support ...
2020-12-16cifs: update internal module version numberSteve French
To 2.30 Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-16cifs: Fix support for remount when not changing rsize/wsizeSteve French
When remounting with the new mount API, we need to set rsize and wsize to the previous values if they are not passed in on the remount. Otherwise they get set to zero which breaks xfstest 452 for example. Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
2020-12-16cifs: handle "guest" mount parameterSteve French
With the new mount API it can not handle empty strings for mount parms ("guest" is mapped in userspace mount helper to "user=") so we have to special case it as we do for the password mount parm. Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
2020-12-16cifs: correct four aliased mount parms to allow use of previous namesSteve French
The updates to the new mount API created aliases for some mount parms e.g. esize, idsfromsid, modefromsid, signloosely as "min_enc_offload", "setuidfromacl", "modesid", "ignore_signature" but did not add back in the original name expected by test cases and current users. It also had incorrect names for a few less used mount parms. Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
2020-12-15cifs: Tracepoints and logs for tracing credit changes.Shyam Prasad N
There is at least one suspected bug in crediting changes in cifs.ko which has come up a few times in the discussions and in a customer case. This change adds tracepoints to the code which modifies the server credit values in any way. The goal is to be able to track the changes to the credit values of the session to be able to catch when there is a crediting bug. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-15cifs: fix use after free in cifs_smb3_do_mount()Ronnie Sahlberg
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-15cifs: fix rsize/wsize to be negotiated valuesSteve French
Also make sure these are displayed in /proc/mounts Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
2020-12-15cifs: Fix some error pointers handling detected by static checkerSamuel Cabrero
* extract_hostname() and extract_sharename() never return NULL, so use IS_ERR() instead of IS_ERR_OR_NULL() in cifs_find_swn_reg(). If any of these functions return an error, then return an error pointer instead of NULL. * Change cifs_find_swn_reg() function to always return a valid pointer or an error pointer, instead of returning NULL if the registration is not found. * Finally update cifs_find_swn_reg() callers to check for -EEXIST instead of NULL. * In cifs_get_swn_reg() the swnreg idr mutex was not unlocked in the error path of cifs_find_swn_reg() call. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-15smb3: remind users that witness protocol is experimentalSteve French
warn_once when using the witness protocol that it is experimental Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
2020-12-15cifs: update super_operations to show_devnameSteve French
This is needed so that we display the correct //server/share vs \\server\share in /proc/mounts for the device name (in the new mount API). Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
2020-12-14cifs: fix uninitialized variable in smb3_fs_context_parse_paramRonnie Sahlberg
Addresses an issue noted by the kernel test robot Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
2020-12-14cifs: update mnt_cifs_flags during reconfigureRonnie Sahlberg
Many mount flags (e.g. for noperm, noxattr, nobrl, cifsacl, mfsymlinks and more) can be updated now. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: move update of flags into a separate functionRonnie Sahlberg
This function will set/clear flags that can be changed during mount or remount Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: remove ctx argument from cifs_setup_cifs_sbRonnie Sahlberg
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: do not allow changing posix_paths during remountRonnie Sahlberg
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: uncomplicate printing the iocharset parameterRonnie Sahlberg
There is no need to load the default nls to check if the iocharset argument was specified or not since we have it in cifs_sb->ctx Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: don't create a temp nls in cifs_setup_ipcRonnie Sahlberg
just use the one that is already available in ctx Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: simplify handling of cifs_sb/ctx->local_nlsRonnie Sahlberg
Only load/unload local_nls from cifs_sb and just make the ctx contain a pointer to cifs_sb->ctx. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: we do not allow changing username/password/unc/... during remountRonnie Sahlberg
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: add initial reconfigure supportRonnie Sahlberg
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: move [brw]size from cifs_sb to cifs_sb->ctxRonnie Sahlberg
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: move cifs_cleanup_volume_info[_content] to fs_context.cRonnie Sahlberg
and rename it to smb3_cleanup_fs_context[_content] Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: Add missing sentinel to smb3_fs_parametersDmitry Osipenko
Add missing sentinel to smb3_fs_parameters. This fixes ARM32 kernel crashing once CIFS is registered. Unable to handle kernel paging request at virtual address 33626d73 ... (strcmp) from (fs_validate_description) (fs_validate_description) from (register_filesystem) (register_filesystem) from (init_cifs [cifs]) (init_cifs [cifs]) from (do_one_initcall) (do_one_initcall) from (do_init_module) (do_init_module) from (load_module) (load_module) from (sys_finit_module) (sys_finit_module) from (ret_fast_syscal) Fixes: e07724d1cf38 ("cifs: switch to new mount api") Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: Handle witness client move notificationSamuel Cabrero
This message is sent to tell a client to close its current connection and connect to the specified address. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: remove actimeo from cifs_sbRonnie Sahlberg
Can now be accessed via the ctx Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: remove [gu]id/backup[gu]id/file_mode/dir_mode from cifs_sbRonnie Sahlberg
We can already access these from cifs_sb->ctx so we no longer need a local copy in cifs_sb. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: remove some minor warnings pointed out by kernel test robotSteve French
Correct some trivial warnings caused when new file unc.c was created. For example: In file included from fs/cifs/unc.c:11: >> fs/cifs/cifsproto.h:44:28: warning: 'struct TCP_Server_Info' declared inside parameter list will not be visible outside of this definition or declaration 44 | extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *, Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: remove various function description warningsSteve French
When compiling with W=1 I noticed various functions that did not follow proper style in describing (in the comments) the parameters passed in to the function. For example: fs/cifs/inode.c:2236: warning: Function parameter or member 'mode' not described in 'cifs_wait_bit_killable' I did not address the style warnings in two of the six files (connect.c and misc.c) in order to reduce risk of merge conflict with pending patches. We can update those later. Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: Simplify reconnect code when dfs upcall is enabledSamuel Cabrero
Some witness notifications, like client move, tell the client to reconnect to a specific IP address. In this situation the DFS failover code path has to be skipped so clean up as much as possible the cifs_reconnect() code. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: Send witness register messages to userspace daemon in echo taskSamuel Cabrero
If the daemon starts after mounting a share, or if it crashes, this provides a mechanism to register again. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: Add witness information to debug data dumpSamuel Cabrero
+ Indicate if witness feature is supported + Indicate if witness is used when dumping tcons + Dumps witness registrations. Example: Witness registrations: Id: 1 Refs: 1 Network name: 'fs.fover.ad'(y) Share name: 'share1'(y) \ Ip address: 192.168.103.200(n) Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: Set witness notification handler for messages from userspace daemonSamuel Cabrero
+ Set a handler for the witness notification messages received from the userspace daemon. + Handle the resource state change notification. When the resource becomes unavailable or available set the tcp status to CifsNeedReconnect for all channels. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: Send witness register and unregister commands to userspace daemonSamuel Cabrero
+ Define the generic netlink family commands and message attributes to communicate with the userspace daemon + The register and unregister commands are sent when connecting or disconnecting a tree. The witness registration keeps a pointer to the tcon and has the same lifetime. + Each registration has an id allocated by an IDR. This id is sent to the userspace daemon in the register command, and will be included in the notification messages from the userspace daemon to retrieve from the IDR the matching registration. + The authentication information is bundled in the register message. If kerberos is used the message just carries a flag. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: minor updates to KconfigSteve French
Correct references to fs/cifs/README which has been replaced by Documentation/filesystems/admin-guide/cifs/usage.rst, and also correct a typo. Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: add witness mount option and data structsSamuel Cabrero
Add 'witness' mount option to register for witness notifications. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: Register generic netlink familySamuel Cabrero
Register a new generic netlink family to talk to the witness service userspace daemon. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: cleanup misc.cSteve French
misc.c was getting a little large, move two of the UNC parsing relating functions to a new C file unc.c which makes the coding of the upcoming witness protocol patch series a little cleaner as well. Suggested-by: Rafal Szczesniak <rafal@elbingbrewery.org> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: minor kernel style fixes for commentsSteve French
Trivial fix for a few comments which didn't follow kernel style Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: Make extract_sharename function publicSamuel Cabrero
Move the function to misc.c Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-14cifs: Make extract_hostname function publicSamuel Cabrero
Move the function to misc.c and give it a public header. Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-13cifs: get rid of cifs_sb->mountdataRonnie Sahlberg
as we now have a full smb3_fs_context as part of the cifs superblock we no longer need a local copy of the mount options and can just reference the copy in the smb3_fs_context. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-13cifs: add an smb3_fs_context to cifs_sbRonnie Sahlberg
and populate it during mount in cifs_smb3_do_mount() Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
2020-12-13cifs: remove the devname argument to cifs_compose_mount_optionsRonnie Sahlberg
none of the callers use this argument any more. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>