Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz, Anand Jain <anand.jain@oracle.com>
Cc: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: add dmesg output when mounting and unmounting
Date: Fri, 3 Nov 2023 15:32:03 +1030	[thread overview]
Message-ID: <f59db755-7aa3-4d13-89fc-78fb335da1de@gmx.com> (raw)
In-Reply-To: <20231102201818.GI11264@twin.jikos.cz>



On 2023/11/3 06:48, David Sterba wrote:
> On Thu, Nov 02, 2023 at 09:16:19AM +0800, Anand Jain wrote:
>> On 11/2/23 05:24, Qu Wenruo wrote:
>>> There is a feature request to add dmesg output when unmounting a btrfs.
>>>
>>> There are several alternative methods to do the same thing, but with
>>> their problems:
>>>
>>> - Use eBPF to watch btrfs_put_super()/open_ctree()
>>>     Not end user friendly, they have to dip their head into the source
>>>     code.
>>>
>>> - Watch for /sys/fs/<uuid>/
>>>     This is way more simpler, but still requires some simple device -> uuid
>>>     lookups.
>>>     And a script needs to use inotify to watch /sys/fs/.
>>>
>>
>>
>>> Compared to all these, directly outputting the information into dmesg
>>> would be the most simple one, with both device and UUID included.
>>>
>>
>> Well, I submitted a patch for this in 2017, but I'm not sure why it
>> wasn't integrated or commented.
>>
>> https://lore.kernel.org/linux-btrfs/3352043d-dbb1-0055-f50a-c91ca43aff1d@oracle.com/
>
> I think you sent it more than once and that I replied, messages about
> mounting each subvolume (as in your patch) seem to be duplicating what
> eg. audit or some policy layer should do. The same comment is in the
> github issue.
>
> The patch here and the request is to track only the first and last mount
> of the same filesystem with a bit different use case, eg. properly
> waiting until lazy umount finishe, or in container environments to be
> sure that the last mount is gone.
>
> The suggested waiting on /sys/fs/btrfs/UUID could eventually wrapped in
> a subcommand, for conveniencie.

My bad, I didn't realize until I crafted the `btrfs monitor watch` command.

Inotify just doesn't work on sysfs....

So I believe for now, the patch is the best way to go, unless we want to
something like checking the sysfs every second...

Thanks,
Qu

  reply	other threads:[~2023-11-03  5:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01 21:24 [PATCH] btrfs: add dmesg output when mounting and unmounting Qu Wenruo
2023-11-02  1:16 ` Anand Jain
2023-11-02 20:18   ` David Sterba
2023-11-03  5:02     ` Qu Wenruo [this message]
2023-11-13 17:45 ` David Sterba
2023-11-13 20:07   ` Qu Wenruo
2023-11-13 21:09     ` David Sterba
2023-11-14  0:38       ` Anand Jain
2023-11-14 11:12         ` Anand Jain
2023-11-14 12:03           ` David Sterba
2023-11-21  5:18 ` Anand Jain
2023-11-21  7:27   ` Anand Jain
2023-11-21 12:38   ` David Sterba

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=f59db755-7aa3-4d13-89fc-78fb335da1de@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.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