From: Zdenek Kabelac <zkabelac@redhat.com>
To: Jan Kara <jack@suse.cz>
Cc: Christian Brauner <brauner@kernel.org>,
"Darrick J. Wong" <djwong@kernel.org>,
linux-kernel@vger.kernel.org, dm-devel@redhat.com,
Mikulas Patocka <mpatocka@redhat.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [dm-devel] [PATCH] fix writing to the filesystem after unmount
Date: Fri, 8 Sep 2023 12:51:03 +0200 [thread overview]
Message-ID: <15c62097-d58f-4e66-bdf5-e0edb1306b2f@redhat.com> (raw)
In-Reply-To: <20230908102014.xgtcf5wth2l2cwup@quack3>
[-- Attachment #1.1: Type: text/plain, Size: 3656 bytes --]
Dne 08. 09. 23 v 12:20 Jan Kara napsal(a):
> On Fri 08-09-23 11:29:40, Zdenek Kabelac wrote:
>> Dne 08. 09. 23 v 9:32 Jan Kara napsal(a):
>>> On Thu 07-09-23 14:04:51, Mikulas Patocka wrote:
>>>> On Thu, 7 Sep 2023, Christian Brauner wrote:
>>>>
>>>>>> I think we've got too deep down into "how to fix things" but I'm not 100%
>>>>> We did.
>>>>>
>>>>>> sure what the "bug" actually is. In the initial posting Mikulas writes "the
>>>>>> kernel writes to the filesystem after unmount successfully returned" - is
>>>>>> that really such a big issue?
>>>> I think it's an issue if the administrator writes a script that unmounts a
>>>> filesystem and then copies the underyling block device somewhere. Or a
>>>> script that unmounts a filesystem and runs fsck afterwards. Or a script
>>>> that unmounts a filesystem and runs mkfs on the same block device.
>>> Well, e.g. e2fsprogs use O_EXCL open so they will detect that the filesystem
>>> hasn't been unmounted properly and complain. Which is exactly what should
>>> IMHO happen.
>> I'd likely propose in this particular state of unmounting of a frozen
>> filesystem to just proceed - and drop the frozen state together with release
>> filesystem and never issue any ioctl from such filelsystem to the device
>> below - so it would not be a 100% valid unmount - but since the freeze
>> should be nearly equivalent of having a proper 'unmount' being done - it
>> shoudn't be causing any harm either - and all resources associated could
>> be 'released. IMHO it's correct to 'drop' frozen state for filesystem
>> that is not going to exist anymore (assuming it's the last such user)
> This option was also discussed in the past and it has nasty consequences as
> well. Cleanly shutting down a filesystem usually needs to write to the
> underlying device so either you allow the filesystem to write to the device
> on umount breaking assumptions of the user who froze the fs or you'd have
> to implement a special handling for this case for every filesystem to avoid
> the writes (and put up with the fact that the filesystem will appear as
> uncleanly shutdown on the next mount). Not particularly nice either...
I'd say there are several options and we should aim towards the variant which
is most usable by normal users.
Making hyper complex unmount rule logic that basically no user-space tools
around Gnome/KDE... are able to handle well and getting it to the position
where only the core kernel developer have all the 'wisdom' to detect and
decode system state and then 'know what's going on' isn't the favourite goal
here.
Freeze should be getting the filesystem into 'consistent' state - filesystem
should be able to 'easily' recover and finish all the ongoing 'unfinished'
process with the next mount without requiring full 'fsck' - otherwise it would
be useless for i.e. snapshot.
So to me this looks like the win-win strategy where we basically do not loose
any information and we also do not leak kernel resources - since i..e in case
of DM devices - the underlying DM device might have already changed disk
characteristics anyway.
If the developers then believe - that 'more variants' of complex behavior are
necessary - then kernel could have some sysfs parameter to configure some
'more advanced' logic i.e. keep 'fs mounted' for those skilled admins who
are able to go through the deepest corners here - but other then that
plain 'umount' should really go with the meaning of a) manages to umount
and release a device b) in other case reports to a user there is still
something holding device....
Regards
Zdenek
[-- Attachment #1.2: Type: text/html, Size: 5226 bytes --]
[-- Attachment #2: Type: text/plain, Size: 98 bytes --]
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2023-09-08 10:51 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 13:26 [dm-devel] [PATCH] fix writing to the filesystem after unmount Mikulas Patocka
2023-09-06 14:27 ` Christian Brauner
2023-09-06 15:03 ` Mikulas Patocka
2023-09-06 15:33 ` Christian Brauner
2023-09-06 15:58 ` Christian Brauner
2023-09-06 16:01 ` Mikulas Patocka
2023-09-06 16:19 ` Christian Brauner
2023-09-06 16:52 ` Mikulas Patocka
2023-09-07 9:44 ` Jan Kara
2023-09-07 10:43 ` Christian Brauner
2023-09-07 12:04 ` Mikulas Patocka
2023-09-08 7:32 ` Jan Kara
2023-09-08 9:29 ` Zdenek Kabelac
2023-09-08 10:20 ` Jan Kara
2023-09-08 10:51 ` Zdenek Kabelac [this message]
2023-09-08 11:32 ` Christian Brauner
2023-09-08 12:07 ` Zdenek Kabelac
2023-09-08 12:07 ` Zdenek Kabelac
2023-09-08 12:34 ` Christian Brauner
2023-09-12 9:10 ` Jan Kara
2023-09-08 12:02 ` Christian Brauner
2023-09-08 16:49 ` John Stoffel
2023-09-09 11:21 ` Christoph Hellwig
2023-09-08 12:01 ` Pavel Machek
2023-09-08 11:59 ` Pavel Machek
2023-09-06 17:10 ` Al Viro
2023-09-06 17:08 ` Al Viro
2023-09-06 15:22 ` Darrick J. Wong
2023-09-06 15:38 ` Christian Brauner
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=15c62097-d58f-4e66-bdf5-e0edb1306b2f@redhat.com \
--to=zkabelac@redhat.com \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=dm-devel@redhat.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/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