Skip to content

Commit 3fc74c6

Browse files
namjaejeonSteve French
authored andcommitted
ksmbd: send lease break notification on FILE_RENAME_INFORMATION
Send lease break notification on FILE_RENAME_INFORMATION request. This patch fix smb2.lease.v2_epoch2 test failure. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent d592a91 commit 3fc74c6

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

fs/smb/server/oplock.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,14 +541,12 @@ static struct oplock_info *same_client_has_lease(struct ksmbd_inode *ci,
541541
continue;
542542
}
543543

544-
if (lctx->req_state != lease->state)
545-
lease->epoch++;
546-
547544
/* upgrading lease */
548545
if ((atomic_read(&ci->op_count) +
549546
atomic_read(&ci->sop_count)) == 1) {
550547
if (lease->state != SMB2_LEASE_NONE_LE &&
551548
lease->state == (lctx->req_state & lease->state)) {
549+
lease->epoch++;
552550
lease->state |= lctx->req_state;
553551
if (lctx->req_state &
554552
SMB2_LEASE_WRITE_CACHING_LE)
@@ -559,13 +557,17 @@ static struct oplock_info *same_client_has_lease(struct ksmbd_inode *ci,
559557
atomic_read(&ci->sop_count)) > 1) {
560558
if (lctx->req_state ==
561559
(SMB2_LEASE_READ_CACHING_LE |
562-
SMB2_LEASE_HANDLE_CACHING_LE))
560+
SMB2_LEASE_HANDLE_CACHING_LE)) {
561+
lease->epoch++;
563562
lease->state = lctx->req_state;
563+
}
564564
}
565565

566566
if (lctx->req_state && lease->state ==
567-
SMB2_LEASE_NONE_LE)
567+
SMB2_LEASE_NONE_LE) {
568+
lease->epoch++;
568569
lease_none_upgrade(opinfo, lctx->req_state);
570+
}
569571
}
570572
read_lock(&ci->m_lock);
571573
}

fs/smb/server/smb2pdu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5569,6 +5569,7 @@ static int smb2_rename(struct ksmbd_work *work,
55695569
if (!file_info->ReplaceIfExists)
55705570
flags = RENAME_NOREPLACE;
55715571

5572+
smb_break_all_levII_oplock(work, fp, 0);
55725573
rc = ksmbd_vfs_rename(work, &fp->filp->f_path, new_name, flags);
55735574
out:
55745575
kfree(new_name);

0 commit comments

Comments
 (0)