This is a note to let you know that I've just added the patch titled xfs: check that per-cpu inodegc workers actually run on that cpu to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-check-that-per-cpu-inodegc-workers-actually-run-on-that-cpu.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable-owner@xxxxxxxxxxxxxxx Sat Jul 15 08:31:33 2023 From: Amir Goldstein <amir73il@xxxxxxxxx> Date: Sat, 15 Jul 2023 09:31:12 +0300 Subject: xfs: check that per-cpu inodegc workers actually run on that cpu To: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Sasha Levin <sashal@xxxxxxxxxx>, Leah Rumancik <leah.rumancik@xxxxxxxxx>, Chandan Babu R <chandan.babu@xxxxxxxxxx>, "Darrick J . Wong" <djwong@xxxxxxxxxx>, linux-xfs@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx, Dave Chinner <dchinner@xxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx> Message-ID: <20230715063114.1485841-3-amir73il@xxxxxxxxx> From: "Darrick J. Wong" <djwong@xxxxxxxxxx> commit b37c4c8339cd394ea6b8b415026603320a185651 upstream. Now that we've allegedly worked out the problem of the per-cpu inodegc workers being scheduled on the wrong cpu, let's put in a debugging knob to let us know if a worker ever gets mis-scheduled again. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> Signed-off-by: Dave Chinner <david@xxxxxxxxxxxxx> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/xfs/xfs_icache.c | 2 ++ fs/xfs/xfs_mount.h | 3 +++ fs/xfs/xfs_super.c | 3 +++ 3 files changed, 8 insertions(+) --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -1848,6 +1848,8 @@ xfs_inodegc_worker( struct llist_node *node = llist_del_all(&gc->list); struct xfs_inode *ip, *n; + ASSERT(gc->cpu == smp_processor_id()); + WRITE_ONCE(gc->items, 0); if (!node) --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -66,6 +66,9 @@ struct xfs_inodegc { /* approximate count of inodes in the list */ unsigned int items; unsigned int shrinker_hits; +#if defined(DEBUG) || defined(XFS_WARN) + unsigned int cpu; +#endif }; /* --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1084,6 +1084,9 @@ xfs_inodegc_init_percpu( for_each_possible_cpu(cpu) { gc = per_cpu_ptr(mp->m_inodegc, cpu); +#if defined(DEBUG) || defined(XFS_WARN) + gc->cpu = cpu; +#endif init_llist_head(&gc->list); gc->items = 0; INIT_DELAYED_WORK(&gc->work, xfs_inodegc_worker); Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are queue-6.1/xfs-disable-reaping-in-fscounters-scrub.patch queue-6.1/xfs-fix-xfs_inodegc_stop-racing-with-mod_delayed_work.patch queue-6.1/xfs-check-that-per-cpu-inodegc-workers-actually-run-on-that-cpu.patch queue-6.1/xfs-explicitly-specify-cpu-when-forcing-inodegc-delayed-work-to-run-immediately.patch