release 6.15.2 (preliminary)
This commit is contained in:
39
debian/patches/patchset-pf/nfs/0001-NFSD-unregister-filesystem-in-case-genl_register_fam.patch
vendored
Normal file
39
debian/patches/patchset-pf/nfs/0001-NFSD-unregister-filesystem-in-case-genl_register_fam.patch
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
From c207229d3f7b851d246f1904bc4cab7ae9ada58b Mon Sep 17 00:00:00 2001
|
||||
From: Maninder Singh <maninder1.s@samsung.com>
|
||||
Date: Thu, 6 Mar 2025 14:50:06 +0530
|
||||
Subject: NFSD: unregister filesystem in case genl_register_family() fails
|
||||
|
||||
With rpc_status netlink support, unregister of register_filesystem()
|
||||
was missed in case of genl_register_family() fails.
|
||||
|
||||
Correcting it by making new label.
|
||||
|
||||
Fixes: bd9d6a3efa97 ("NFSD: add rpc_status netlink support")
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
|
||||
Reviewed-by: Jeff Layton <jlayton@kernel.org>
|
||||
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
|
||||
---
|
||||
fs/nfsd/nfsctl.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/fs/nfsd/nfsctl.c
|
||||
+++ b/fs/nfsd/nfsctl.c
|
||||
@@ -2305,7 +2305,7 @@ static int __init init_nfsd(void)
|
||||
goto out_free_cld;
|
||||
retval = register_filesystem(&nfsd_fs_type);
|
||||
if (retval)
|
||||
- goto out_free_all;
|
||||
+ goto out_free_nfsd4;
|
||||
retval = genl_register_family(&nfsd_nl_family);
|
||||
if (retval)
|
||||
goto out_free_all;
|
||||
@@ -2313,6 +2313,8 @@ static int __init init_nfsd(void)
|
||||
|
||||
return 0;
|
||||
out_free_all:
|
||||
+ unregister_filesystem(&nfsd_fs_type);
|
||||
+out_free_nfsd4:
|
||||
nfsd4_destroy_laundry_wq();
|
||||
out_free_cld:
|
||||
unregister_cld_notifier();
|
162
debian/patches/patchset-pf/nfs/0002-NFSD-fix-race-between-nfsd-registration-and-exports_.patch
vendored
Normal file
162
debian/patches/patchset-pf/nfs/0002-NFSD-fix-race-between-nfsd-registration-and-exports_.patch
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
From bda3cf19bcf44807c401b807dee83aadda959287 Mon Sep 17 00:00:00 2001
|
||||
From: Maninder Singh <maninder1.s@samsung.com>
|
||||
Date: Thu, 6 Mar 2025 14:50:07 +0530
|
||||
Subject: NFSD: fix race between nfsd registration and exports_proc
|
||||
|
||||
As of now nfsd calls create_proc_exports_entry() at start of init_nfsd
|
||||
and cleanup by remove_proc_entry() at last of exit_nfsd.
|
||||
|
||||
Which causes kernel OOPs if there is race between below 2 operations:
|
||||
(i) exportfs -r
|
||||
(ii) mount -t nfsd none /proc/fs/nfsd
|
||||
|
||||
for 5.4 kernel ARM64:
|
||||
|
||||
CPU 1:
|
||||
el1_irq+0xbc/0x180
|
||||
arch_counter_get_cntvct+0x14/0x18
|
||||
running_clock+0xc/0x18
|
||||
preempt_count_add+0x88/0x110
|
||||
prep_new_page+0xb0/0x220
|
||||
get_page_from_freelist+0x2d8/0x1778
|
||||
__alloc_pages_nodemask+0x15c/0xef0
|
||||
__vmalloc_node_range+0x28c/0x478
|
||||
__vmalloc_node_flags_caller+0x8c/0xb0
|
||||
kvmalloc_node+0x88/0xe0
|
||||
nfsd_init_net+0x6c/0x108 [nfsd]
|
||||
ops_init+0x44/0x170
|
||||
register_pernet_operations+0x114/0x270
|
||||
register_pernet_subsys+0x34/0x50
|
||||
init_nfsd+0xa8/0x718 [nfsd]
|
||||
do_one_initcall+0x54/0x2e0
|
||||
|
||||
CPU 2 :
|
||||
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
|
||||
|
||||
PC is at : exports_net_open+0x50/0x68 [nfsd]
|
||||
|
||||
Call trace:
|
||||
exports_net_open+0x50/0x68 [nfsd]
|
||||
exports_proc_open+0x2c/0x38 [nfsd]
|
||||
proc_reg_open+0xb8/0x198
|
||||
do_dentry_open+0x1c4/0x418
|
||||
vfs_open+0x38/0x48
|
||||
path_openat+0x28c/0xf18
|
||||
do_filp_open+0x70/0xe8
|
||||
do_sys_open+0x154/0x248
|
||||
|
||||
Sometimes it crashes at exports_net_open() and sometimes cache_seq_next_rcu().
|
||||
|
||||
and same is happening on latest 6.14 kernel as well:
|
||||
|
||||
[ 0.000000] Linux version 6.14.0-rc5-next-20250304-dirty
|
||||
...
|
||||
[ 285.455918] Unable to handle kernel paging request at virtual address 00001f4800001f48
|
||||
...
|
||||
[ 285.464902] pc : cache_seq_next_rcu+0x78/0xa4
|
||||
...
|
||||
[ 285.469695] Call trace:
|
||||
[ 285.470083] cache_seq_next_rcu+0x78/0xa4 (P)
|
||||
[ 285.470488] seq_read+0xe0/0x11c
|
||||
[ 285.470675] proc_reg_read+0x9c/0xf0
|
||||
[ 285.470874] vfs_read+0xc4/0x2fc
|
||||
[ 285.471057] ksys_read+0x6c/0xf4
|
||||
[ 285.471231] __arm64_sys_read+0x1c/0x28
|
||||
[ 285.471428] invoke_syscall+0x44/0x100
|
||||
[ 285.471633] el0_svc_common.constprop.0+0x40/0xe0
|
||||
[ 285.471870] do_el0_svc_compat+0x1c/0x34
|
||||
[ 285.472073] el0_svc_compat+0x2c/0x80
|
||||
[ 285.472265] el0t_32_sync_handler+0x90/0x140
|
||||
[ 285.472473] el0t_32_sync+0x19c/0x1a0
|
||||
[ 285.472887] Code: f9400885 93407c23 937d7c27 11000421 (f86378a3)
|
||||
[ 285.473422] ---[ end trace 0000000000000000 ]---
|
||||
|
||||
It reproduced simply with below script:
|
||||
while [ 1 ]
|
||||
do
|
||||
/exportfs -r
|
||||
done &
|
||||
|
||||
while [ 1 ]
|
||||
do
|
||||
insmod /nfsd.ko
|
||||
mount -t nfsd none /proc/fs/nfsd
|
||||
umount /proc/fs/nfsd
|
||||
rmmod nfsd
|
||||
done &
|
||||
|
||||
So exporting interfaces to user space shall be done at last and
|
||||
cleanup at first place.
|
||||
|
||||
With change there is no Kernel OOPs.
|
||||
|
||||
Co-developed-by: Shubham Rana <s9.rana@samsung.com>
|
||||
Signed-off-by: Shubham Rana <s9.rana@samsung.com>
|
||||
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
|
||||
Reviewed-by: Jeff Layton <jlayton@kernel.org>
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
|
||||
---
|
||||
fs/nfsd/nfsctl.c | 17 ++++++++---------
|
||||
1 file changed, 8 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/fs/nfsd/nfsctl.c
|
||||
+++ b/fs/nfsd/nfsctl.c
|
||||
@@ -2291,12 +2291,9 @@ static int __init init_nfsd(void)
|
||||
if (retval)
|
||||
goto out_free_pnfs;
|
||||
nfsd_lockd_init(); /* lockd->nfsd callbacks */
|
||||
- retval = create_proc_exports_entry();
|
||||
- if (retval)
|
||||
- goto out_free_lockd;
|
||||
retval = register_pernet_subsys(&nfsd_net_ops);
|
||||
if (retval < 0)
|
||||
- goto out_free_exports;
|
||||
+ goto out_free_lockd;
|
||||
retval = register_cld_notifier();
|
||||
if (retval)
|
||||
goto out_free_subsys;
|
||||
@@ -2308,11 +2305,16 @@ static int __init init_nfsd(void)
|
||||
goto out_free_nfsd4;
|
||||
retval = genl_register_family(&nfsd_nl_family);
|
||||
if (retval)
|
||||
+ goto out_free_filesystem;
|
||||
+ retval = create_proc_exports_entry();
|
||||
+ if (retval)
|
||||
goto out_free_all;
|
||||
nfsd_localio_ops_init();
|
||||
|
||||
return 0;
|
||||
out_free_all:
|
||||
+ genl_unregister_family(&nfsd_nl_family);
|
||||
+out_free_filesystem:
|
||||
unregister_filesystem(&nfsd_fs_type);
|
||||
out_free_nfsd4:
|
||||
nfsd4_destroy_laundry_wq();
|
||||
@@ -2320,9 +2322,6 @@ out_free_cld:
|
||||
unregister_cld_notifier();
|
||||
out_free_subsys:
|
||||
unregister_pernet_subsys(&nfsd_net_ops);
|
||||
-out_free_exports:
|
||||
- remove_proc_entry("fs/nfs/exports", NULL);
|
||||
- remove_proc_entry("fs/nfs", NULL);
|
||||
out_free_lockd:
|
||||
nfsd_lockd_shutdown();
|
||||
nfsd_drc_slab_free();
|
||||
@@ -2335,14 +2334,14 @@ out_free_slabs:
|
||||
|
||||
static void __exit exit_nfsd(void)
|
||||
{
|
||||
+ remove_proc_entry("fs/nfs/exports", NULL);
|
||||
+ remove_proc_entry("fs/nfs", NULL);
|
||||
genl_unregister_family(&nfsd_nl_family);
|
||||
unregister_filesystem(&nfsd_fs_type);
|
||||
nfsd4_destroy_laundry_wq();
|
||||
unregister_cld_notifier();
|
||||
unregister_pernet_subsys(&nfsd_net_ops);
|
||||
nfsd_drc_slab_free();
|
||||
- remove_proc_entry("fs/nfs/exports", NULL);
|
||||
- remove_proc_entry("fs/nfs", NULL);
|
||||
nfsd_lockd_shutdown();
|
||||
nfsd4_free_slabs();
|
||||
nfsd4_exit_pnfs();
|
35
debian/patches/patchset-pf/nfs/0003-nfsd-fix-access-checking-for-NLM-under-XPRTSEC-polic.patch
vendored
Normal file
35
debian/patches/patchset-pf/nfs/0003-nfsd-fix-access-checking-for-NLM-under-XPRTSEC-polic.patch
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
From b9293b51ea6182618e474edfbeb5cd34f5e875e8 Mon Sep 17 00:00:00 2001
|
||||
From: Olga Kornievskaia <okorniev@redhat.com>
|
||||
Date: Fri, 21 Mar 2025 20:13:04 -0400
|
||||
Subject: nfsd: fix access checking for NLM under XPRTSEC policies
|
||||
|
||||
When an export policy with xprtsec policy is set with "tls"
|
||||
and/or "mtls", but an NFS client is doing a v3 xprtsec=tls
|
||||
mount, then NLM locking calls fail with an error because
|
||||
there is currently no support for NLM with TLS.
|
||||
|
||||
Until such support is added, allow NLM calls under TLS-secured
|
||||
policy.
|
||||
|
||||
Fixes: 4cc9b9f2bf4d ("nfsd: refine and rename NFSD_MAY_LOCK")
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
|
||||
Reviewed-by: NeilBrown <neil@brown.name>
|
||||
Reviewed-by: Jeff Layton <jlayton@kernel.org>
|
||||
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
|
||||
---
|
||||
fs/nfsd/export.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/fs/nfsd/export.c
|
||||
+++ b/fs/nfsd/export.c
|
||||
@@ -1124,7 +1124,8 @@ __be32 check_nfsd_access(struct svc_expo
|
||||
test_bit(XPT_PEER_AUTH, &xprt->xpt_flags))
|
||||
goto ok;
|
||||
}
|
||||
- goto denied;
|
||||
+ if (!may_bypass_gss)
|
||||
+ goto denied;
|
||||
|
||||
ok:
|
||||
/* legacy gss-only clients are always OK: */
|
32
debian/patches/patchset-pf/nfs/0004-nfsd-nfsd4_spo_must_allow-must-check-this-is-a-v4-co.patch
vendored
Normal file
32
debian/patches/patchset-pf/nfs/0004-nfsd-nfsd4_spo_must_allow-must-check-this-is-a-v4-co.patch
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
From 778e820deed49a0dee6115c0aa903e626ab635f6 Mon Sep 17 00:00:00 2001
|
||||
From: NeilBrown <neil@brown.name>
|
||||
Date: Fri, 28 Mar 2025 11:05:59 +1100
|
||||
Subject: nfsd: nfsd4_spo_must_allow() must check this is a v4 compound request
|
||||
|
||||
If the request being processed is not a v4 compound request, then
|
||||
examining the cstate can have undefined results.
|
||||
|
||||
This patch adds a check that the rpc procedure being executed
|
||||
(rq_procinfo) is the NFSPROC4_COMPOUND procedure.
|
||||
|
||||
Reported-by: Olga Kornievskaia <okorniev@redhat.com>
|
||||
Cc: stable@vger.kernel.org
|
||||
Reviewed-by: Jeff Layton <jlayton@kernel.org>
|
||||
Signed-off-by: NeilBrown <neil@brown.name>
|
||||
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
|
||||
---
|
||||
fs/nfsd/nfs4proc.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/fs/nfsd/nfs4proc.c
|
||||
+++ b/fs/nfsd/nfs4proc.c
|
||||
@@ -3766,7 +3766,8 @@ bool nfsd4_spo_must_allow(struct svc_rqs
|
||||
struct nfs4_op_map *allow = &cstate->clp->cl_spo_must_allow;
|
||||
u32 opiter;
|
||||
|
||||
- if (!cstate->minorversion)
|
||||
+ if (rqstp->rq_procinfo != &nfsd_version4.vs_proc[NFSPROC4_COMPOUND] ||
|
||||
+ cstate->minorversion == 0)
|
||||
return false;
|
||||
|
||||
if (cstate->spo_must_allowed)
|
47
debian/patches/patchset-pf/nfs/0005-nfsd-Initialize-ssc-before-laundromat_work-to-preven.patch
vendored
Normal file
47
debian/patches/patchset-pf/nfs/0005-nfsd-Initialize-ssc-before-laundromat_work-to-preven.patch
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
From 8a7faf80fbb9ecdea403cb4f882354e8a5201acb Mon Sep 17 00:00:00 2001
|
||||
From: Li Lingfeng <lilingfeng3@huawei.com>
|
||||
Date: Mon, 14 Apr 2025 22:38:52 +0800
|
||||
Subject: nfsd: Initialize ssc before laundromat_work to prevent NULL
|
||||
dereference
|
||||
|
||||
In nfs4_state_start_net(), laundromat_work may access nfsd_ssc through
|
||||
nfs4_laundromat -> nfsd4_ssc_expire_umount. If nfsd_ssc isn't initialized,
|
||||
this can cause NULL pointer dereference.
|
||||
|
||||
Normally the delayed start of laundromat_work allows sufficient time for
|
||||
nfsd_ssc initialization to complete. However, when the kernel waits too
|
||||
long for userspace responses (e.g. in nfs4_state_start_net ->
|
||||
nfsd4_end_grace -> nfsd4_record_grace_done -> nfsd4_cld_grace_done ->
|
||||
cld_pipe_upcall -> __cld_pipe_upcall -> wait_for_completion path), the
|
||||
delayed work may start before nfsd_ssc initialization finishes.
|
||||
|
||||
Fix this by moving nfsd_ssc initialization before starting laundromat_work.
|
||||
|
||||
Fixes: f4e44b393389 ("NFSD: delay unmount source's export after inter-server copy completed.")
|
||||
Cc: stable@vger.kernel.org
|
||||
Reviewed-by: Jeff Layton <jlayton@kernel.org>
|
||||
Signed-off-by: Li Lingfeng <lilingfeng3@huawei.com>
|
||||
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
|
||||
---
|
||||
fs/nfsd/nfssvc.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/fs/nfsd/nfssvc.c
|
||||
+++ b/fs/nfsd/nfssvc.c
|
||||
@@ -396,13 +396,13 @@ static int nfsd_startup_net(struct net *
|
||||
if (ret)
|
||||
goto out_filecache;
|
||||
|
||||
+#ifdef CONFIG_NFSD_V4_2_INTER_SSC
|
||||
+ nfsd4_ssc_init_umount_work(nn);
|
||||
+#endif
|
||||
ret = nfs4_state_start_net(net);
|
||||
if (ret)
|
||||
goto out_reply_cache;
|
||||
|
||||
-#ifdef CONFIG_NFSD_V4_2_INTER_SSC
|
||||
- nfsd4_ssc_init_umount_work(nn);
|
||||
-#endif
|
||||
nn->nfsd_net_up = true;
|
||||
return 0;
|
||||
|
62
debian/patches/patchset-pf/nfs/0006-NFSD-Implement-FATTR4_CLONE_BLKSIZE-attribute.patch
vendored
Normal file
62
debian/patches/patchset-pf/nfs/0006-NFSD-Implement-FATTR4_CLONE_BLKSIZE-attribute.patch
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
From 12e39177848d11c6ac5ad70ce530364fac7f36d3 Mon Sep 17 00:00:00 2001
|
||||
From: Chuck Lever <chuck.lever@oracle.com>
|
||||
Date: Wed, 7 May 2025 10:45:15 -0400
|
||||
Subject: NFSD: Implement FATTR4_CLONE_BLKSIZE attribute
|
||||
|
||||
RFC 7862 states that if an NFS server implements a CLONE operation,
|
||||
it MUST also implement FATTR4_CLONE_BLKSIZE. NFSD implements CLONE,
|
||||
but does not implement FATTR4_CLONE_BLKSIZE.
|
||||
|
||||
Note that in Section 12.2, RFC 7862 claims that
|
||||
FATTR4_CLONE_BLKSIZE is RECOMMENDED, not REQUIRED. Likely this is
|
||||
because a minor version is not permitted to add a REQUIRED
|
||||
attribute. Confusing.
|
||||
|
||||
We assume this attribute reports a block size as a count of bytes,
|
||||
as RFC 7862 does not specify a unit.
|
||||
|
||||
Reported-by: Roland Mainz <roland.mainz@nrubsig.org>
|
||||
Suggested-by: Christoph Hellwig <hch@infradead.org>
|
||||
Reviewed-by: Roland Mainz <roland.mainz@nrubsig.org>
|
||||
Cc: stable@vger.kernel.org # v6.7+
|
||||
Reviewed-by: Jeff Layton <jlayton@kernel.org>
|
||||
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
|
||||
---
|
||||
fs/nfsd/nfs4xdr.c | 19 ++++++++++++++++++-
|
||||
1 file changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/fs/nfsd/nfs4xdr.c
|
||||
+++ b/fs/nfsd/nfs4xdr.c
|
||||
@@ -3391,6 +3391,23 @@ static __be32 nfsd4_encode_fattr4_suppat
|
||||
return nfsd4_encode_bitmap4(xdr, supp[0], supp[1], supp[2]);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Copied from generic_remap_checks/generic_remap_file_range_prep.
|
||||
+ *
|
||||
+ * These generic functions use the file system's s_blocksize, but
|
||||
+ * individual file systems aren't required to use
|
||||
+ * generic_remap_file_range_prep. Until there is a mechanism for
|
||||
+ * determining a particular file system's (or file's) clone block
|
||||
+ * size, this is the best NFSD can do.
|
||||
+ */
|
||||
+static __be32 nfsd4_encode_fattr4_clone_blksize(struct xdr_stream *xdr,
|
||||
+ const struct nfsd4_fattr_args *args)
|
||||
+{
|
||||
+ struct inode *inode = d_inode(args->dentry);
|
||||
+
|
||||
+ return nfsd4_encode_uint32_t(xdr, inode->i_sb->s_blocksize);
|
||||
+}
|
||||
+
|
||||
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
|
||||
static __be32 nfsd4_encode_fattr4_sec_label(struct xdr_stream *xdr,
|
||||
const struct nfsd4_fattr_args *args)
|
||||
@@ -3545,7 +3562,7 @@ static const nfsd4_enc_attr nfsd4_enc_fa
|
||||
[FATTR4_MODE_SET_MASKED] = nfsd4_encode_fattr4__noop,
|
||||
[FATTR4_SUPPATTR_EXCLCREAT] = nfsd4_encode_fattr4_suppattr_exclcreat,
|
||||
[FATTR4_FS_CHARSET_CAP] = nfsd4_encode_fattr4__noop,
|
||||
- [FATTR4_CLONE_BLKSIZE] = nfsd4_encode_fattr4__noop,
|
||||
+ [FATTR4_CLONE_BLKSIZE] = nfsd4_encode_fattr4_clone_blksize,
|
||||
[FATTR4_SPACE_FREED] = nfsd4_encode_fattr4__noop,
|
||||
[FATTR4_CHANGE_ATTR_TYPE] = nfsd4_encode_fattr4__noop,
|
||||
|
65
debian/patches/patchset-pf/nfs/0007-fs-nfs-read-fix-double-unlock-bug-in-nfs_return_empt.patch
vendored
Normal file
65
debian/patches/patchset-pf/nfs/0007-fs-nfs-read-fix-double-unlock-bug-in-nfs_return_empt.patch
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
From 2623f0468759aba585c7ae86adc1cf1cb11e1b63 Mon Sep 17 00:00:00 2001
|
||||
From: Max Kellermann <max.kellermann@ionos.com>
|
||||
Date: Wed, 23 Apr 2025 15:22:50 +0200
|
||||
Subject: fs/nfs/read: fix double-unlock bug in nfs_return_empty_folio()
|
||||
|
||||
Sometimes, when a file was read while it was being truncated by
|
||||
another NFS client, the kernel could deadlock because folio_unlock()
|
||||
was called twice, and the second call would XOR back the `PG_locked`
|
||||
flag.
|
||||
|
||||
Most of the time (depending on the timing of the truncation), nobody
|
||||
notices the problem because folio_unlock() gets called three times,
|
||||
which flips `PG_locked` back off:
|
||||
|
||||
1. vfs_read, nfs_read_folio, ... nfs_read_add_folio,
|
||||
nfs_return_empty_folio
|
||||
2. vfs_read, nfs_read_folio, ... netfs_read_collection,
|
||||
netfs_unlock_abandoned_read_pages
|
||||
3. vfs_read, ... nfs_do_read_folio, nfs_read_add_folio,
|
||||
nfs_return_empty_folio
|
||||
|
||||
The problem is that nfs_read_add_folio() is not supposed to unlock the
|
||||
folio if fscache is enabled, and a nfs_netfs_folio_unlock() check is
|
||||
missing in nfs_return_empty_folio().
|
||||
|
||||
Rarely this leads to a warning in netfs_read_collection():
|
||||
|
||||
------------[ cut here ]------------
|
||||
R=0000031c: folio 10 is not locked
|
||||
WARNING: CPU: 0 PID: 29 at fs/netfs/read_collect.c:133 netfs_read_collection+0x7c0/0xf00
|
||||
[...]
|
||||
Workqueue: events_unbound netfs_read_collection_worker
|
||||
RIP: 0010:netfs_read_collection+0x7c0/0xf00
|
||||
[...]
|
||||
Call Trace:
|
||||
<TASK>
|
||||
netfs_read_collection_worker+0x67/0x80
|
||||
process_one_work+0x12e/0x2c0
|
||||
worker_thread+0x295/0x3a0
|
||||
|
||||
Most of the time, however, processes just get stuck forever in
|
||||
folio_wait_bit_common(), waiting for `PG_locked` to disappear, which
|
||||
never happens because nobody is really holding the folio lock.
|
||||
|
||||
Fixes: 000dbe0bec05 ("NFS: Convert buffered read paths to use netfs when fscache is enabled")
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
|
||||
Reviewed-by: Dave Wysochanski <dwysocha@redhat.com>
|
||||
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
|
||||
---
|
||||
fs/nfs/read.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/fs/nfs/read.c
|
||||
+++ b/fs/nfs/read.c
|
||||
@@ -56,7 +56,8 @@ static int nfs_return_empty_folio(struct
|
||||
{
|
||||
folio_zero_segment(folio, 0, folio_size(folio));
|
||||
folio_mark_uptodate(folio);
|
||||
- folio_unlock(folio);
|
||||
+ if (nfs_netfs_folio_unlock(folio))
|
||||
+ folio_unlock(folio);
|
||||
return 0;
|
||||
}
|
||||
|
32
debian/patches/patchset-pf/nfs/0008-NFSv4-Don-t-check-for-OPEN-feature-support-in-v4.1.patch
vendored
Normal file
32
debian/patches/patchset-pf/nfs/0008-NFSv4-Don-t-check-for-OPEN-feature-support-in-v4.1.patch
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
From d87e5957afccde6cc0719ab0a554757dcafa85ce Mon Sep 17 00:00:00 2001
|
||||
From: Scott Mayhew <smayhew@redhat.com>
|
||||
Date: Wed, 30 Apr 2025 07:12:29 -0400
|
||||
Subject: NFSv4: Don't check for OPEN feature support in v4.1
|
||||
|
||||
fattr4_open_arguments is a v4.2 recommended attribute, so we shouldn't
|
||||
be sending it to v4.1 servers.
|
||||
|
||||
Fixes: cb78f9b7d0c0 ("nfs: fix the fetch of FATTR4_OPEN_ARGUMENTS")
|
||||
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
|
||||
Reviewed-by: Jeff Layton <jlayton@kernel.org>
|
||||
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
|
||||
Cc: stable@vger.kernel.org # 6.11+
|
||||
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
|
||||
---
|
||||
fs/nfs/nfs4proc.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/fs/nfs/nfs4proc.c
|
||||
+++ b/fs/nfs/nfs4proc.c
|
||||
@@ -3976,8 +3976,9 @@ static int _nfs4_server_capabilities(str
|
||||
FATTR4_WORD0_CASE_INSENSITIVE |
|
||||
FATTR4_WORD0_CASE_PRESERVING;
|
||||
if (minorversion)
|
||||
- bitmask[2] = FATTR4_WORD2_SUPPATTR_EXCLCREAT |
|
||||
- FATTR4_WORD2_OPEN_ARGUMENTS;
|
||||
+ bitmask[2] = FATTR4_WORD2_SUPPATTR_EXCLCREAT;
|
||||
+ if (minorversion > 1)
|
||||
+ bitmask[2] |= FATTR4_WORD2_OPEN_ARGUMENTS;
|
||||
|
||||
status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
|
||||
if (status == 0) {
|
96
debian/patches/patchset-pf/nfs/0009-NFS-always-probe-for-LOCALIO-support-asynchronously.patch
vendored
Normal file
96
debian/patches/patchset-pf/nfs/0009-NFS-always-probe-for-LOCALIO-support-asynchronously.patch
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
From 9e7464ef730cfe5bbab845ff12b295575d874216 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Snitzer <snitzer@kernel.org>
|
||||
Date: Tue, 13 May 2025 12:08:31 -0400
|
||||
Subject: NFS: always probe for LOCALIO support asynchronously
|
||||
|
||||
It was reported that NFS client mounts of AWS Elastic File System
|
||||
(EFS) volumes is slow, this is because the AWS firewall disallows
|
||||
LOCALIO (because it doesn't consider the use of NFS_LOCALIO_PROGRAM
|
||||
valid), see: https://bugzilla.redhat.com/show_bug.cgi?id=2335129
|
||||
|
||||
Switch to performing the LOCALIO probe asynchronously to address the
|
||||
potential for the NFS LOCALIO protocol being disallowed and/or slowed
|
||||
by the remote server's response.
|
||||
|
||||
While at it, fix nfs_local_probe_async() to always take/put a
|
||||
reference on the nfs_client that is using the LOCALIO protocol.
|
||||
Also, unexport the nfs_local_probe() symbol and make it private to
|
||||
fs/nfs/localio.c
|
||||
|
||||
This change has the side-effect of initially issuing reads, writes and
|
||||
commits over the wire via SUNRPC until the LOCALIO probe completes.
|
||||
|
||||
Suggested-by: Jeff Layton <jlayton@kernel.org> # to always probe async
|
||||
Fixes: 76d4cb6345da ("nfs: probe for LOCALIO when v4 client reconnects to server")
|
||||
Cc: stable@vger.kernel.org # 6.14+
|
||||
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
|
||||
Reviewed-by: Jeff Layton <jlayton@kernel.org>
|
||||
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
|
||||
---
|
||||
fs/nfs/client.c | 2 +-
|
||||
fs/nfs/flexfilelayout/flexfilelayoutdev.c | 2 +-
|
||||
fs/nfs/internal.h | 1 -
|
||||
fs/nfs/localio.c | 6 ++++--
|
||||
4 files changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/fs/nfs/client.c
|
||||
+++ b/fs/nfs/client.c
|
||||
@@ -439,7 +439,7 @@ struct nfs_client *nfs_get_client(const
|
||||
spin_unlock(&nn->nfs_client_lock);
|
||||
new = rpc_ops->init_client(new, cl_init);
|
||||
if (!IS_ERR(new))
|
||||
- nfs_local_probe(new);
|
||||
+ nfs_local_probe_async(new);
|
||||
return new;
|
||||
}
|
||||
|
||||
--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
|
||||
+++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
|
||||
@@ -400,7 +400,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_la
|
||||
* keep ds_clp even if DS is local, so that if local IO cannot
|
||||
* proceed somehow, we can fall back to NFS whenever we want.
|
||||
*/
|
||||
- nfs_local_probe(ds->ds_clp);
|
||||
+ nfs_local_probe_async(ds->ds_clp);
|
||||
max_payload =
|
||||
nfs_block_size(rpc_max_payload(ds->ds_clp->cl_rpcclient),
|
||||
NULL);
|
||||
--- a/fs/nfs/internal.h
|
||||
+++ b/fs/nfs/internal.h
|
||||
@@ -455,7 +455,6 @@ extern int nfs_wait_bit_killable(struct
|
||||
|
||||
#if IS_ENABLED(CONFIG_NFS_LOCALIO)
|
||||
/* localio.c */
|
||||
-extern void nfs_local_probe(struct nfs_client *);
|
||||
extern void nfs_local_probe_async(struct nfs_client *);
|
||||
extern void nfs_local_probe_async_work(struct work_struct *);
|
||||
extern struct nfsd_file *nfs_local_open_fh(struct nfs_client *,
|
||||
--- a/fs/nfs/localio.c
|
||||
+++ b/fs/nfs/localio.c
|
||||
@@ -171,7 +171,7 @@ static bool nfs_server_uuid_is_local(str
|
||||
* - called after alloc_client and init_client (so cl_rpcclient exists)
|
||||
* - this function is idempotent, it can be called for old or new clients
|
||||
*/
|
||||
-void nfs_local_probe(struct nfs_client *clp)
|
||||
+static void nfs_local_probe(struct nfs_client *clp)
|
||||
{
|
||||
/* Disallow localio if disabled via sysfs or AUTH_SYS isn't used */
|
||||
if (!localio_enabled ||
|
||||
@@ -191,14 +191,16 @@ void nfs_local_probe(struct nfs_client *
|
||||
nfs_localio_enable_client(clp);
|
||||
nfs_uuid_end(&clp->cl_uuid);
|
||||
}
|
||||
-EXPORT_SYMBOL_GPL(nfs_local_probe);
|
||||
|
||||
void nfs_local_probe_async_work(struct work_struct *work)
|
||||
{
|
||||
struct nfs_client *clp =
|
||||
container_of(work, struct nfs_client, cl_local_probe_work);
|
||||
|
||||
+ if (!refcount_inc_not_zero(&clp->cl_count))
|
||||
+ return;
|
||||
nfs_local_probe(clp);
|
||||
+ nfs_put_client(clp);
|
||||
}
|
||||
|
||||
void nfs_local_probe_async(struct nfs_client *clp)
|
Reference in New Issue
Block a user