linux-yocto/fs/smb/client
David Howells 20d72b00ca
netfs: Fix the request's work item to not require a ref
When the netfs_io_request struct's work item is queued, it must be supplied
with a ref to the work item struct to prevent it being deallocated whilst
on the queue or whilst it is being processed.  This is tricky to manage as
we have to get a ref before we try and queue it and then we may find it's
already queued and is thus already holding a ref - in which case we have to
try and get rid of the ref again.

The problem comes if we're in BH or IRQ context and need to drop the ref:
if netfs_put_request() reduces the count to 0, we have to do the cleanup -
but the cleanup may need to wait.

Fix this by adding a new work item to the request, ->cleanup_work, and
dispatching that when the refcount hits zero.  That can then synchronously
cancel any outstanding work on the main work item before doing the cleanup.

Adding a new work item also deals with another problem upstream where it's
sometimes changing the work func in the put function and requeuing it -
which has occasionally in the past caused the cleanup to happen
incorrectly.

As a bonus, this allows us to get rid of the 'was_async' parameter from a
bunch of functions.  This indicated whether the put function might not be
permitted to sleep.

Fixes: 3d3c950467 ("netfs: Provide readahead and readpage netfs helpers")
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/20250519090707.2848510-4-dhowells@redhat.com
cc: Paulo Alcantara <pc@manguebit.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Steve French <stfrench@microsoft.com>
cc: linux-cifs@vger.kernel.org
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-05-21 14:35:20 +02:00
..
compress move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
asn1.c smb3: add support for IAKerb 2025-01-31 12:51:44 -06:00
cached_dir.c smb: Initialize cfid->tcon before performing network ops 2024-11-26 23:35:34 -06:00
cached_dir.h smb: During unmount, ensure all cached dir instances drop their dentry 2024-11-26 18:47:08 -06:00
cifs_debug.c smb3: mark compression as CONFIG_EXPERIMENTAL and fix missing compression operation 2024-09-15 10:42:44 -05:00
cifs_debug.h
cifs_fs_sb.h smb:client: smb: client: Add reverse mapping from tcon to superblocks 2025-03-31 21:12:31 -05:00
cifs_ioctl.h
cifs_spnego_negtokeninit.asn1
cifs_spnego.c smb3: add support for IAKerb 2025-01-31 12:51:44 -06:00
cifs_spnego.h
cifs_swn.c
cifs_swn.h
cifs_unicode.c cifs: Fix creating native symlinks pointing to current or parent directory 2024-10-06 22:57:12 -05:00
cifs_unicode.h
cifsacl.c cifs: add validation check for the fields in smb_aces 2025-03-26 14:51:14 -05:00
cifsacl.h smb: client: Correct typos in multiple comments across various files 2024-10-02 17:52:24 -05:00
cifsencrypt.c smb: client: parse av pair type 4 in CHALLENGE_MESSAGE 2025-01-19 19:33:59 -06:00
cifsfs.c cifs: Add new mount option -o nounicode to disable SMB1 UNICODE mode 2025-03-26 14:51:58 -05:00
cifsfs.h cifs: update internal version number 2025-04-02 20:01:14 -05:00
cifsglob.h cifs: Improve handling of NetBIOS packets 2025-04-01 01:54:17 -05:00
cifspdu.h cifs: Fix struct FILE_ALL_INFO 2025-01-31 12:51:44 -06:00
cifsproto.h netfs: Fix the request's work item to not require a ref 2025-05-21 14:35:20 +02:00
cifsroot.c
cifssmb.c netfs: Fix the request's work item to not require a ref 2025-05-21 14:35:20 +02:00
compress.c smb/client: Fix logically dead code 2024-10-16 00:30:52 -05:00
compress.h smb: client: compress: LZ77 code improvements cleanup 2024-09-15 10:42:45 -05:00
connect.c cifs: Fix negotiate retry functionality 2025-04-01 01:54:17 -05:00
dfs_cache.c smb: client: get rid of kstrdup() in get_ses_refpath() 2025-02-05 21:09:07 -06:00
dfs_cache.h
dfs.c smb: client: don't trust DFSREF_STORAGE_SERVER bit 2025-02-05 21:09:00 -06:00
dfs.h smb: client: get rid of kstrdup() in get_ses_refpath() 2025-02-05 21:09:07 -06:00
dir.c Provide stable parent and name to ->d_revalidate() instances 2025-01-30 09:13:35 -08:00
dns_resolve.c smb: client: provide dns_resolve_{unc,name} helpers 2025-01-19 19:34:00 -06:00
dns_resolve.h smb: client: provide dns_resolve_{unc,name} helpers 2025-01-19 19:34:00 -06:00
export.c
file.c netfs: Fix the request's work item to not require a ref 2025-05-21 14:35:20 +02:00
fs_context.c cifs: Allow to disable or force initialization of NetBIOS session 2025-04-01 01:54:17 -05:00
fs_context.h cifs: Allow to disable or force initialization of NetBIOS session 2025-04-01 01:54:17 -05:00
fscache.c cifs: Remove some code that's no longer used, part 1 2024-05-01 18:08:21 +01:00
fscache.h cifs: Remove some code that's no longer used, part 1 2024-05-01 18:08:21 +01:00
inode.c cifs: Remove cifs_truncate_page() as it should be superfluous 2025-04-02 20:00:39 -05:00
ioctl.c convert cifs_ioctl_copychunk() 2024-11-03 01:28:07 -05:00
Kconfig smb: client: Deduplicate "select NETFS_SUPPORT" in Kconfig 2024-12-19 09:24:35 -06:00
link.c cifs: Fix querying and creating MF symlinks over SMB1 2025-04-01 01:54:17 -05:00
Makefile smb3: mark compression as CONFIG_EXPERIMENTAL and fix missing compression operation 2024-09-15 10:42:44 -05:00
misc.c smb:client: smb: client: Add reverse mapping from tcon to superblocks 2025-03-31 21:12:31 -05:00
namespace.c smb: client: sync the root session and superblock context passwords before automounting 2025-01-10 17:55:35 -06:00
netlink.c
netlink.h
netmisc.c cifs: Change translation of STATUS_PRIVILEGE_NOT_HELD to -EPERM 2025-01-29 16:52:25 -06:00
nterr.c cifs: Change translation of STATUS_NOT_A_REPARSE_POINT to -ENODATA 2025-01-26 23:12:03 -06:00
nterr.h cifs: Change translation of STATUS_NOT_A_REPARSE_POINT to -ENODATA 2025-01-26 23:12:03 -06:00
ntlmssp.h
readdir.c cifs: Use cifs_autodisable_serverino() for disabling CIFS_MOUNT_SERVER_INUM in readdir.c 2025-01-19 19:34:00 -06:00
reparse.c cifs: Throw -EOPNOTSUPP error on unsupported reparse point type from parse_reparse_point() 2025-02-19 10:42:25 -06:00
reparse.h smb311: failure to open files of length 1040 when mounting with SMB3.1.1 POSIX extensions 2025-02-19 10:41:16 -06:00
rfc1002pdu.h cifs: Fix endian types in struct rfc1002_session_packet 2025-01-19 19:34:00 -06:00
sess.c cifs: Add new mount option -o nounicode to disable SMB1 UNICODE mode 2025-03-26 14:51:58 -05:00
smb1ops.c cifs: Implement is_network_name_deleted for SMB1 2025-04-02 20:01:14 -05:00
smb2file.c cifs: Do not add FILE_READ_ATTRIBUTES when using GENERIC_READ/EXECUTE/ALL 2025-04-01 04:58:09 -05:00
smb2glob.h cifs: Improve SMB2+ stat() to work also without FILE_READ_ATTRIBUTES 2025-04-01 04:58:05 -05:00
smb2inode.c cifs: Improve SMB2+ stat() to work also without FILE_READ_ATTRIBUTES 2025-04-01 04:58:05 -05:00
smb2maperror.c cifs: Change translation of STATUS_PRIVILEGE_NOT_HELD to -EPERM 2025-01-29 16:52:25 -06:00
smb2misc.c cifs: avoid NULL pointer dereference in dbg call 2025-03-24 09:45:07 -05:00
smb2ops.c cifs: Remove cifs_truncate_page() as it should be superfluous 2025-04-02 20:00:39 -05:00
smb2pdu.c netfs: Fix the request's work item to not require a ref 2025-05-21 14:35:20 +02:00
smb2pdu.h smb: client: correctly handle ErrorContextData as a flexible array 2025-01-19 19:34:00 -06:00
smb2proto.h smb: client: change lease epoch type from unsigned int to __u16 2025-02-06 10:01:22 -06:00
smb2transport.c smb: client: fix use-after-free of signing key 2024-11-17 22:20:54 -06:00
smbdirect.c smb: client: Correct typos in multiple comments across various files 2024-10-02 17:52:24 -05:00
smbdirect.h smb: client: Correct typos in multiple comments across various files 2024-10-02 17:52:24 -05:00
smbencrypt.c
smberr.h
trace.c
trace.h smb3: add missing tracepoint for querying wsl EAs 2025-01-19 19:34:00 -06:00
transport.c cifs: Improve handling of NetBIOS packets 2025-04-01 01:54:17 -05:00
unc.c
winucase.c
xattr.c cifs: Add a new xattr system.smb3_ntsd_owner for getting or setting owner 2025-04-01 01:54:17 -05:00