Merge branch 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[deliverable/linux.git] / fs / cifs / smb2file.c
index 0ddd617ffa1a7c8e76ddb4a6aa36c291840f8cfd..a93eec30a50d2dab9626025fda82b4f9b62c9c88 100644 (file)
@@ -38,6 +38,8 @@ void
 smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock)
 {
        oplock &= 0xFF;
+       if (oplock == SMB2_OPLOCK_LEVEL_NOCHANGE)
+               return;
        if (oplock == SMB2_OPLOCK_LEVEL_EXCLUSIVE) {
                cinode->clientCanCacheAll = true;
                cinode->clientCanCacheRead = true;
@@ -63,6 +65,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 +81,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 +105,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);
This page took 0.027698 seconds and 5 git commands to generate.