]> 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 14:55:30 +0000 (16:55 +0200)
commit289f945acb20b9b54fe4d13895e44aa58965ddb2
treef541b10284f1b50322c2be3ff81b89376e939890
parentdddeed19782df4cabccf5791d37d143871456612
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