]> git.baikalelectronics.ru Git - kernel.git/commit
cifs: Fix the target file was deleted when rename failed.
authorZhang Xiaoxu <zhangxiaoxu5@huawei.com>
Mon, 29 Jun 2020 01:06:38 +0000 (21:06 -0400)
committerSteve French <stfrench@microsoft.com>
Thu, 2 Jul 2020 00:41:56 +0000 (19:41 -0500)
commit9818cc640feb8b0f27c0fa1decabaf0d3d3ca46f
treec0cfe2bdb4dc73cd6d0f77c5894130bf4c2a280c
parentb10dd0d73675923c13d39a33548250a29ebf5d7a
cifs: Fix the target file was deleted when rename failed.

When xfstest generic/035, we found the target file was deleted
if the rename return -EACESS.

In cifs_rename2, we unlink the positive target dentry if rename
failed with EACESS or EEXIST, even if the target dentry is positived
before rename. Then the existing file was deleted.

We should just delete the target file which created during the
rename.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
fs/cifs/inode.c