]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ksmbd: send lease break notification on FILE_RENAME_INFORMATION
authorNamjae Jeon <linkinjeon@kernel.org>
Sun, 21 Jan 2024 14:30:33 +0000 (23:30 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 07:54:26 +0000 (08:54 +0100)
[ Upstream commit 3fc74c65b367476874da5fe6f633398674b78e5a ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ksmbd/oplock.c
fs/ksmbd/smb2pdu.c

index 07ebce07204f7e3ba1a6327446c53772d003b8a5..4e444d01a3c3d57c60125705dd28a1e8e49babef 100644 (file)
@@ -541,14 +541,12 @@ static struct oplock_info *same_client_has_lease(struct ksmbd_inode *ci,
                                continue;
                        }
 
-                       if (lctx->req_state != lease->state)
-                               lease->epoch++;
-
                        /* upgrading lease */
                        if ((atomic_read(&ci->op_count) +
                             atomic_read(&ci->sop_count)) == 1) {
                                if (lease->state != SMB2_LEASE_NONE_LE &&
                                    lease->state == (lctx->req_state & lease->state)) {
+                                       lease->epoch++;
                                        lease->state |= lctx->req_state;
                                        if (lctx->req_state &
                                                SMB2_LEASE_WRITE_CACHING_LE)
@@ -559,13 +557,17 @@ static struct oplock_info *same_client_has_lease(struct ksmbd_inode *ci,
                                    atomic_read(&ci->sop_count)) > 1) {
                                if (lctx->req_state ==
                                    (SMB2_LEASE_READ_CACHING_LE |
-                                    SMB2_LEASE_HANDLE_CACHING_LE))
+                                    SMB2_LEASE_HANDLE_CACHING_LE)) {
+                                       lease->epoch++;
                                        lease->state = lctx->req_state;
+                               }
                        }
 
                        if (lctx->req_state && lease->state ==
-                           SMB2_LEASE_NONE_LE)
+                           SMB2_LEASE_NONE_LE) {
+                               lease->epoch++;
                                lease_none_upgrade(opinfo, lctx->req_state);
+                       }
                }
                read_lock(&ci->m_lock);
        }
index bae4df83004e07c2fec33dc0f870e7ea78dec7cb..7e8f1c89124faddb369579f0fcce6e49e66866da 100644 (file)
@@ -5581,6 +5581,7 @@ static int smb2_rename(struct ksmbd_work *work,
        if (!file_info->ReplaceIfExists)
                flags = RENAME_NOREPLACE;
 
+       smb_break_all_levII_oplock(work, fp, 0);
        rc = ksmbd_vfs_rename(work, &fp->filp->f_path, new_name, flags);
 out:
        kfree(new_name);