public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Yang Erkun <yangerkun@huawei.com>,
	Chuck Lever <chuck.lever@oracle.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.6 09/86] nfsd: Revert "nfsd: release svc_expkey/svc_export with rcu_work"
Date: Mon, 30 Dec 2024 16:42:17 +0100	[thread overview]
Message-ID: <20241230154212.068887587@linuxfoundation.org> (raw)
In-Reply-To: <20241230154211.711515682@linuxfoundation.org>

6.6-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Yang Erkun <yangerkun@huawei.com>

[ Upstream commit 69d803c40edeaf94089fbc8751c9b746cdc35044 ]

This reverts commit f8c989a0c89a75d30f899a7cabdc14d72522bb8d.

Before this commit, svc_export_put or expkey_put will call path_put with
sync mode. After this commit, path_put will be called with async mode.
And this can lead the unexpected results show as follow.

mkfs.xfs -f /dev/sda
echo "/ *(rw,no_root_squash,fsid=0)" > /etc/exports
echo "/mnt *(rw,no_root_squash,fsid=1)" >> /etc/exports
exportfs -ra
service nfs-server start
mount -t nfs -o vers=4.0 127.0.0.1:/mnt /mnt1
mount /dev/sda /mnt/sda
touch /mnt1/sda/file
exportfs -r
umount /mnt/sda # failed unexcepted

The touch will finally call nfsd_cross_mnt, add refcount to mount, and
then add cache_head. Before this commit, exportfs -r will call
cache_flush to cleanup all cache_head, and path_put in
svc_export_put/expkey_put will be finished with sync mode. So, the
latter umount will always success. However, after this commit, path_put
will be called with async mode, the latter umount may failed, and if
we add some delay, umount will success too. Personally I think this bug
and should be fixed. We first revert before bugfix patch, and then fix
the original bug with a different way.

Fixes: f8c989a0c89a ("nfsd: release svc_expkey/svc_export with rcu_work")
Signed-off-by: Yang Erkun <yangerkun@huawei.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/nfsd/export.c | 31 ++++++-------------------------
 fs/nfsd/export.h |  4 ++--
 2 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index d4d3ec58047e..4b5d998cbc2f 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -40,24 +40,15 @@
 #define	EXPKEY_HASHMAX		(1 << EXPKEY_HASHBITS)
 #define	EXPKEY_HASHMASK		(EXPKEY_HASHMAX -1)
 
-static void expkey_put_work(struct work_struct *work)
+static void expkey_put(struct kref *ref)
 {
-	struct svc_expkey *key =
-		container_of(to_rcu_work(work), struct svc_expkey, ek_rcu_work);
+	struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref);
 
 	if (test_bit(CACHE_VALID, &key->h.flags) &&
 	    !test_bit(CACHE_NEGATIVE, &key->h.flags))
 		path_put(&key->ek_path);
 	auth_domain_put(key->ek_client);
-	kfree(key);
-}
-
-static void expkey_put(struct kref *ref)
-{
-	struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref);
-
-	INIT_RCU_WORK(&key->ek_rcu_work, expkey_put_work);
-	queue_rcu_work(system_wq, &key->ek_rcu_work);
+	kfree_rcu(key, ek_rcu);
 }
 
 static int expkey_upcall(struct cache_detail *cd, struct cache_head *h)
@@ -360,26 +351,16 @@ static void export_stats_destroy(struct export_stats *stats)
 					     EXP_STATS_COUNTERS_NUM);
 }
 
-static void svc_export_put_work(struct work_struct *work)
+static void svc_export_put(struct kref *ref)
 {
-	struct svc_export *exp =
-		container_of(to_rcu_work(work), struct svc_export, ex_rcu_work);
-
+	struct svc_export *exp = container_of(ref, struct svc_export, h.ref);
 	path_put(&exp->ex_path);
 	auth_domain_put(exp->ex_client);
 	nfsd4_fslocs_free(&exp->ex_fslocs);
 	export_stats_destroy(exp->ex_stats);
 	kfree(exp->ex_stats);
 	kfree(exp->ex_uuid);
-	kfree(exp);
-}
-
-static void svc_export_put(struct kref *ref)
-{
-	struct svc_export *exp = container_of(ref, struct svc_export, h.ref);
-
-	INIT_RCU_WORK(&exp->ex_rcu_work, svc_export_put_work);
-	queue_rcu_work(system_wq, &exp->ex_rcu_work);
+	kfree_rcu(exp, ex_rcu);
 }
 
 static int svc_export_upcall(struct cache_detail *cd, struct cache_head *h)
