Linux Security Modules development
 help / color / mirror / Atom feed
From: Huang Shijie <huangsj@hygon.cn>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: <viro@zeniv.linux.org.uk>, <brauner@kernel.org>, <jack@suse.cz>,
	<hch@infradead.org>, <mic@digikod.net>, <axboe@kernel.dk>,
	<gnoack@google.com>, <paul@paul-moore.com>, <jmorris@namei.org>,
	<serge@hallyn.com>, <legion@kernel.org>, <aleksa@amutable.com>,
	<libaokun@linux.alibaba.com>, <ebiggers@kernel.org>,
	<djwong@kernel.org>, <sandeen@redhat.com>, <zhongyuan@hygon.cn>,
	<fangbaoshun@hygon.cn>, <yingzhiwei@hygon.cn>,
	<wujianyong@hygon.cn>, <shijie8@gmail.com>,
	<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-block@vger.kernel.org>, <gfs2@lists.linux.dev>,
	<linux-security-module@vger.kernel.org>
Subject: Re: [PATCH v3 0/11] vfs: add inode iteration methods
Date: Mon, 23 Nov 2026 10:31:24 +0800	[thread overview]
Message-ID: <awOlfBGNgQoassIt@hsj-2U-Workstation> (raw)
In-Reply-To: <CAHc6FU7URHetBU9XgP0DSEGjWQfq0tX+ohK8xRVZLEYzgJBeEw@mail.gmail.com>

在 Fri, Nov 20, 2026 at 03:59:10PM +0100,Andreas Gruenbacher 写道:
> On Fri, Nov 20, 2026 at 4:13 AM Huang Shijie <huangsj@hygon.cn> wrote:
> > This series adds two superblock inode iteration helpers,
> > super_iter_inodes() and super_iter_inodes_locked(), and converts the
> > open-coded sb->s_inodes walks in the VFS to them.  The design is based on
> > Dave Chinner's patch set:
> >   "vfs: improving inode cache iteration scalability"
> >   https://lore.kernel.org/all/20241002014017.3801899-1-david@fromorbit.com/
> >
> > About the two helpers:
> >
> >   int super_iter_inodes(struct super_block *sb, ino_iter_fn iter_fn,
> >                         ino_iter_eligible_fn eligible, void *priv,
> >                         int flags);
> >
> >   static inline int super_iter_inodes_locked(struct super_block *sb,
> >                                              ino_iter_fn iter_fn,
> >                                              void *priv);
> >
> >   - super_iter_inodes() runs @iter_fn with a referenced inode and with
> >     sb->s_inode_list_lock __dropped__, so the callback is free to block and
> >     to do whatever it wants with the inode except drop the reference the
> >     iterator holds.  The iterator releases that one reference per inode
> >     itself, so the callback cannot leave a dangling inode behind.
> >     It is exported because GFS2 can be built as a module.
> >
> >   - super_iter_inodes_locked() keeps sb->s_inode_list_lock held for the
> >     whole walk and takes no inode references at all.  Its callback
> >     therefore only has an existence guarantee: it must not block and
> >     must do its own inode state checks and its own reference handling.
> >     It is internal to the VFS, being declared in fs/internal.h.
> >
> >   - The callback is separate from the caller's data, so a caller keeps
> >     its state in its own structure instead of filling in a shared
> >     context:
> >
> >       typedef int (*ino_iter_fn)(struct inode *inode, void *priv);
> >
> >   - %INO_ITER_F_REFERENCED restricts the safe iterator to inodes that
> >     still have a reference.  It preserves the "only handle referenced
> >     inodes" rule of landlock's sb-delete walk.
> >
> >   - %INO_ITER_F_NOREF does the opposite: only inodes whose reference
> >     count has already reached zero are handed out.  %INO_ITER_F_NOIGET
> >     suppresses the reference.  Neither keeps the inode alive, so the
> >     caller must make it unclaimable itself.
> >
> >    Patch 1 adds super_iter_inodes().
> >    Patch 2 adds super_iter_inodes_locked().
> >    Patch 3-5 convert the callers which cannot use referenced inodes
> >            (dquot removal, nr_blockdev_pages() and the
> >            generic_shutdown_super() poisoning loop).
> >    Patch 6-11 convert the remaining callers (inode eviction, sync_bdevs,
> >            drop_pagecache_sb, add_dquot_ref, landlock's hook_sb_delete
> >            and gfs2_evict_inodes()).
> >
> >
> > BTW:
> >   This patch set depends a small patch:
> >   "fs/drop_caches: skip filesystems without fs writeback"
> >   https://lkml.org/lkml/2026/9/23/675
> 
> That link doesn't work for me. When referring to other postings, can
> you please use lore links?
Okay. No problem.

> 
> There also is no posting of a patch with that title from that day on
> https://lore.kernel.org/linux-fsdevel/. You may be referring to
> https://lore.kernel.org/linux-fsdevel/20260920072811.2064247-2-huangsj@hygon.cn/,
> but that patch queue no longer applies. So please post patch queues in
> a state that applies and optionally, make a git branch available.
> 
I will add the kernel version in next version.

Thanks
Huang Shijie


      reply	other threads:[~2026-11-23  2:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  3:12 [PATCH v3 0/11] vfs: add inode iteration methods Huang Shijie
2026-11-20  3:12 ` [PATCH v3 01/11] vfs: add super_iter_inodes() Huang Shijie
2026-11-20 14:56   ` Andreas Gruenbacher
2026-11-20  3:12 ` [PATCH v3 02/11] vfs: add super_iter_inodes_locked() Huang Shijie
2026-11-20  3:12 ` [PATCH v3 03/11] fs/quota: convert remove_dquot_ref() to super_iter_inodes_locked() Huang Shijie
2026-11-20  3:12 ` [PATCH v3 04/11] block: convert nr_blockdev_pages() " Huang Shijie
2026-11-20  3:12 ` [PATCH v3 05/11] fs: convert generic_shutdown_super() poison loop Huang Shijie
2026-11-20  3:13 ` [PATCH v3 06/11] fs/inode: convert evict_inodes() to super_iter_inodes() Huang Shijie
2026-11-20  3:13 ` [PATCH v3 07/11] block: convert sync_bdevs() " Huang Shijie
2026-11-20  3:13 ` [PATCH v3 08/11] fs/drop_caches: convert drop_pagecache_sb() " Huang Shijie
2026-11-20  3:13 ` [PATCH v3 09/11] fs/quota: convert add_dquot_ref() " Huang Shijie
2026-11-20  3:13 ` [PATCH v3 10/11] landlock: convert hook_sb_delete() " Huang Shijie
2026-11-20  3:13 ` [PATCH v3 11/11] gfs2: convert gfs2_evict_inodes() " Huang Shijie
2026-11-20 14:59 ` [PATCH v3 0/11] vfs: add inode iteration methods Andreas Gruenbacher
2026-11-23  2:31   ` Huang Shijie [this message]

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=awOlfBGNgQoassIt@hsj-2U-Workstation \
    --to=huangsj@hygon.cn \
    --cc=agruenba@redhat.com \
    --cc=aleksa@amutable.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=djwong@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=fangbaoshun@hygon.cn \
    --cc=gfs2@lists.linux.dev \
    --cc=gnoack@google.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=jmorris@namei.org \
    --cc=legion@kernel.org \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mic@digikod.net \
    --cc=paul@paul-moore.com \
    --cc=sandeen@redhat.com \
    --cc=serge@hallyn.com \
    --cc=shijie8@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wujianyong@hygon.cn \
    --cc=yingzhiwei@hygon.cn \
    --cc=zhongyuan@hygon.cn \
    /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