From: Thiago Macieira <thiago.macieira@intel.com>
To: Christian Brauner <brauner@kernel.org>,
Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-fsdevel@vger.kernel.org, Miklos Szeredi <mszeredi@redhat.com>
Subject: Re: statmount: requesting more information: statfs, devname, label
Date: Thu, 30 May 2024 10:21:58 -0300 [thread overview]
Message-ID: <5199584.tpJ11cQ8QL@tjmaciei-mobl5> (raw)
In-Reply-To: <CAJfpegv_6K-tFtNjOnTBxc0KTSy7Horpu4OFAvkLBkPtv=CoRw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2171 bytes --]
On Thursday 30 May 2024 05:25:39 GMT-3 Miklos Szeredi wrote:
> > > The second is the filesystem label. The workaround for this is opening
> > > the
> > > mount point and issuing ioctl(FS_IOC_GETFSLABEL), but that again
> > > introduces a minor race and also requires that the ability to open()
> > > the path in question. The second fallback to that is to scan
> > > /dev/disks/by-label, which is populated by udev/udisks/systemd.
>
> FS_IOC_GETFSLABEL seems to be implemented only by a handful of
> filesystems. I don't really undestand how this label thing works...
Nor I. It's one of the btrfs ioctl calls that became generic, like FICLONE, so
it's not surprising that it isn't supported for all filesystems. For the rest,
I guess udev/udisks knows the filesystem superblock header format and reads the
label off it, because it seems to know the labels for FAT filesystems despite
the system call not offering it.
openat(AT_FDCWD, "/boot/efi", O_RDONLY|O_CLOEXEC) = 4
statfs("/boot/efi", {f_type=MSDOS_SUPER_MAGIC, ...}) = 0
ioctl(4, FS_IOC_GETFSLABEL, 0x7ffe6f557110) = -1 ENOTTY
My code to decode this via /dev/disks/by-label is a best effort that seems to
work for everything that doesn't support the ioctl. Fortunately, statmount()
does give me the actual device's major/minor, no the anonymous IDs that some
filesystems (like btrfs) use for subvolumes, so it's actually easier to scan
with statmount() information.
> > I think that mnt_devname makes sense!
> > I don't like the other additions because they further blur the
> > distinction between mount and filesystem information.
>
> mnt_devname is exactly that: filesystem information (don't let it fool
> you that it's in struct mount, that's just an historical accident).
> It's just a special option that customarily refers to a device path,
> but in general is very much filesystem specific.
Ah, good point. So here's even a stronger reason: if I had a remote FS, I'd
probably want both the devname and the mount options, neither of which are in
statmount() right now.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Principal Engineer - Intel DCAI Fleet Engineering and Quality
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5152 bytes --]
prev parent reply other threads:[~2024-05-30 13:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 18:36 statmount: requesting more information: statfs, devname, label Thiago Macieira
2024-05-30 7:16 ` Christian Brauner
2024-05-30 8:25 ` Miklos Szeredi
2024-05-30 10:42 ` Christian Brauner
2024-05-30 13:33 ` Thiago Macieira
2024-05-30 13:21 ` Thiago Macieira [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=5199584.tpJ11cQ8QL@tjmaciei-mobl5 \
--to=thiago.macieira@intel.com \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=mszeredi@redhat.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