diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2013-09-05 08:11:28 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2013-09-09 23:52:05 -0400 |
commit | 53ef1016fd0e4bab128a24f7fe06b9cdb2afdc31 (patch) | |
tree | ed65cd590e0b813a3643f20e752483c48c95fa11 | |
parent | 18cceb6a78f46b65df654e8348fa2093b91b30f6 (diff) |
CIFS: Store lease state itself rather than a mapped oplock value
and separate smb20_operations struct.
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r-- | fs/cifs/cifsglob.h | 16 | ||||
-rw-r--r-- | fs/cifs/connect.c | 2 | ||||
-rw-r--r-- | fs/cifs/file.c | 3 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 8 | ||||
-rw-r--r-- | fs/cifs/smb2file.c | 23 | ||||
-rw-r--r-- | fs/cifs/smb2misc.c | 30 | ||||
-rw-r--r-- | fs/cifs/smb2ops.c | 146 | ||||
-rw-r--r-- | fs/cifs/smb2pdu.c | 2 | ||||
-rw-r--r-- | fs/cifs/smb2pdu.h | 4 | ||||
-rw-r--r-- | fs/cifs/smb2proto.h | 2 |
10 files changed, 174 insertions, 62 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index fe739bd8246d..e87f89f778f4 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -367,11 +367,13 @@ struct smb_version_operations { | |||
367 | /* generate new lease key */ | 367 | /* generate new lease key */ |
368 | void (*new_lease_key)(struct cifs_fid *fid); | 368 | void (*new_lease_key)(struct cifs_fid *fid); |
369 | int (*generate_signingkey)(struct cifs_ses *); | 369 | int (*generate_signingkey)(struct cifs_ses *); |
370 | int (*calc_signature)(struct smb_rqst *rqst, | 370 | int (*calc_signature)(struct smb_rqst *, struct TCP_Server_Info *); |
371 | struct TCP_Server_Info *server); | 371 | int (*query_mf_symlink)(const unsigned char *, char *, unsigned int *, |
372 | int (*query_mf_symlink)(const unsigned char *path, char *pbuf, | 372 | struct cifs_sb_info *, unsigned int); |
373 | unsigned int *pbytes_read, struct cifs_sb_info *cifs_sb, | 373 | /* if we can do cache read operations */ |
374 | unsigned int xid); | 374 | bool (*is_read_op)(__u32); |
375 | /* set oplock level for the inode */ | ||
376 | void (*set_oplock_level)(struct cifsInodeInfo *, __u32); | ||
375 | }; | 377 | }; |
376 | 378 | ||
377 | struct smb_version_values { | 379 | struct smb_version_values { |
@@ -389,7 +391,6 @@ struct smb_version_values { | |||
389 | unsigned int cap_unix; | 391 | unsigned int cap_unix; |
390 | unsigned int cap_nt_find; | 392 | unsigned int cap_nt_find; |
391 | unsigned int cap_large_files; | 393 | unsigned int cap_large_files; |
392 | unsigned int oplock_read; | ||
393 | __u16 signing_enabled; | 394 | __u16 signing_enabled; |
394 | __u16 signing_required; | 395 | __u16 signing_required; |
395 | }; | 396 | }; |
@@ -1036,6 +1037,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file); | |||
1036 | #define CIFS_CACHE_WRITE_FLG 4 | 1037 | #define CIFS_CACHE_WRITE_FLG 4 |
1037 | 1038 | ||
1038 | #define CIFS_CACHE_READ(cinode) (cinode->oplock & CIFS_CACHE_READ_FLG) | 1039 | #define CIFS_CACHE_READ(cinode) (cinode->oplock & CIFS_CACHE_READ_FLG) |
1040 | #define CIFS_CACHE_HANDLE(cinode) (cinode->oplock & CIFS_CACHE_HANDLE_FLG) | ||
1039 | #define CIFS_CACHE_WRITE(cinode) (cinode->oplock & CIFS_CACHE_WRITE_FLG) | 1041 | #define CIFS_CACHE_WRITE(cinode) (cinode->oplock & CIFS_CACHE_WRITE_FLG) |
1040 | 1042 | ||
1041 | /* | 1043 | /* |
@@ -1507,7 +1509,7 @@ extern mempool_t *cifs_mid_poolp; | |||
1507 | extern struct smb_version_operations smb1_operations; | 1509 | extern struct smb_version_operations smb1_operations; |
1508 | extern struct smb_version_values smb1_values; | 1510 | extern struct smb_version_values smb1_values; |
1509 | #define SMB20_VERSION_STRING "2.0" | 1511 | #define SMB20_VERSION_STRING "2.0" |
1510 | /*extern struct smb_version_operations smb20_operations; */ /* not needed yet */ | 1512 | extern struct smb_version_operations smb20_operations; |
1511 | extern struct smb_version_values smb20_values; | 1513 | extern struct smb_version_values smb20_values; |
1512 | #define SMB21_VERSION_STRING "2.1" | 1514 | #define SMB21_VERSION_STRING "2.1" |
1513 | extern struct smb_version_operations smb21_operations; | 1515 | extern struct smb_version_operations smb21_operations; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 688f48ec9abc..a279ffc0bc29 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1116,7 +1116,7 @@ cifs_parse_smb_version(char *value, struct smb_vol *vol) | |||
1116 | break; | 1116 | break; |
1117 | #ifdef CONFIG_CIFS_SMB2 | 1117 | #ifdef CONFIG_CIFS_SMB2 |
1118 | case Smb_20: | 1118 | case Smb_20: |
1119 | vol->ops = &smb21_operations; /* currently identical with 2.1 */ | 1119 | vol->ops = &smb20_operations; |
1120 | vol->vals = &smb20_values; | 1120 | vol->vals = &smb20_values; |
1121 | break; | 1121 | break; |
1122 | case Smb_21: | 1122 | case Smb_21: |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index ad14d3c66b25..188b2470b1fb 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -313,8 +313,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, | |||
313 | * If the server returned a read oplock and we have mandatory brlocks, | 313 | * If the server returned a read oplock and we have mandatory brlocks, |
314 | * set oplock level to None. | 314 | * set oplock level to None. |
315 | */ | 315 | */ |
316 | if (oplock == server->vals->oplock_read && | 316 | if (server->ops->is_read_op(oplock) && cifs_has_mand_locks(cinode)) { |
317 | cifs_has_mand_locks(cinode)) { | ||
318 | cifs_dbg(FYI, "Reset oplock val from read to None due to mand locks\n"); | 317 | cifs_dbg(FYI, "Reset oplock val from read to None due to mand locks\n"); |
319 | oplock = 0; | 318 | oplock = 0; |
320 | } | 319 | } |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 6fd0677915a0..8233b174de3d 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -912,6 +912,12 @@ cifs_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
912 | return rc; | 912 | return rc; |
913 | } | 913 | } |
914 | 914 | ||
915 | static bool | ||
916 | cifs_is_read_op(__u32 oplock) | ||
917 | { | ||
918 | return oplock == OPLOCK_READ; | ||
919 | } | ||
920 | |||
915 | struct smb_version_operations smb1_operations = { | 921 | struct smb_version_operations smb1_operations = { |
916 | .send_cancel = send_nt_cancel, | 922 | .send_cancel = send_nt_cancel, |
917 | .compare_fids = cifs_compare_fids, | 923 | .compare_fids = cifs_compare_fids, |
@@ -977,6 +983,7 @@ struct smb_version_operations smb1_operations = { | |||
977 | .mand_unlock_range = cifs_unlock_range, | 983 | .mand_unlock_range = cifs_unlock_range, |
978 | .push_mand_locks = cifs_push_mandatory_locks, | 984 | .push_mand_locks = cifs_push_mandatory_locks, |
979 | .query_mf_symlink = open_query_close_cifs_symlink, | 985 | .query_mf_symlink = open_query_close_cifs_symlink, |
986 | .is_read_op = cifs_is_read_op, | ||
980 | }; | 987 | }; |
981 | 988 | ||
982 | struct smb_version_values smb1_values = { | 989 | struct smb_version_values smb1_values = { |
@@ -992,7 +999,6 @@ struct smb_version_values smb1_values = { | |||
992 | .cap_unix = CAP_UNIX, | 999 | .cap_unix = CAP_UNIX, |
993 | .cap_nt_find = CAP_NT_SMBS | CAP_NT_FIND, | 1000 | .cap_nt_find = CAP_NT_SMBS | CAP_NT_FIND, |
994 | .cap_large_files = CAP_LARGE_FILES, | 1001 | .cap_large_files = CAP_LARGE_FILES, |
995 | .oplock_read = OPLOCK_READ, | ||
996 | .signing_enabled = SECMODE_SIGN_ENABLED, | 1002 | .signing_enabled = SECMODE_SIGN_ENABLED, |
997 | .signing_required = SECMODE_SIGN_REQUIRED, | 1003 | .signing_required = SECMODE_SIGN_REQUIRED, |
998 | }; | 1004 | }; |
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c index 4564787dc7d7..3f17b4550831 100644 --- a/fs/cifs/smb2file.c +++ b/fs/cifs/smb2file.c | |||
@@ -34,29 +34,6 @@ | |||
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_NOCHANGE) | ||
42 | return; | ||
43 | if (oplock == SMB2_OPLOCK_LEVEL_BATCH) { | ||
44 | cinode->oplock = CIFS_CACHE_READ_FLG | CIFS_CACHE_WRITE_FLG | | ||
45 | CIFS_CACHE_HANDLE_FLG; | ||
46 | cifs_dbg(FYI, "Batch Oplock granted on inode %p\n", | ||
47 | &cinode->vfs_inode); | ||
48 | } else if (oplock == SMB2_OPLOCK_LEVEL_EXCLUSIVE) { | ||
49 | cinode->oplock = CIFS_CACHE_READ_FLG | CIFS_CACHE_WRITE_FLG; | ||
50 | cifs_dbg(FYI, "Exclusive Oplock granted on inode %p\n", | ||
51 | &cinode->vfs_inode); | ||
52 | } else if (oplock == SMB2_OPLOCK_LEVEL_II) { | ||
53 | cinode->oplock = CIFS_CACHE_READ_FLG; | ||
54 | cifs_dbg(FYI, "Level II Oplock granted on inode %p\n", | ||
55 | &cinode->vfs_inode); | ||
56 | } else | ||
57 | cinode->oplock = 0; | ||
58 | } | ||
59 | |||
60 | int | 37 | int |
61 | smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, | 38 | smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, |
62 | __u32 *oplock, FILE_ALL_INFO *buf) | 39 | __u32 *oplock, FILE_ALL_INFO *buf) |
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c index 8d1a8898fd13..4aa59b34ec23 100644 --- a/fs/cifs/smb2misc.c +++ b/fs/cifs/smb2misc.c | |||
@@ -380,23 +380,15 @@ cifs_convert_path_to_utf16(const char *from, struct cifs_sb_info *cifs_sb) | |||
380 | __le32 | 380 | __le32 |
381 | smb2_get_lease_state(struct cifsInodeInfo *cinode) | 381 | smb2_get_lease_state(struct cifsInodeInfo *cinode) |
382 | { | 382 | { |
383 | if (CIFS_CACHE_WRITE(cinode)) | 383 | __le32 lease = 0; |
384 | return SMB2_LEASE_WRITE_CACHING | SMB2_LEASE_READ_CACHING; | ||
385 | else if (CIFS_CACHE_READ(cinode)) | ||
386 | return SMB2_LEASE_READ_CACHING; | ||
387 | return 0; | ||
388 | } | ||
389 | 384 | ||
390 | __u8 smb2_map_lease_to_oplock(__le32 lease_state) | 385 | if (CIFS_CACHE_WRITE(cinode)) |
391 | { | 386 | lease |= SMB2_LEASE_WRITE_CACHING; |
392 | if (lease_state & SMB2_LEASE_WRITE_CACHING) { | 387 | if (CIFS_CACHE_HANDLE(cinode)) |
393 | if (lease_state & SMB2_LEASE_HANDLE_CACHING) | 388 | lease |= SMB2_LEASE_HANDLE_CACHING; |
394 | return SMB2_OPLOCK_LEVEL_BATCH; | 389 | if (CIFS_CACHE_READ(cinode)) |
395 | else | 390 | lease |= SMB2_LEASE_READ_CACHING; |
396 | return SMB2_OPLOCK_LEVEL_EXCLUSIVE; | 391 | return lease; |
397 | } else if (lease_state & SMB2_LEASE_READ_CACHING) | ||
398 | return SMB2_OPLOCK_LEVEL_II; | ||
399 | return 0; | ||
400 | } | 392 | } |
401 | 393 | ||
402 | struct smb2_lease_break_work { | 394 | struct smb2_lease_break_work { |
@@ -433,7 +425,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp, | |||
433 | int ack_req = le32_to_cpu(rsp->Flags & | 425 | int ack_req = le32_to_cpu(rsp->Flags & |
434 | SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED); | 426 | SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED); |
435 | 427 | ||
436 | lease_state = smb2_map_lease_to_oplock(rsp->NewLeaseState); | 428 | lease_state = le32_to_cpu(rsp->NewLeaseState); |
437 | 429 | ||
438 | list_for_each(tmp, &tcon->openFileList) { | 430 | list_for_each(tmp, &tcon->openFileList) { |
439 | cfile = list_entry(tmp, struct cifsFileInfo, tlist); | 431 | cfile = list_entry(tmp, struct cifsFileInfo, tlist); |
@@ -447,7 +439,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp, | |||
447 | cifs_dbg(FYI, "lease key match, lease break 0x%d\n", | 439 | cifs_dbg(FYI, "lease key match, lease break 0x%d\n", |
448 | le32_to_cpu(rsp->NewLeaseState)); | 440 | le32_to_cpu(rsp->NewLeaseState)); |
449 | 441 | ||
450 | smb2_set_oplock_level(cinode, lease_state); | 442 | tcon->ses->server->ops->set_oplock_level(cinode, lease_state); |
451 | 443 | ||
452 | if (ack_req) | 444 | if (ack_req) |
453 | cfile->oplock_break_cancelled = false; | 445 | cfile->oplock_break_cancelled = false; |
@@ -582,7 +574,7 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) | |||
582 | else | 574 | else |
583 | cfile->oplock_break_cancelled = false; | 575 | cfile->oplock_break_cancelled = false; |
584 | 576 | ||
585 | smb2_set_oplock_level(cinode, | 577 | server->ops->set_oplock_level(cinode, |
586 | rsp->OplockLevel ? SMB2_OPLOCK_LEVEL_II : 0); | 578 | rsp->OplockLevel ? SMB2_OPLOCK_LEVEL_II : 0); |
587 | 579 | ||
588 | queue_work(cifsiod_wq, &cfile->oplock_break); | 580 | queue_work(cifsiod_wq, &cfile->oplock_break); |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 96c9d3da3f41..4656656d5c0f 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -377,9 +377,11 @@ static void | |||
377 | smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock) | 377 | smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock) |
378 | { | 378 | { |
379 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 379 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); |
380 | struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; | ||
381 | |||
380 | cfile->fid.persistent_fid = fid->persistent_fid; | 382 | cfile->fid.persistent_fid = fid->persistent_fid; |
381 | cfile->fid.volatile_fid = fid->volatile_fid; | 383 | cfile->fid.volatile_fid = fid->volatile_fid; |
382 | smb2_set_oplock_level(cinode, oplock); | 384 | server->ops->set_oplock_level(cinode, oplock); |
383 | cinode->can_cache_brlcks = CIFS_CACHE_WRITE(cinode); | 385 | cinode->can_cache_brlcks = CIFS_CACHE_WRITE(cinode); |
384 | } | 386 | } |
385 | 387 | ||
@@ -648,7 +650,71 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
648 | return rc; | 650 | return rc; |
649 | } | 651 | } |
650 | 652 | ||
651 | struct smb_version_operations smb21_operations = { | 653 | static void |
654 | smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock) | ||
655 | { | ||
656 | oplock &= 0xFF; | ||
657 | if (oplock == SMB2_OPLOCK_LEVEL_NOCHANGE) | ||
658 | return; | ||
659 | if (oplock == SMB2_OPLOCK_LEVEL_BATCH) { | ||
660 | cinode->oplock = CIFS_CACHE_READ_FLG | CIFS_CACHE_WRITE_FLG | | ||
661 | CIFS_CACHE_HANDLE_FLG; | ||
662 | cifs_dbg(FYI, "Batch Oplock granted on inode %p\n", | ||
663 | &cinode->vfs_inode); | ||
664 | } else if (oplock == SMB2_OPLOCK_LEVEL_EXCLUSIVE) { | ||
665 | cinode->oplock = CIFS_CACHE_READ_FLG | CIFS_CACHE_WRITE_FLG; | ||
666 | cifs_dbg(FYI, "Exclusive Oplock granted on inode %p\n", | ||
667 | &cinode->vfs_inode); | ||
668 | } else if (oplock == SMB2_OPLOCK_LEVEL_II) { | ||
669 | cinode->oplock = CIFS_CACHE_READ_FLG; | ||
670 | cifs_dbg(FYI, "Level II Oplock granted on inode %p\n", | ||
671 | &cinode->vfs_inode); | ||
672 | } else | ||
673 | cinode->oplock = 0; | ||
674 | } | ||
675 | |||
676 | static void | ||
677 | smb21_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock) | ||
678 | { | ||
679 | char message[5] = {0}; | ||
680 | |||
681 | oplock &= 0xFF; | ||
682 | if (oplock == SMB2_OPLOCK_LEVEL_NOCHANGE) | ||
683 | return; | ||
684 | |||
685 | cinode->oplock = 0; | ||
686 | if (oplock & SMB2_LEASE_READ_CACHING_HE) { | ||
687 | cinode->oplock |= CIFS_CACHE_READ_FLG; | ||
688 | strcat(message, "R"); | ||
689 | } | ||
690 | if (oplock & SMB2_LEASE_HANDLE_CACHING_HE) { | ||
691 | cinode->oplock |= CIFS_CACHE_HANDLE_FLG; | ||
692 | strcat(message, "H"); | ||
693 | } | ||
694 | if (oplock & SMB2_LEASE_WRITE_CACHING_HE) { | ||
695 | cinode->oplock |= CIFS_CACHE_WRITE_FLG; | ||
696 | strcat(message, "W"); | ||
697 | } | ||
698 | if (!cinode->oplock) | ||
699 | strcat(message, "None"); | ||
700 | cifs_dbg(FYI, "%s Lease granted on inode %p\n", message, | ||
701 | &cinode->vfs_inode); | ||
702 | } | ||
703 | |||
704 | static bool | ||
705 | smb2_is_read_op(__u32 oplock) | ||
706 | { | ||
707 | return oplock == SMB2_OPLOCK_LEVEL_II; | ||
708 | } | ||
709 | |||
710 | static bool | ||
711 | smb21_is_read_op(__u32 oplock) | ||
712 | { | ||
713 | return (oplock & SMB2_LEASE_READ_CACHING_HE) && | ||
714 | !(oplock & SMB2_LEASE_WRITE_CACHING_HE); | ||
715 | } | ||
716 | |||
717 | struct smb_version_operations smb20_operations = { | ||
652 | .compare_fids = smb2_compare_fids, | 718 | .compare_fids = smb2_compare_fids, |
653 | .setup_request = smb2_setup_request, | 719 | .setup_request = smb2_setup_request, |
654 | .setup_async_request = smb2_setup_async_request, | 720 | .setup_async_request = smb2_setup_async_request, |
@@ -713,8 +779,78 @@ struct smb_version_operations smb21_operations = { | |||
713 | .set_lease_key = smb2_set_lease_key, | 779 | .set_lease_key = smb2_set_lease_key, |
714 | .new_lease_key = smb2_new_lease_key, | 780 | .new_lease_key = smb2_new_lease_key, |
715 | .calc_signature = smb2_calc_signature, | 781 | .calc_signature = smb2_calc_signature, |
782 | .is_read_op = smb2_is_read_op, | ||
783 | .set_oplock_level = smb2_set_oplock_level, | ||
716 | }; | 784 | }; |
717 | 785 | ||
786 | struct smb_version_operations smb21_operations = { | ||
787 | .compare_fids = smb2_compare_fids, | ||
788 | .setup_request = smb2_setup_request, | ||
789 | .setup_async_request = smb2_setup_async_request, | ||
790 | .check_receive = smb2_check_receive, | ||
791 | .add_credits = smb2_add_credits, | ||
792 | .set_credits = smb2_set_credits, | ||
793 | .get_credits_field = smb2_get_credits_field, | ||
794 | .get_credits = smb2_get_credits, | ||
795 | .get_next_mid = smb2_get_next_mid, | ||
796 | .read_data_offset = smb2_read_data_offset, | ||
797 | .read_data_length = smb2_read_data_length, | ||
798 | .map_error = map_smb2_to_linux_error, | ||
799 | .find_mid = smb2_find_mid, | ||
800 | .check_message = smb2_check_message, | ||
801 | .dump_detail = smb2_dump_detail, | ||
802 | .clear_stats = smb2_clear_stats, | ||
803 | .print_stats = smb2_print_stats, | ||
804 | .is_oplock_break = smb2_is_valid_oplock_break, | ||
805 | .need_neg = smb2_need_neg, | ||
806 | .negotiate = smb2_negotiate, | ||
807 | .negotiate_wsize = smb2_negotiate_wsize, | ||
808 | .negotiate_rsize = smb2_negotiate_rsize, | ||
809 | .sess_setup = SMB2_sess_setup, | ||
810 | .logoff = SMB2_logoff, | ||
811 | .tree_connect = SMB2_tcon, | ||
812 | .tree_disconnect = SMB2_tdis, | ||
813 | .is_path_accessible = smb2_is_path_accessible, | ||
814 | .can_echo = smb2_can_echo, | ||
815 | .echo = SMB2_echo, | ||
816 | .query_path_info = smb2_query_path_info, | ||
817 | .get_srv_inum = smb2_get_srv_inum, | ||
818 | .query_file_info = smb2_query_file_info, | ||
819 | .set_path_size = smb2_set_path_size, | ||
820 | .set_file_size = smb2_set_file_size, | ||
821 | .set_file_info = smb2_set_file_info, | ||
822 | .mkdir = smb2_mkdir, | ||
823 | .mkdir_setinfo = smb2_mkdir_setinfo, | ||
824 | .rmdir = smb2_rmdir, | ||
825 | .unlink = smb2_unlink, | ||
826 | .rename = smb2_rename_path, | ||
827 | .create_hardlink = smb2_create_hardlink, | ||
828 | .query_symlink = smb2_query_symlink, | ||
829 | .open = smb2_open_file, | ||
830 | .set_fid = smb2_set_fid, | ||
831 | .close = smb2_close_file, | ||
832 | .flush = smb2_flush_file, | ||
833 | .async_readv = smb2_async_readv, | ||
834 | .async_writev = smb2_async_writev, | ||
835 | .sync_read = smb2_sync_read, | ||
836 | .sync_write = smb2_sync_write, | ||
837 | .query_dir_first = smb2_query_dir_first, | ||
838 | .query_dir_next = smb2_query_dir_next, | ||
839 | .close_dir = smb2_close_dir, | ||
840 | .calc_smb_size = smb2_calc_size, | ||
841 | .is_status_pending = smb2_is_status_pending, | ||
842 | .oplock_response = smb2_oplock_response, | ||
843 | .queryfs = smb2_queryfs, | ||
844 | .mand_lock = smb2_mand_lock, | ||
845 | .mand_unlock_range = smb2_unlock_range, | ||
846 | .push_mand_locks = smb2_push_mandatory_locks, | ||
847 | .get_lease_key = smb2_get_lease_key, | ||
848 | .set_lease_key = smb2_set_lease_key, | ||
849 | .new_lease_key = smb2_new_lease_key, | ||
850 | .calc_signature = smb2_calc_signature, | ||
851 | .is_read_op = smb21_is_read_op, | ||
852 | .set_oplock_level = smb21_set_oplock_level, | ||
853 | }; | ||
718 | 854 | ||
719 | struct smb_version_operations smb30_operations = { | 855 | struct smb_version_operations smb30_operations = { |
720 | .compare_fids = smb2_compare_fids, | 856 | .compare_fids = smb2_compare_fids, |
@@ -783,6 +919,8 @@ struct smb_version_operations smb30_operations = { | |||
783 | .new_lease_key = smb2_new_lease_key, | 919 | .new_lease_key = smb2_new_lease_key, |
784 | .generate_signingkey = generate_smb3signingkey, | 920 | .generate_signingkey = generate_smb3signingkey, |
785 | .calc_signature = smb3_calc_signature, | 921 | .calc_signature = smb3_calc_signature, |
922 | .is_read_op = smb21_is_read_op, | ||
923 | .set_oplock_level = smb21_set_oplock_level, | ||
786 | }; | 924 | }; |
787 | 925 | ||
788 | struct smb_version_values smb20_values = { | 926 | struct smb_version_values smb20_values = { |
@@ -800,7 +938,6 @@ struct smb_version_values smb20_values = { | |||
800 | .cap_unix = 0, | 938 | .cap_unix = 0, |
801 | .cap_nt_find = SMB2_NT_FIND, | 939 | .cap_nt_find = SMB2_NT_FIND, |
802 | .cap_large_files = SMB2_LARGE_FILES, | 940 | .cap_large_files = SMB2_LARGE_FILES, |
803 | .oplock_read = SMB2_OPLOCK_LEVEL_II, | ||
804 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, | 941 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, |
805 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, | 942 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, |
806 | }; | 943 | }; |
@@ -820,7 +957,6 @@ struct smb_version_values smb21_values = { | |||
820 | .cap_unix = 0, | 957 | .cap_unix = 0, |
821 | .cap_nt_find = SMB2_NT_FIND, | 958 | .cap_nt_find = SMB2_NT_FIND, |
822 | .cap_large_files = SMB2_LARGE_FILES, | 959 | .cap_large_files = SMB2_LARGE_FILES, |
823 | .oplock_read = SMB2_OPLOCK_LEVEL_II, | ||
824 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, | 960 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, |
825 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, | 961 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, |
826 | }; | 962 | }; |
@@ -840,7 +976,6 @@ struct smb_version_values smb30_values = { | |||
840 | .cap_unix = 0, | 976 | .cap_unix = 0, |
841 | .cap_nt_find = SMB2_NT_FIND, | 977 | .cap_nt_find = SMB2_NT_FIND, |
842 | .cap_large_files = SMB2_LARGE_FILES, | 978 | .cap_large_files = SMB2_LARGE_FILES, |
843 | .oplock_read = SMB2_OPLOCK_LEVEL_II, | ||
844 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, | 979 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, |
845 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, | 980 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, |
846 | }; | 981 | }; |
@@ -860,7 +995,6 @@ struct smb_version_values smb302_values = { | |||
860 | .cap_unix = 0, | 995 | .cap_unix = 0, |
861 | .cap_nt_find = SMB2_NT_FIND, | 996 | .cap_nt_find = SMB2_NT_FIND, |
862 | .cap_large_files = SMB2_LARGE_FILES, | 997 | .cap_large_files = SMB2_LARGE_FILES, |
863 | .oplock_read = SMB2_OPLOCK_LEVEL_II, | ||
864 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, | 998 | .signing_enabled = SMB2_NEGOTIATE_SIGNING_ENABLED | SMB2_NEGOTIATE_SIGNING_REQUIRED, |
865 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, | 999 | .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, |
866 | }; | 1000 | }; |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 0a9458282717..fdf697bcdf9f 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -963,7 +963,7 @@ parse_lease_state(struct smb2_create_rsp *rsp) | |||
963 | if (!found) | 963 | if (!found) |
964 | return 0; | 964 | return 0; |
965 | 965 | ||
966 | return smb2_map_lease_to_oplock(lc->lcontext.LeaseState); | 966 | return le32_to_cpu(lc->lcontext.LeaseState); |
967 | } | 967 | } |
968 | 968 | ||
969 | static int | 969 | static int |
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 40baeae60b08..a2ec65ae626c 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h | |||
@@ -476,6 +476,10 @@ struct create_context { | |||
476 | __u8 Buffer[0]; | 476 | __u8 Buffer[0]; |
477 | } __packed; | 477 | } __packed; |
478 | 478 | ||
479 | #define SMB2_LEASE_READ_CACHING_HE 0x01 | ||
480 | #define SMB2_LEASE_HANDLE_CACHING_HE 0x02 | ||
481 | #define SMB2_LEASE_WRITE_CACHING_HE 0x04 | ||
482 | |||
479 | #define SMB2_LEASE_NONE __constant_cpu_to_le32(0x00) | 483 | #define SMB2_LEASE_NONE __constant_cpu_to_le32(0x00) |
480 | #define SMB2_LEASE_READ_CACHING __constant_cpu_to_le32(0x01) | 484 | #define SMB2_LEASE_READ_CACHING __constant_cpu_to_le32(0x01) |
481 | #define SMB2_LEASE_HANDLE_CACHING __constant_cpu_to_le32(0x02) | 485 | #define SMB2_LEASE_HANDLE_CACHING __constant_cpu_to_le32(0x02) |
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h index 1db89fda1392..e3fb4801ee96 100644 --- a/fs/cifs/smb2proto.h +++ b/fs/cifs/smb2proto.h | |||
@@ -53,7 +53,6 @@ extern int smb3_calc_signature(struct smb_rqst *rqst, | |||
53 | struct TCP_Server_Info *server); | 53 | struct TCP_Server_Info *server); |
54 | extern void smb2_echo_request(struct work_struct *work); | 54 | extern void smb2_echo_request(struct work_struct *work); |
55 | extern __le32 smb2_get_lease_state(struct cifsInodeInfo *cinode); | 55 | extern __le32 smb2_get_lease_state(struct cifsInodeInfo *cinode); |
56 | extern __u8 smb2_map_lease_to_oplock(__le32 lease_state); | ||
57 | extern bool smb2_is_valid_oplock_break(char *buffer, | 56 | extern bool smb2_is_valid_oplock_break(char *buffer, |
58 | struct TCP_Server_Info *srv); | 57 | struct TCP_Server_Info *srv); |
59 | 58 | ||
@@ -87,7 +86,6 @@ extern int smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
87 | extern int smb2_open_file(const unsigned int xid, | 86 | extern int smb2_open_file(const unsigned int xid, |
88 | struct cifs_open_parms *oparms, | 87 | struct cifs_open_parms *oparms, |
89 | __u32 *oplock, FILE_ALL_INFO *buf); | 88 | __u32 *oplock, FILE_ALL_INFO *buf); |
90 | extern void smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock); | ||
91 | extern int smb2_unlock_range(struct cifsFileInfo *cfile, | 89 | extern int smb2_unlock_range(struct cifsFileInfo *cfile, |
92 | struct file_lock *flock, const unsigned int xid); | 90 | struct file_lock *flock, const unsigned int xid); |
93 | extern int smb2_push_mandatory_locks(struct cifsFileInfo *cfile); | 91 | extern int smb2_push_mandatory_locks(struct cifsFileInfo *cfile); |