mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: Jiacheng Xu <stitch@zju.edu.cn>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/2] btrfs: delay mounted sysfs attributes until mount is ready
Date: Sat, 22 Aug 2026 14:27:14 +0930	[thread overview]
Message-ID: <ffae86d9-e2b3-4cf0-9f4f-3fcd412ed7e6@suse.com> (raw)
In-Reply-To: <698e5039.16b92.1a0278ef67b.Coremail.stitch@zju.edu.cn>



在 2026/8/22 13:11, Jiacheng Xu 写道:
> Here is a potential fix following Wenruo's idea.
> 
> btrfs_sysfs_add_mounted() currently publishes the writable label and
> feature attributes before the transaction kthread is created. A concurrent
> sysfs write can therefore dereference a NULL transaction_kthread in
> wake_up_process().
> 
> This series follows the suggested lifecycle: create only the required
> subdirectories during early mount, publish the fsid attributes after mount
> initialization, and remove them before the kthreads are stopped. The
> feature attributes are included because their store callback has the same
> transaction_kthread dependency as the label callback.
> 
> Patch 1 factors the fsid attribute handling into dedicated helpers. Patch 2
> moves their publication and removal to the safe mount and unmount stages.
> On unmount the cleaner is parked before attribute removal so it cannot
> recreate the feature group through sysfs_update_group(). Both patches are
> required for stable backports.
> 
> The resulting fs/btrfs/sysfs.o and fs/btrfs/disk-io.o were build-tested.
> 
> Changes in v2:
> - Delay creation of both the root and feature attributes until mount setup
>    is complete.

You don't need to bother feature attributes for now, there is already a 
patch addressing it by completely removing the write support for feature 
attributes:

https://lore.kernel.org/linux-btrfs/8a598d76555b5944d34bb08fa8dbeea28fc05db9.1787307129.git.wqu@suse.com/

Considering it's only extended_iref, removing it should be much simpler.
Until that is determined, you only need to bother the label one.


Furthermore, among all the attr files in the fsid directory, there is 
only label that is writable, it would make more sense to split 
btrfs_attrs into two parts, one for those read-only members, and one for 
the only writebale label one.

Otherwise the series looks much better.


> - Remove those attributes while their kthread dependencies are still
>    valid.
> - Split helper extraction from the lifecycle fix for stable backports.
> 
> Jiacheng Xu (2):
>    btrfs: sysfs: factor out mounted fsid attribute helpers
>    btrfs: delay mounted fsid attributes until the fs is ready
> 
>   fs/btrfs/disk-io.c | 18 ++++++++++++++++-
>   fs/btrfs/sysfs.c   | 50 ++++++++++++++++++++++++++++++----------------
>   fs/btrfs/sysfs.h   |  2 ++
>   3 files changed, 52 insertions(+), 18 deletions(-)
> 
> base-commit: 0f23d56f17fdfc7db69d51f64c8b91bbab947aa9


  parent reply	other threads:[~2026-08-22  4:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 12:27 [PATCH] btrfs: drain sysfs callbacks before stopping transaction kthread Jiacheng Xu
2026-08-20 22:32 ` Qu Wenruo
2026-08-21  4:30   ` Jiacheng Xu
2026-08-21  5:21     ` Qu Wenruo
2026-08-21  6:49       ` Jiacheng Xu
2026-08-21  7:08         ` Qu Wenruo
2026-08-21  9:05           ` Qu Wenruo
2026-08-22  3:41 ` [PATCH v2 0/2] btrfs: delay mounted sysfs attributes until mount is ready Jiacheng Xu
2026-08-22  3:42   ` [PATCH v2 1/2] btrfs: sysfs: factor out mounted fsid attribute Jiacheng Xu
2026-08-22  3:46   ` [PATCH v2 2/2] btrfs: delay mounted sysfs attributes until mount is ready Jiacheng Xu
2026-08-22  4:57   ` Qu Wenruo [this message]
2026-08-22  5:39     ` Re: [PATCH v2 0/2] " Jiacheng Xu

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=ffae86d9-e2b3-4cf0-9f4f-3fcd412ed7e6@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stitch@zju.edu.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

all inboxes | Powered by JetHome®