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/smb2ops.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/smb2ops.c')
-rw-r--r-- | fs/cifs/smb2ops.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 0808b238219b..360d9079af49 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -555,6 +555,24 @@ smb2_mand_lock(const unsigned int xid, struct cifsFileInfo *cfile, __u64 offset, | |||
555 | current->tgid, length, offset, type, wait); | 555 | current->tgid, length, offset, type, wait); |
556 | } | 556 | } |
557 | 557 | ||
558 | static void | ||
559 | smb2_get_lease_key(struct inode *inode, struct cifs_fid *fid) | ||
560 | { | ||
561 | memcpy(fid->lease_key, CIFS_I(inode)->lease_key, SMB2_LEASE_KEY_SIZE); | ||
562 | } | ||
563 | |||
564 | static void | ||
565 | smb2_set_lease_key(struct inode *inode, struct cifs_fid *fid) | ||
566 | { | ||
567 | memcpy(CIFS_I(inode)->lease_key, fid->lease_key, SMB2_LEASE_KEY_SIZE); | ||
568 | } | ||
569 | |||
570 | static void | ||
571 | smb2_new_lease_key(struct cifs_fid *fid) | ||
572 | { | ||
573 | get_random_bytes(fid->lease_key, SMB2_LEASE_KEY_SIZE); | ||
574 | } | ||
575 | |||
558 | struct smb_version_operations smb21_operations = { | 576 | struct smb_version_operations smb21_operations = { |
559 | .compare_fids = smb2_compare_fids, | 577 | .compare_fids = smb2_compare_fids, |
560 | .setup_request = smb2_setup_request, | 578 | .setup_request = smb2_setup_request, |
@@ -616,6 +634,9 @@ struct smb_version_operations smb21_operations = { | |||
616 | .mand_lock = smb2_mand_lock, | 634 | .mand_lock = smb2_mand_lock, |
617 | .mand_unlock_range = smb2_unlock_range, | 635 | .mand_unlock_range = smb2_unlock_range, |
618 | .push_mand_locks = smb2_push_mandatory_locks, | 636 | .push_mand_locks = smb2_push_mandatory_locks, |
637 | .get_lease_key = smb2_get_lease_key, | ||
638 | .set_lease_key = smb2_set_lease_key, | ||
639 | .new_lease_key = smb2_new_lease_key, | ||
619 | }; | 640 | }; |
620 | 641 | ||
621 | struct smb_version_values smb21_values = { | 642 | struct smb_version_values smb21_values = { |