ksmbd: don't send oplock break if rename fails

commit c1832f67035dc04fb89e6b591b64e4d515843cda upstream.

Don't send oplock break if rename fails. This patch fix
smb2.oplock.batch20 test.

Cc: stable@vger.kernel.org
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>
This commit is contained in:
Namjae Jeon 2024-03-31 21:58:26 +09:00 committed by Greg Kroah-Hartman
parent 2f0262ac3a
commit a06562fd4c
1 changed files with 2 additions and 1 deletions

View File

@ -5631,8 +5631,9 @@ 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);
if (!rc)
smb_break_all_levII_oplock(work, fp, 0);
out:
kfree(new_name);
return rc;