diff --git a/fs/nfsd/export.h b/fs/nfsd/export.h
index 9d895570ceba..ca9dc230ae3d 100644
--- a/fs/nfsd/export.h
+++ b/fs/nfsd/export.h
@@ -75,7 +75,7 @@ struct svc_export {
 	u32			ex_layout_types;
 	struct nfsd4_deviceid_map *ex_devid_map;
 	struct cache_detail	*cd;
-	struct rcu_work		ex_rcu_work;
+	struct rcu_head		ex_rcu;
 	unsigned long		ex_xprtsec_modes;
 	struct export_stats	*ex_stats;
 };
@@ -92,7 +92,7 @@ struct svc_expkey {
 	u32			ek_fsid[6];
 
 	struct path		ek_path;
-	struct rcu_work		ek_rcu_work;
+	struct rcu_head		ek_rcu;
 };
 
 #define EX_ISSYNC(exp)		(!((exp)->ex_flags & NFSEXP_ASYNC))
-- 
2.39.5




  parent reply	other threads:[~2024-12-30 15:49 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-30 15:42 [PATCH 6.6 00/86] 6.6.69-rc1 review Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 01/86] media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 02/86] ceph: try to allocate a smaller extent map for sparse read Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 03/86] ceph: fix memory leak in ceph_direct_read_write() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 04/86] ceph: allocate sparse_ext map only for sparse reads Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 05/86] mm/vmstat: fix a W=1 clang compiler warning Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 06/86] tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 07/86] tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 08/86] bpf: Check negative offsets in __bpf_skb_min_len() Greg Kroah-Hartman
