linux/fs/smb/client
Paulo Alcantara c5ea306558 smb: client: fix data loss due to broken rename(2)
Rename of open files in SMB2+ has been broken for a very long time,
resulting in data loss as the CIFS client would fail the rename(2)
call with -ENOENT and then removing the target file.

Fix this by implementing ->rename_pending_delete() for SMB2+, which
will rename busy files to random filenames (e.g. silly rename) during
unlink(2) or rename(2), and then marking them to delete-on-close.

Besides, introduce a FIND_WR_NO_PENDING_DELETE flag to prevent open(2)
from reusing open handles that had been marked as delete pending.
Handle it in cifs_get_readable_path() as well.

Reported-by: Jean-Baptiste Denis <jbdenis@pasteur.fr>
Closes: https://marc.info/?i=16aeb380-30d4-4551-9134-4e7d1dc833c0@pasteur.fr
Reviewed-by: David Howells <dhowells@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Cc: Frank Sorenson <sorenson@redhat.com>
Cc: Olga Kornievskaia <okorniev@redhat.com>
Cc: Benjamin Coddington <bcodding@redhat.com>
Cc: Scott Mayhew <smayhew@redhat.com>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-09-09 18:39:58 -05:00
..
compress
asn1.c
cached_dir.c cifs: add new field to track the last access time of cfid 2025-07-27 16:59:59 -05:00
cached_dir.h smb3 client: add way to show directory leases for improved debugging 2025-07-31 09:42:54 -05:00
cifs_debug.c smb: client: show negotiated cipher in DebugData 2025-09-02 20:38:00 -05:00
cifs_debug.h
cifs_fs_sb.h
cifs_ioctl.h
cifs_spnego_negtokeninit.asn1
cifs_spnego.c cifs: avoid extra calls to strlen() in cifs_get_spnego_key() 2025-08-11 23:20:26 -05:00
cifs_spnego.h
cifs_swn.c
cifs_swn.h
cifs_unicode.c cifs: prevent NULL pointer dereference in UTF16 conversion 2025-09-04 11:43:31 -05:00
cifs_unicode.h
cifsacl.c
cifsacl.h
cifsencrypt.c smb: client: fix session setup against servers that require SPN 2025-07-27 16:59:59 -05:00
cifsfs.c smb3 client: fix return code mapping of remap_file_range 2025-08-25 09:40:38 -05:00
cifsfs.h cifs: update internal version number 2025-08-13 11:36:20 -05:00
cifsglob.h smb: client: fix data loss due to broken rename(2) 2025-09-09 18:39:58 -05:00
cifspdu.h
cifsproto.h cifs: Move the SMB1 transport code out of transport.c 2025-08-06 12:01:54 -05:00
cifsroot.c
cifssmb.c smb: client: fix creating symlinks under POSIX mounts 2025-08-04 19:29:14 -05:00
cifstransport.c smb: client: fix mid_q_entry memleak leak with per-mid locking 2025-08-13 11:36:05 -05:00
compress.c cifs: Fix collect_sample() to handle any iterator type 2025-08-11 23:20:07 -05:00
compress.h
connect.c smb: client: remove redundant lstrp update in negotiate protocol 2025-08-13 11:36:24 -05:00
dfs_cache.c
dfs_cache.h
dfs.c
dfs.h
dir.c smb: invalidate and close cached directory when creating child entries 2025-07-13 17:16:29 -05:00
dns_resolve.c
dns_resolve.h
export.c
file.c smb: client: fix data loss due to broken rename(2) 2025-09-09 18:39:58 -05:00
fs_context.c smb: client: default to nonativesocket under POSIX mounts 2025-08-04 19:29:10 -05:00
fs_context.h smb: client: set symlink type as native for POSIX mounts 2025-08-01 00:16:19 -05:00
fscache.c
fscache.h
inode.c smb: client: fix data loss due to broken rename(2) 2025-09-09 18:39:58 -05:00
ioctl.c
Kconfig
link.c smb: client: fix creating symlinks under POSIX mounts 2025-08-04 19:29:14 -05:00
Makefile cifs: Move the SMB1 transport code out of transport.c 2025-08-06 12:01:54 -05:00
misc.c
namespace.c
netlink.c
netlink.h
netmisc.c
nterr.c
nterr.h
ntlmssp.h
readdir.c
reparse.c smb: client: fix spellings in comments 2025-09-02 20:37:17 -05:00
reparse.h cifs: Add support for creating reparse points over SMB1 2025-07-27 17:43:08 -05:00
rfc1002pdu.h
sess.c cifs: reset iface weights when we cannot find a candidate 2025-07-27 16:59:58 -05:00
smb1ops.c smb: client: fix spellings in comments 2025-09-02 20:37:17 -05:00
smb2file.c
smb2glob.h smb: client: fix data loss due to broken rename(2) 2025-09-09 18:39:58 -05:00
smb2inode.c smb: client: fix data loss due to broken rename(2) 2025-09-09 18:39:58 -05:00
smb2maperror.c
smb2misc.c smb: client: add new tracepoint to trace lease break notification 2025-09-02 20:37:44 -05:00
smb2ops.c smb: client: fix data loss due to broken rename(2) 2025-09-09 18:39:58 -05:00
smb2pdu.c smb: client: add new tracepoint to trace lease break notification 2025-09-02 20:37:44 -05:00
smb2pdu.h
smb2proto.h smb: client: fix data loss due to broken rename(2) 2025-09-09 18:39:58 -05:00
smb2transport.c smb: client: fix mid_q_entry memleak leak with per-mid locking 2025-08-13 11:36:05 -05:00
smbdirect.c smb: client: don't wait for info->send_pending == 0 on error 2025-08-13 11:36:12 -05:00
smbdirect.h smb: client: only use a single wait_queue to monitor smbdirect connection status 2025-08-07 12:40:11 -05:00
smbencrypt.c
smberr.h
trace.c
trace.h smb: client: fix data loss due to broken rename(2) 2025-09-09 18:39:58 -05:00
transport.c smb: client: fix mid_q_entry memleak leak with per-mid locking 2025-08-13 11:36:05 -05:00
unc.c
winucase.c
xattr.c