]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
smb: client: fix race with concurrent opens in rename(2)
authorPaulo Alcantara <pc@manguebit.org>
Fri, 8 Aug 2025 14:43:29 +0000 (11:43 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Sep 2025 13:26:25 +0000 (15:26 +0200)
commitc9e7de284da0be5b44dbe79d71573f9f7f9b144c
treea96050eea5424ba33497607b4841123f6a173bc9
parentc3848c3dc8810d6c10b924bd2cfe68c6e53dc7a1
smb: client: fix race with concurrent opens in rename(2)

[ Upstream commit d84291fc7453df7881a970716f8256273aca5747 ]

Besides sending the rename request to the server, the rename process
also involves closing any deferred close, waiting for outstanding I/O
to complete as well as marking all existing open handles as deleted to
prevent them from deferring closes, which increases the race window
for potential concurrent opens on the target file.

Fix this by unhashing the dentry in advance to prevent any concurrent
opens on the target.

Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Reviewed-by: David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/smb/client/inode.c