Looking at the code it appears ext4, f2fs, and xfs shutdown path
implements revoking a bdev from a filesystem. Further if the ext4
implementation is anything to go by it looks like something we could
generalize into the vfs.
There are two things which the current file system shutdown paths do.
The first is that they prevent the file system from attempting to
write to the bdev. That's all very file system specific, and can't be
generalized into the VFS.
The second thing they do is they cause system calls which might modify
the file system to return an error. Currently operations that might
result in _reads_ are not shutdown, so it's not a true revoke(2)
functionality ala *BSD. I assume that's what you are talking about
generalizing into the VFS. Personally, I would prefer to see us
generalize something like vhangup() but which works on a file
descriptor, not just a TTY. That it is, it disconnects the file
descriptor entirely from the hardware / file system so in the case of
the tty, it can be used by other login session, and in the case of the
file descriptor belonging to a file system, it stops the file system
from being unmounted
Presumably the fd would just be used to specify the backing store? I was
imagining doing it through an additional umount(2) flag but I guess that
having an fd open is probably better form.
I'm a little confused about whether this actually will solve the
original problem though, because it still requires the iteration over
/proc/**/mounts in order for userspace to finish the unmounts. I feel
like this is trying to generalise the idea behind luksSuspend -- am I
misunderstanding how this would solve the original issue? Is it the case
that if we "disconnect" at the file descriptor level, then the bdev is
no longer considered "used" and it can be operated on safely?
Ted, Aleksa would either of you be interested in generalizing what ext4,
f2fs, and xfs does now and working to put a good interface on it? I can
help especially with review but for the short term I am rather booked.
Unfortunately, I have way too much travel coming up in the short term,
so I probably won't have to take on a new project until at least
mid-to-late-November at the earliest. Aleska, do you have time? I
can consult on a design, but I have zero coding time for the next
couple of weeks.
I can give it a shot, but a quick disclaimer that I'm not very familiar
with the VFS codebase so the review cycle will probably take a while. Oh
well, it's a good opportunity for me to learn more about it. :D
--
Aleksa Sarai
Snr. Software Engineer (Containers)
SUSE Linux GmbH
https://www.cyphar.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html