summaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2pdu.c
diff options
context:
space:
mode:
authorSteve French2018-08-31 22:12:10 +0200
committerSteve French2018-09-03 06:21:42 +0200
commitf801568332321e2b1e7a8bd26c3e4913a312a2ec (patch)
treecc9936a0b914ed0dd70fd4c7d8f0224091b9bbe6 /fs/cifs/smb2pdu.c
parentsmb3: minor debugging clarifications in rfc1001 len processing (diff)
downloadkernel-qcow2-linux-f801568332321e2b1e7a8bd26c3e4913a312a2ec.tar.gz
kernel-qcow2-linux-f801568332321e2b1e7a8bd26c3e4913a312a2ec.tar.xz
kernel-qcow2-linux-f801568332321e2b1e7a8bd26c3e4913a312a2ec.zip
smb3: check for and properly advertise directory lease support
Although servers will typically ignore unsupported features, we should advertise the support for directory leases (as Windows e.g. does) in the negotiate protocol capabilities we pass to the server, and should check for the server capability (CAP_DIRECTORY_LEASING) before sending a lease request for an open of a directory. This will prevent us from accidentally sending directory leases to SMB2.1 or SMB2 server for example. Signed-off-by: Steve French <stfrench@microsoft.com> CC: Stable <stable@vger.kernel.org> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Diffstat (limited to 'fs/cifs/smb2pdu.c')
-rw-r--r--fs/cifs/smb2pdu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 5740aa809be6..c08acfc77abc 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2178,6 +2178,9 @@ SMB2_open_init(struct cifs_tcon *tcon, struct smb_rqst *rqst, __u8 *oplock,
if (!(server->capabilities & SMB2_GLOBAL_CAP_LEASING) ||
*oplock == SMB2_OPLOCK_LEVEL_NONE)
req->RequestedOplockLevel = *oplock;
+ else if (!(server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) &&
+ (oparms->create_options & CREATE_NOT_FILE))
+ req->RequestedOplockLevel = *oplock; /* no srv lease support */
else {
rc = add_lease_context(server, iov, &n_iov,
oparms->fid->lease_key, oplock);