diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-09-18 19:20:33 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-09-24 22:46:30 -0400 |
commit | 2e44b2887882134abf353b28867b82645e9f0856 (patch) | |
tree | 963236eb542e26b046960f72f9ec47ae8e339a76 /fs/cifs/smb2file.c | |
parent | d324f08d6a87149597817f4496ef0f7ac185e8da (diff) |
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.c | 24 |
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 @@ | |||
34 | #include "fscache.h" | 34 | #include "fscache.h" |
35 | #include "smb2proto.h" | 35 | #include "smb2proto.h" |
36 | 36 | ||
37 | void | ||
38 | smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock) | ||
39 | { | ||
40 | oplock &= 0xFF; | ||
41 | if (oplock == SMB2_OPLOCK_LEVEL_EXCLUSIVE) { | ||
42 | cinode->clientCanCacheAll = true; | ||
43 | cinode->clientCanCacheRead = true; | ||
44 | cFYI(1, "Exclusive Oplock granted on inode %p", | ||
45 | &cinode->vfs_inode); | ||
46 | } else if (oplock == SMB2_OPLOCK_LEVEL_II) { | ||
47 | cinode->clientCanCacheAll = false; | ||
48 | cinode->clientCanCacheRead = true; | ||
49 | cFYI(1, "Level II Oplock granted on inode %p", | ||
50 | &cinode->vfs_inode); | ||
51 | } else { | ||
52 | cinode->clientCanCacheAll = false; | ||
53 | cinode->clientCanCacheRead = false; | ||
54 | } | ||
55 | } | ||
56 | |||
37 | int | 57 | int |
38 | smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path, | 58 | smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path, |
39 | int disposition, int desired_access, int create_options, | 59 | 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, | |||
58 | } | 78 | } |
59 | 79 | ||
60 | desired_access |= FILE_READ_ATTRIBUTES; | 80 | desired_access |= FILE_READ_ATTRIBUTES; |
81 | *oplock = SMB2_OPLOCK_LEVEL_EXCLUSIVE; | ||
61 | 82 | ||
62 | rc = SMB2_open(xid, tcon, smb2_path, &fid->persistent_fid, | 83 | rc = SMB2_open(xid, tcon, smb2_path, &fid->persistent_fid, |
63 | &fid->volatile_fid, desired_access, disposition, | 84 | &fid->volatile_fid, desired_access, disposition, |
64 | 0, 0, smb2_data); | 85 | 0, 0, (__u8 *)oplock, smb2_data); |
65 | if (rc) | 86 | if (rc) |
66 | goto out; | 87 | goto out; |
67 | 88 | ||
@@ -79,7 +100,6 @@ smb2_open_file(const unsigned int xid, struct cifs_tcon *tcon, const char *path, | |||
79 | } | 100 | } |
80 | 101 | ||
81 | out: | 102 | out: |
82 | *oplock = 0; | ||
83 | kfree(smb2_data); | 103 | kfree(smb2_data); |
84 | kfree(smb2_path); | 104 | kfree(smb2_path); |
85 | return rc; | 105 | return rc; |