Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jan Kara" <jack@suse.cz>, "Christian Brauner" <brauner@kernel.org>
Cc: "Christoph Hellwig" <hch@infradead.org>,
	linux-mm@kvack.org, "Mikhail Rudenko" <xyzzy@yandex-team.ru>,
	"Andreas Gruenbacher" <agruenba@redhat.com>
Subject: Re: [PATCH v5 5/8] fs: Defer reclaim of unlinked inodes
Date: Wed, 02 Dec 2026 14:36:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-245971@kernel.org> (raw)
In-Reply-To: <20261201143522.483168-13-jack@suse.cz>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] fs: deferred eviction of unlinked inodes blocks on frozen fs in
  WQ_FREEZABLE wq
--

commit c843e43a3dce9da35d7adae047df0c6b85fc0c3d
Author: Jan Kara <jack@suse.cz>

fs: Defer reclaim of unlinked inodes

This commit offloads eviction of unlinked inodes to the deferred reclaim
workqueue when the last reference is dropped from a memory reclaim path.

> diff --git a/fs/inode.c b/fs/inode.c
> index 1f2f31d0f055c..5dde1f9a9fb46 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -2241,6 +2241,23 @@ static void iput_final(struct inode *inode)
>  	inode_lru_list_del(inode);
>  	spin_unlock(&inode->i_lock);
>  
> +	/*
> +	 * Are we going to delete this inode while in reclaim path? Likely
> +	 * reclaim of some object (e.g. overlayfs inode) ended up dropping the
> +	 * last reference to an already deleted inode. Offload the eviction as
> +	 * it's likely to require memory allocations and block on IO. Since
> +	 * this eviction was triggered by a reclaim of unrelated object, the
> +	 * inode is already outliving the operation that originally deleted it
> +	 * (unlink, file close...). A slightly longer delay thus should not be
> +	 * observable by userspace.
> +	 */
> +	if (current->flags & PF_MEMALLOC && !inode->i_nlink) {
> +		LIST_HEAD(defer);
> +
> +		list_add(&inode->i_lru, &defer);
> +		queue_deferred_reclaim(sb, 1, &defer);
> +		return;
> +	}
>  	evict(inode);
>  }

[Severity: High]
Can queuing unlinked inodes to deferred_reclaim.wq stall a worker in
sb_start_intwrite() when the filesystem is frozen?

When inode_reclaim_deferred() calls evict() -> op->evict_inode() for an
unlinked inode, filesystems such as ext4, btrfs, and f2fs call
sb_start_intwrite(inode->i_sb), which blocks uninterruptibly once the
superblock reaches SB_FREEZE_FS.  Unlike XFS's per-mount m_inodegc_wq,
freeze_super() does not drain or stop deferred reclaim before advancing to
SB_FREEZE_FS, and iput_final() keeps queuing unlinked inodes while the
superblock is freezing or frozen.

Because deferred_reclaim.wq is allocated with WQ_FREEZABLE, an active work
item blocked in sb_start_intwrite() prevents freeze_workqueues_busy() from
completing and causes system suspend or hibernation to fail after the
20-second freezer timeout.  In addition, get_inode_reclaim_batch() pulls up
to 16 inodes across all queues onto a worker's private inode_batch list, so
blocking on one frozen superblock traps inodes from other superblocks in
that batch and can exhaust the global worker pool, hanging unmounts of
unrelated filesystems in deactivate_locked_super() while waiting on
s_deferred_reclaim_count.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201105733.18997-1-jack@suse.cz?part=5


  reply	other threads:[~2026-12-02 14:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 14:35 [PATCH v5 0/8] fs: Deferred inode reclaim Jan Kara
2026-12-01 14:35 ` [PATCH v5 1/8] writeback: Fix missed lazytime flush Jan Kara
2026-12-01 14:35 ` [PATCH v5 2/8] fs: Fix inode writeback list placement for switched and redirtied inodes Jan Kara
2026-12-02 14:36   ` sashiko-bot
2026-12-01 14:35 ` [PATCH v5 3/8] fs: Avoid inode dirtying on last iput Jan Kara
2026-12-02 14:36   ` sashiko-bot
2026-12-01 14:35 ` [PATCH v5 4/8] fs: Basic infrastructure for offloading inode reclaim Jan Kara
2026-12-02 14:36   ` sashiko-bot
2026-12-01 14:35 ` [PATCH v5 5/8] fs: Defer reclaim of unlinked inodes Jan Kara
2026-12-02 14:36   ` sashiko-bot [this message]
2026-12-01 14:35 ` [PATCH v5 6/8] fs: Defer reclaim of inodes requiring metadata writeback Jan Kara
2026-12-01 14:35 ` [PATCH v5 7/8] fs: Add throttling to deferred inode reclaim Jan Kara
2026-12-02 14:36   ` sashiko-bot
2026-12-01 14:35 ` [PATCH v5 8/8] ext4: Defer inode reclaim if it has preallocations Jan Kara

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=sashiko-outbox-245971@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agruenba@redhat.com \
    --cc=brauner@kernel.org \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-mm@kvack.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xyzzy@yandex-team.ru \
    /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