summaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2file.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2012-09-18 16:20:33 -0700
committerSteve French <smfrench@gmail.com>2012-09-24 21:46:30 -0500
commit2e44b2887882134abf353b28867b82645e9f0856 (patch)
tree963236eb542e26b046960f72f9ec47ae8e339a76 /fs/cifs/smb2file.c
parentd324f08d6a87149597817f4496ef0f7ac185e8da (diff)
downloadlinux-2e44b2887882134abf353b28867b82645e9f0856.tar.gz
linux-2e44b2887882134abf353b28867b82645e9f0856.tar.bz2
linux-2e44b2887882134abf353b28867b82645e9f0856.zip
CIFS: Process oplocks for SMB2
Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb2file.c')
-rw-r--r--fs/cifs/smb2file.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
index a7618dfb7712..5ff25e025215 100644
--- a/fs/cifs/smb2file.c
+++ b/fs/cifs/smb2file.c
@@ -34,6 +34,26 @@
#include "fscache.h"
#include "smb2proto.h"
+void
+smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock)
+{
+ oplock &= 0xFF;
+ if (oplock == SMB2_OPLOCK_LEVEL_EXCLUSIVE) {
+ cinode->clientCanCacheAll = true;
+ cinode->clientCanCacheRead = true;
+ cFYI(1, "Exclusive Oplock granted on inode %p",
+ &cinode->vfs_inode);
+ } else if (oplock == SMB2_OPLOCK_LEVEL_II) {
+ cinode->clientCanCacheAll = false;
+ cinode->clientCanCacheRead = true;
+ cFYI(1, "Level II Oplock granted on inode %p",
+ &cinode->vfs_inode);
+ } else {
+ cinode->clientCanCacheAll = false;
+ cinode->clientCanCacheRead = false;
+ }
+}
+
int
smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path,
int disposition, int desired_access, int create_options,
@@ -58,10 +78,11 @@ smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path,
}
desired_access |= FILE_READ_ATTRIBUTES;
+ *oplock = SMB2_OPLOCK_LEVEL_EXCLUSIVE;
rc = SMB2_open(xid, tcon, smb2_path, &fid->persistent_fid,
&fid->volatile_fid, desired_access, disposition,
- 0, 0, smb2_data);
+ 0, 0, (__u8 *)oplock, smb2_data);
if (rc)
goto out;
@@ -79,7 +100,6 @@ smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path,
}
out:
- *oplock = 0;
kfree(smb2_data);
kfree(smb2_path);
return rc;