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 /fs/cifs/smb2misc.c | |
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>
Diffstat (limited to 'fs/cifs/smb2misc.c')
-rw-r--r-- | fs/cifs/smb2misc.c | 30 |
1 files changed, 11 insertions, 19 deletions
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); |