diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-09-19 09:22:44 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-09-24 22:46:33 -0400 |
commit | b8c32dbb0deb287a5fcb78251e4eae6c7275760d (patch) | |
tree | fa3cddfd4595846921f51a922b7e1722b1e35fa4 /fs/cifs/cifsfs.c | |
parent | 579f9053236c796d718162c37c72bb3bd32d008c (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/cifsfs.c')
-rw-r--r-- | fs/cifs/cifsfs.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 4cd68c77ce3..28ac048d54e 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/kthread.h> | 36 | #include <linux/kthread.h> |
37 | #include <linux/freezer.h> | 37 | #include <linux/freezer.h> |
38 | #include <linux/namei.h> | 38 | #include <linux/namei.h> |
39 | #include <linux/random.h> | ||
39 | #include <net/ipv6.h> | 40 | #include <net/ipv6.h> |
40 | #include "cifsfs.h" | 41 | #include "cifsfs.h" |
41 | #include "cifspdu.h" | 42 | #include "cifspdu.h" |
@@ -88,6 +89,10 @@ extern mempool_t *cifs_mid_poolp; | |||
88 | 89 | ||
89 | struct workqueue_struct *cifsiod_wq; | 90 | struct workqueue_struct *cifsiod_wq; |
90 | 91 | ||
92 | #ifdef CONFIG_CIFS_SMB2 | ||
93 | __u8 cifs_client_guid[SMB2_CLIENT_GUID_SIZE]; | ||
94 | #endif | ||
95 | |||
91 | static int | 96 | static int |
92 | cifs_read_super(struct super_block *sb) | 97 | cifs_read_super(struct super_block *sb) |
93 | { | 98 | { |
@@ -218,9 +223,10 @@ cifs_alloc_inode(struct super_block *sb) | |||
218 | return NULL; | 223 | return NULL; |
219 | cifs_inode->cifsAttrs = 0x20; /* default */ | 224 | cifs_inode->cifsAttrs = 0x20; /* default */ |
220 | cifs_inode->time = 0; | 225 | cifs_inode->time = 0; |
221 | /* Until the file is open and we have gotten oplock | 226 | /* |
222 | info back from the server, can not assume caching of | 227 | * Until the file is open and we have gotten oplock info back from the |
223 | file data or metadata */ | 228 | * server, can not assume caching of file data or metadata. |
229 | */ | ||
224 | cifs_set_oplock_level(cifs_inode, 0); | 230 | cifs_set_oplock_level(cifs_inode, 0); |
225 | cifs_inode->delete_pending = false; | 231 | cifs_inode->delete_pending = false; |
226 | cifs_inode->invalid_mapping = false; | 232 | cifs_inode->invalid_mapping = false; |
@@ -228,10 +234,14 @@ cifs_alloc_inode(struct super_block *sb) | |||
228 | cifs_inode->server_eof = 0; | 234 | cifs_inode->server_eof = 0; |
229 | cifs_inode->uniqueid = 0; | 235 | cifs_inode->uniqueid = 0; |
230 | cifs_inode->createtime = 0; | 236 | cifs_inode->createtime = 0; |
231 | 237 | #ifdef CONFIG_CIFS_SMB2 | |
232 | /* Can not set i_flags here - they get immediately overwritten | 238 | get_random_bytes(cifs_inode->lease_key, SMB2_LEASE_KEY_SIZE); |
233 | to zero by the VFS */ | 239 | #endif |
234 | /* cifs_inode->vfs_inode.i_flags = S_NOATIME | S_NOCMTIME;*/ | 240 | /* |
241 | * Can not set i_flags here - they get immediately overwritten to zero | ||
242 | * by the VFS. | ||
243 | */ | ||
244 | /* cifs_inode->vfs_inode.i_flags = S_NOATIME | S_NOCMTIME; */ | ||
235 | INIT_LIST_HEAD(&cifs_inode->openFileList); | 245 | INIT_LIST_HEAD(&cifs_inode->openFileList); |
236 | INIT_LIST_HEAD(&cifs_inode->llist); | 246 | INIT_LIST_HEAD(&cifs_inode->llist); |
237 | return &cifs_inode->vfs_inode; | 247 | return &cifs_inode->vfs_inode; |
@@ -1107,6 +1117,10 @@ init_cifs(void) | |||
1107 | spin_lock_init(&cifs_file_list_lock); | 1117 | spin_lock_init(&cifs_file_list_lock); |
1108 | spin_lock_init(&GlobalMid_Lock); | 1118 | spin_lock_init(&GlobalMid_Lock); |
1109 | 1119 | ||
1120 | #ifdef CONFIG_CIFS_SMB2 | ||
1121 | get_random_bytes(cifs_client_guid, SMB2_CLIENT_GUID_SIZE); | ||
1122 | #endif | ||
1123 | |||
1110 | if (cifs_max_pending < 2) { | 1124 | if (cifs_max_pending < 2) { |
1111 | cifs_max_pending = 2; | 1125 | cifs_max_pending = 2; |
1112 | cFYI(1, "cifs_max_pending set to min of 2"); | 1126 | cFYI(1, "cifs_max_pending set to min of 2"); |