summaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2file.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2012-09-19 06:22:44 -0700
committerSteve French <smfrench@gmail.com>2012-09-24 21:46:33 -0500
commitb8c32dbb0deb287a5fcb78251e4eae6c7275760d (patch)
treefa3cddfd4595846921f51a922b7e1722b1e35fa4 /fs/cifs/smb2file.c
parent579f9053236c796d718162c37c72bb3bd32d008c (diff)
CIFS: Request SMB2.1 leases
if server supports them and we need oplocks. Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/smb2file.c')
-rw-r--r--fs/cifs/smb2file.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
index 0ddd617ffa1..78fb2050e0d 100644
--- a/fs/cifs/smb2file.c
+++ b/fs/cifs/smb2file.c
@@ -63,6 +63,7 @@ smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path,
int rc;
__le16 *smb2_path;
struct smb2_file_all_info *smb2_data = NULL;
+ __u8 smb2_oplock[17];
smb2_path = cifs_convert_path_to_utf16(path, cifs_sb);
if (smb2_path == NULL) {
@@ -78,11 +79,14 @@ smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path,
}
desired_access |= FILE_READ_ATTRIBUTES;
- *oplock = SMB2_OPLOCK_LEVEL_EXCLUSIVE;
+ *smb2_oplock = SMB2_OPLOCK_LEVEL_EXCLUSIVE;
+
+ if (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LEASING)
+ memcpy(smb2_oplock + 1, fid->lease_key, SMB2_LEASE_KEY_SIZE);
rc = SMB2_open(xid, tcon, smb2_path, &fid->persistent_fid,
&fid->volatile_fid, desired_access, disposition,
- 0, 0, (__u8 *)oplock, smb2_data);
+ 0, 0, smb2_oplock, smb2_data);
if (rc)
goto out;
@@ -99,6 +103,7 @@ smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path,
move_smb2_info_to_cifs(buf, smb2_data);
}
+ *oplock = *smb2_oplock;
out:
kfree(smb2_data);
kfree(smb2_path);