Util-Linux package development
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Karel Zak <kzak@redhat.com>
Cc: "Windl, Ulrich" <u.windl@ukr.de>,
	Krister Johansen <kjlx@templeofstupid.com>,
	"util-linux@vger.kernel.org" <util-linux@vger.kernel.org>,
	"systemd-devel@lists.freedesktop.org"
	<systemd-devel@lists.freedesktop.org>,
	David Reaver <me@davidreaver.com>
Subject: Re: [EXT] [systemd-devel] [PATCH] libblkid: fix spurious ext superblock checksum mismatches
Date: Thu, 21 Nov 2024 07:55:09 -0800	[thread overview]
Message-ID: <20241121155509.GA3802465@mit.edu> (raw)
In-Reply-To: <cu2l7alrme6y7mm3kjmdnszyc7ka4a6zh5lw3ps3vj7igzjpkv@t7pgmn4aztkj>

On Thu, Nov 21, 2024 at 11:44:14AM +0100, Karel Zak wrote:
> I doubt it will be helpful for us.
> 
> I believe that EXT4_IOC_GET_SUPERBLOCK will be used with a mountpoint
> file descriptor, but libblkid works directly with the block device
> (e.g. open(/dev/sda1)) where it searches for valid filesystems.

Yeah, that's why I haven't prioritized implementing it.  Higher
priority is to implement ioctls so that tune2fs will no longer need to
modify the superblock while the file system is mounted, so we can
allow prohibiting read/write access to the block device while it is
mounted.  (Well, after waiting a decent interval so that distros
everywhere can update to a sufficiently new version of e2fsprogs.)

I had guessed that libblkid wouldn't be excited about trying to
determine the mountpoint and using an ioctl that required an open fd
on the mountpoint, but if I had been wrong, I would have been happy to
priotize EXT4_IOC_GET_SUPERBLOCK higher on my todo list.

> Another issue is that libblkid does not check if the device is
> mounted, so the FS prober can be triggered in all cases. It simply
> calls seek()+read() and tries to be smart.

Well, what I had been proposing was something that could be used in
by the ext[234] specific probe code.

> Ideally, we would have a generic ioctl (for block devices) to ask the
> kernel if a superblock at a specific location is valid.
> 
>   ioctl(fd, BLKVERIFYFS, { .fsname="ext4", .offset=123456 })

I wouldn't have thought this to be that useful since there are plenty
of file systems known by libblkid that the kernel doesn't support ---
and even if the source code exists in the kernel, there is no
guarantee that it is actually compiled into a particular kernel image.
(Exhibit 1: Reiserfs)

So would it really simplify libblkid all that much?

Cheers,

						- Ted
	

  reply	other threads:[~2024-11-21 15:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18 20:35 [PATCH] libblkid: fix spurious ext superblock checksum mismatches Krister Johansen
2024-11-18 22:36 ` [systemd-devel] " Lennart Poettering
2024-11-18 23:13   ` Krister Johansen
2024-11-19  8:19     ` [EXT] " Windl, Ulrich
2024-11-19  8:15 ` [EXT] " Windl, Ulrich
2024-11-19 17:49   ` Theodore Ts'o
2024-11-19 23:59     ` Krister Johansen
2024-11-20  6:07       ` Theodore Ts'o
2024-11-21 10:44     ` Karel Zak
2024-11-21 15:55       ` Theodore Ts'o [this message]
2024-11-22  8:54       ` Krister Johansen

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=20241121155509.GA3802465@mit.edu \
    --to=tytso@mit.edu \
    --cc=kjlx@templeofstupid.com \
    --cc=kzak@redhat.com \
    --cc=me@davidreaver.com \
    --cc=systemd-devel@lists.freedesktop.org \
    --cc=u.windl@ukr.de \
    --cc=util-linux@vger.kernel.org \
    /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