2024-12-30 15:42 ` Greg Kroah-Hartman [this message]
2024-12-30 15:42 ` [PATCH 6.6 10/86] nfsd: restore callback functionality for NFSv4.0 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 11/86] mtd: diskonchip: Cast an operand to prevent potential overflow Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 12/86] mtd: rawnand: arasan: Fix double assertion of chip-select Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 13/86] mtd: rawnand: arasan: Fix missing de-registration of NAND Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 14/86] phy: qcom-qmp: Fix register name in RX Lane config of SC8280XP Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 15/86] phy: core: Fix an OF node refcount leakage in _of_phy_get() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 16/86] phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 17/86] phy: core: Fix that API devm_phy_put() fails to release the phy Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 18/86] phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 19/86] phy: core: Fix that API devm_phy_destroy() fails to destroy the phy Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 20/86] phy: usb: Toggle the PHY power during init Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 21/86] phy: rockchip: naneng-combphy: fix phy reset Greg Kroah-Hartman
2025-01-29 13:27   ` [REGRESSION] USB 3 and PCIe broken on rk356x due to missing " Jan Čermák
2025-01-29 13:36     ` Greg Kroah-Hartman
2025-01-29 13:50       ` Jan Čermák
2025-01-29 13:55       ` Heiko Stübner
2025-01-29 18:41         ` Vinod Koul
2025-01-29 21:06           ` Heiko Stübner
2024-12-30 15:42 ` [PATCH 6.6 22/86] dmaengine: mv_xor: fix child node refcount handling in early exit Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 23/86] dmaengine: dw: Select only supported masters for ACPI devices Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 24/86] dmaengine: tegra: Return correct DMA status when paused Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 25/86] dmaengine: fsl-edma: implement the cleanup path of fsl_edma3_attach_pd() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 26/86] dmaengine: apple-admac: Avoid accessing registers in probe Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 27/86] dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 28/86] mtd: rawnand: fix double free in atmel_pmecc_create_user() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 29/86] powerpc/pseries/vas: Add close() callback in vas_vm_ops struct Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 30/86] stddef: make __struct_group() UAPI C++-friendly Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 31/86] tracing/kprobe: Make trace_kprobes module callback called after jump_label update Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 32/86] watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 33/86] watchdog: mediatek: Add support for MT6735 TOPRGU/WDT Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 34/86] scsi: qla1280: Fix hw revision numbering for ISP1020/1040 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 35/86] scsi: megaraid_sas: Fix for a potential deadlock Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 36/86] udf: Skip parent dir link count update if corrupted Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 37/86] ALSA: hda/conexant: fix Z60MR100 startup pop issue Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 38/86] ALSA: sh: Use standard helper for buffer accesses Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 39/86] smb: server: Fix building with GCC 15 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 40/86] regmap: Use correct format specifier for logging range errors Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 41/86] LoongArch: Fix reserving screen info memory for above-4G firmware Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 42/86] LoongArch: BPF: Adjust the parameter of emit_jirl() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 43/86] platform/x86: asus-nb-wmi: Ignore unknown event 0xCF Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 44/86] spi: intel: Add Panther Lake SPI controller support Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 45/86] scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 46/86] scsi: storvsc: Do not flag MAINTENANCE_IN return of SRB_STATUS_DATA_OVERRUN as an error Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 47/86] spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 48/86] drm/dp_mst: Ensure mst_primary pointer is valid in drm_dp_mst_handle_up_req() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 49/86] virtio-blk: dont keep queue frozen during system suspend Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 50/86] blk-mq: register cpuhp callback after hctx is added to xarray table Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.6 51/86] blk-mq: move cpuhp callback registering out of q->sysfs_lock Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 52/86] MIPS: Probe toolchain support of -msym32 Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 53/86] MIPS: mipsregs: Set proper ISA level for virt extensions Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 54/86] sched/task_stack: fix object_is_on_stack() for KASAN tagged pointers Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 55/86] ALSA: hda/realtek: fix mute/micmute LEDs dont work for EliteBook X G1i Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 56/86] ALSA: hda/realtek: fix micmute LEDs dont work on HP Laptops Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 57/86] pmdomain: core: Add missing put_device() Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 58/86] drm/amd/amdgpu: allow use kiq to do hdp flush under sriov Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 59/86] drm/amdgpu/hdp4.0: do a posting read when flushing HDP Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 60/86] drm/amdgpu/hdp5.0: " Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 61/86] drm/amdgpu/hdp6.0: " Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 62/86] x86/cpu: Add model number for Intel Clearwater Forest processor Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 63/86] x86/cpu: Add model number for another Intel Arrow Lake mobile processor Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 64/86] x86/cpu/vfm: Add/initialize x86_vfm field to struct cpuinfo_x86 Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 65/86] x86/cpu/vfm: Update arch/x86/include/asm/intel-family.h Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 66/86] x86/cpu/intel: Switch to new Intel CPU model defines Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 67/86] x86/cpu: Add Lunar Lake to list of CPUs with a broken MONITOR implementation Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 68/86] drm/amdkfd: reduce stack size in kfd_topology_add_device() Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 69/86] drm/amdkfd: drop struct kfd_cu_info Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 70/86] drm/amdkfd: Use device based logging for errors Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 71/86] drm/amdkfd: pause autosuspend when creating pdd Greg Kroah-Hartman
2024-12-30 16:04   ` Li, Yunxiang (Teddy)
2025-01-02  9:32     ` Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 72/86] freezer, sched: Report frozen tasks as D instead of R Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 73/86] tracing: Constify string literal data member in struct trace_event_call Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 74/86] tracing: Prevent bad count for tracing_cpumask_write Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 75/86] io_uring/sqpoll: fix sqpoll error handling races Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 76/86] i2c: microchip-core: actually use repeated sends Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 77/86] PCI/MSI: Handle lack of irqdomain gracefully Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 78/86] i2c: imx: add imx7d compatible string for applying erratum ERR007805 Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 79/86] i2c: microchip-core: fix "ghost" detections Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 80/86] power: supply: gpio-charger: Fix set charge current limits Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 81/86] btrfs: avoid monopolizing a core when activating a swap file Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 82/86] btrfs: sysfs: fix direct super block member reads Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 83/86] ALSA: sh: Fix wrong argument order for copy_from_iter() Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 84/86] x86/cpu/intel: Drop stray FAM6 check with new Intel CPU model defines Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 85/86] ALSA: hda/realtek: Fix spelling mistake "Firelfy" -> "Firefly" Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.6 86/86] block: avoid to reuse `hctx` not removed from cpuhp callback list Greg Kroah-Hartman
2024-12-30 17:51 ` [PATCH 6.6 00/86] 6.6.69-rc1 review Florian Fainelli
2024-12-30 20:58 ` Shuah Khan
2024-12-31  8:12 ` Muhammad Usama Anjum
2024-12-31  9:39 ` Naresh Kamboju
2024-12-31 13:03 ` Harshit Mogalapalli
2024-12-31 22:35 ` [PATCH 6.6] " Hardik Garg
2024-12-31 22:54 ` [PATCH 6.6 00/86] " Ron Economos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241230154212.068887587@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=chuck.lever@oracle.com \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yangerkun@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox