]> 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:31:44 +0000 (15:31 +0200)
commitc9991af5e09924f6f3b3e6996a5e09f9504b4358
tree3d545089f87a607c988322ff62b9c2a3f761f25a
parentc2c9d0ae69714a947c84e6dd0e28d0223fbd3c51
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