aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/smb2misc.c')
-rw-r--r--fs/cifs/smb2misc.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 7b8b58fb4d3f..0e3570e40ff8 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -517,7 +517,6 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp,
517 __u8 lease_state; 517 __u8 lease_state;
518 struct list_head *tmp; 518 struct list_head *tmp;
519 struct cifsFileInfo *cfile; 519 struct cifsFileInfo *cfile;
520 struct TCP_Server_Info *server = tcon->ses->server;
521 struct cifs_pending_open *open; 520 struct cifs_pending_open *open;
522 struct cifsInodeInfo *cinode; 521 struct cifsInodeInfo *cinode;
523 int ack_req = le32_to_cpu(rsp->Flags & 522 int ack_req = le32_to_cpu(rsp->Flags &
@@ -537,13 +536,25 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp,
537 cifs_dbg(FYI, "lease key match, lease break 0x%x\n", 536 cifs_dbg(FYI, "lease key match, lease break 0x%x\n",
538 le32_to_cpu(rsp->NewLeaseState)); 537 le32_to_cpu(rsp->NewLeaseState));
539 538
540 server->ops->set_oplock_level(cinode, lease_state, 0, NULL);
541
542 if (ack_req) 539 if (ack_req)
543 cfile->oplock_break_cancelled = false; 540 cfile->oplock_break_cancelled = false;
544 else 541 else
545 cfile->oplock_break_cancelled = true; 542 cfile->oplock_break_cancelled = true;
546 543
544 set_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags);
545
546 /*
547 * Set or clear flags depending on the lease state being READ.
548 * HANDLE caching flag should be added when the client starts
549 * to defer closing remote file handles with HANDLE leases.
550 */
551 if (lease_state & SMB2_LEASE_READ_CACHING_HE)
552 set_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,
553 &cinode->flags);
554 else
555 clear_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,
556 &cinode->flags);
557
547 queue_work(cifsoplockd_wq, &cfile->oplock_break); 558 queue_work(cifsoplockd_wq, &cfile->oplock_break);
548 kfree(lw); 559 kfree(lw);
549 return true; 560 return true;
@@ -648,13 +659,6 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
648 if (rsp->sync_hdr.Command != SMB2_OPLOCK_BREAK) 659 if (rsp->sync_hdr.Command != SMB2_OPLOCK_BREAK)
649 return false; 660 return false;
650 661
651 if (rsp->sync_hdr.CreditRequest) {
652 spin_lock(&server->req_lock);
653 server->credits += le16_to_cpu(rsp->sync_hdr.CreditRequest);
654 spin_unlock(&server->req_lock);
655 wake_up(&server->request_q);
656 }
657
658 if (rsp->StructureSize != 662 if (rsp->StructureSize !=
659 smb2_rsp_struct_sizes[SMB2_OPLOCK_BREAK_HE]) { 663 smb2_rsp_struct_sizes[SMB2_OPLOCK_BREAK_HE]) {
660 if (le16_to_cpu(rsp->StructureSize) == 44) 664 if (le16_to_cpu(rsp->StructureSize) == 44)