* [RFC PATCH] ext4: add unmount filesystem message
@ 2022-04-12 14:53 Zhang Yi
2022-04-12 16:01 ` Gabriel Krisman Bertazi
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Zhang Yi @ 2022-04-12 14:53 UTC (permalink / raw)
To: linux-ext4
Cc: tytso, adilger.kernel, jack, yi.zhang, yukuai3, yebin10,
liuzhiqiang26, liangyun2
Now that we have kernel message at mount time, system administrator
could acquire the mount time, device and options easily. But we don't
have corresponding unmounting message at umount time, so we cannot know
if someone umount a filesystem easily. Some of the modern filesystems
(e.g. xfs) have the umounting kernel message, so add one for ext4
filesystem for convenience.
EXT4-fs (sdb): mounted filesystem with ordered data mode. Quota mode: none.
EXT4-fs (sdb): unmounting filesystem.
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
---
fs/ext4/super.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 81749eaddf4c..bdecf62f4b55 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1199,6 +1199,9 @@ static void ext4_put_super(struct super_block *sb)
int aborted = 0;
int i, err;
+ if (___ratelimit(&ext4_mount_msg_ratelimit, "EXT4-fs unmount"))
+ ext4_msg(sb, KERN_INFO, "unmounting filesystem.");
+
ext4_unregister_li_request(sb);
ext4_quota_off_umount(sb);
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [RFC PATCH] ext4: add unmount filesystem message 2022-04-12 14:53 [RFC PATCH] ext4: add unmount filesystem message Zhang Yi @ 2022-04-12 16:01 ` Gabriel Krisman Bertazi 2022-04-13 1:35 ` Theodore Ts'o 2022-04-12 16:40 ` Jan Kara 2022-05-13 21:15 ` Theodore Ts'o 2 siblings, 1 reply; 9+ messages in thread From: Gabriel Krisman Bertazi @ 2022-04-12 16:01 UTC (permalink / raw) To: Zhang Yi Cc: linux-ext4, tytso, adilger.kernel, jack, yukuai3, yebin10, liuzhiqiang26, liangyun2 Zhang Yi <yi.zhang@huawei.com> writes: > Now that we have kernel message at mount time, system administrator > could acquire the mount time, device and options easily. But we don't > have corresponding unmounting message at umount time, so we cannot know > if someone umount a filesystem easily. Some of the modern filesystems > (e.g. xfs) have the umounting kernel message, so add one for ext4 > filesystem for convenience. > > EXT4-fs (sdb): mounted filesystem with ordered data mode. Quota mode: none. > EXT4-fs (sdb): unmounting filesystem. I don't think sysadmins should be relying on the kernel log for this, since the information can easily be overwritten by new messages there. Is there a reason why you can't just monitor /proc/self/mountinfo? > Signed-off-by: Zhang Yi <yi.zhang@huawei.com> > --- > fs/ext4/super.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index 81749eaddf4c..bdecf62f4b55 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -1199,6 +1199,9 @@ static void ext4_put_super(struct super_block *sb) > int aborted = 0; > int i, err; > > + if (___ratelimit(&ext4_mount_msg_ratelimit, "EXT4-fs unmount")) > + ext4_msg(sb, KERN_INFO, "unmounting filesystem."); > + > ext4_unregister_li_request(sb); > ext4_quota_off_umount(sb); -- Gabriel Krisman Bertazi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH] ext4: add unmount filesystem message 2022-04-12 16:01 ` Gabriel Krisman Bertazi @ 2022-04-13 1:35 ` Theodore Ts'o 2022-04-13 2:23 ` Zhang Yi 0 siblings, 1 reply; 9+ messages in thread From: Theodore Ts'o @ 2022-04-13 1:35 UTC (permalink / raw) To: Gabriel Krisman Bertazi Cc: Zhang Yi, linux-ext4, adilger.kernel, jack, yukuai3, yebin10, liuzhiqiang26, liangyun2 On Tue, Apr 12, 2022 at 12:01:37PM -0400, Gabriel Krisman Bertazi wrote: > Zhang Yi <yi.zhang@huawei.com> writes: > > > Now that we have kernel message at mount time, system administrator "Now that we have...." is a bit misleading, since (at least to an English speaker) that this is something that was recently added, and that's not the case. > > could acquire the mount time, device and options easily. But we don't > > have corresponding unmounting message at umount time, so we cannot know > > if someone umount a filesystem easily. Some of the modern filesystems > > (e.g. xfs) have the umounting kernel message, so add one for ext4 > > filesystem for convenience. > > > > EXT4-fs (sdb): mounted filesystem with ordered data mode. Quota mode: none. > > EXT4-fs (sdb): unmounting filesystem. > > I don't think sysadmins should be relying on the kernel log for this, > since the information can easily be overwritten by new messages there. > Is there a reason why you can't just monitor /proc/self/mountinfo? You're right that it can be dangerous for sysadmins to be relying on the kernel log for mount and umount notifications --- but it depends on what they think it means, and the potential pitfalls are there for both the mount and unmount messages. The problem of course, is that bind mounts, and mount name spaces, so if the question is whether a file system is available at a particular mount point, then using the kernel log is definitely not going to be reliable. But if the goal is to determine whether a particular device is safe to run fsck or otherwise access directly, or for the purposes of debugging the kernel and looking at the logs to understand when the device is being accessed by the kernel and when the file system is done with the device, I can see how it might be useful. Cheers, - Ted ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH] ext4: add unmount filesystem message 2022-04-13 1:35 ` Theodore Ts'o @ 2022-04-13 2:23 ` Zhang Yi 2022-04-13 3:51 ` Darrick J. Wong 0 siblings, 1 reply; 9+ messages in thread From: Zhang Yi @ 2022-04-13 2:23 UTC (permalink / raw) To: Theodore Ts'o, Gabriel Krisman Bertazi Cc: linux-ext4, adilger.kernel, jack, yukuai3, yebin10, liuzhiqiang26, liangyun2 On 2022/4/13 9:35, Theodore Ts'o wrote: > On Tue, Apr 12, 2022 at 12:01:37PM -0400, Gabriel Krisman Bertazi wrote: >> Zhang Yi <yi.zhang@huawei.com> writes: >> >>> Now that we have kernel message at mount time, system administrator > > "Now that we have...." is a bit misleading, since (at least to an > English speaker) that this is something that was recently added, and > that's not the case. > >>> could acquire the mount time, device and options easily. But we don't >>> have corresponding unmounting message at umount time, so we cannot know >>> if someone umount a filesystem easily. Some of the modern filesystems >>> (e.g. xfs) have the umounting kernel message, so add one for ext4 >>> filesystem for convenience. >>> >>> EXT4-fs (sdb): mounted filesystem with ordered data mode. Quota mode: none. >>> EXT4-fs (sdb): unmounting filesystem. >> >> I don't think sysadmins should be relying on the kernel log for this, >> since the information can easily be overwritten by new messages there. >> Is there a reason why you can't just monitor /proc/self/mountinfo? > > You're right that it can be dangerous for sysadmins to be relying on > the kernel log for mount and umount notifications --- but it depends > on what they think it means, and the potential pitfalls are there for > both the mount and unmount messages. The problem of course, is that > bind mounts, and mount name spaces, so if the question is whether a > file system is available at a particular mount point, then using the > kernel log is definitely not going to be reliable. > > But if the goal is to determine whether a particular device is safe to > run fsck or otherwise access directly, or for the purposes of > debugging the kernel and looking at the logs to understand when the > device is being accessed by the kernel and when the file system is > done with the device, I can see how it might be useful. > Yes, I understand that the kernel log is not reliable, and /proc/self/mountinfo neither. Our goal is simple, As Ted said, just add a method to help sysadmins to know whether a particular ext4 device is really doing unmount procedure, it could be helpful for us to debug kernel and locate kernel bug. Thanks, Yi. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH] ext4: add unmount filesystem message 2022-04-13 2:23 ` Zhang Yi @ 2022-04-13 3:51 ` Darrick J. Wong 2022-04-13 6:33 ` Zhang Yi 0 siblings, 1 reply; 9+ messages in thread From: Darrick J. Wong @ 2022-04-13 3:51 UTC (permalink / raw) To: Zhang Yi Cc: Theodore Ts'o, Gabriel Krisman Bertazi, linux-ext4, adilger.kernel, jack, yukuai3, yebin10, liuzhiqiang26, liangyun2 On Wed, Apr 13, 2022 at 10:23:31AM +0800, Zhang Yi wrote: > On 2022/4/13 9:35, Theodore Ts'o wrote: > > On Tue, Apr 12, 2022 at 12:01:37PM -0400, Gabriel Krisman Bertazi wrote: > >> Zhang Yi <yi.zhang@huawei.com> writes: > >> > >>> Now that we have kernel message at mount time, system administrator > > > > "Now that we have...." is a bit misleading, since (at least to an > > English speaker) that this is something that was recently added, and > > that's not the case. > > > >>> could acquire the mount time, device and options easily. But we don't > >>> have corresponding unmounting message at umount time, so we cannot know > >>> if someone umount a filesystem easily. Some of the modern filesystems > >>> (e.g. xfs) have the umounting kernel message, so add one for ext4 > >>> filesystem for convenience. > >>> > >>> EXT4-fs (sdb): mounted filesystem with ordered data mode. Quota mode: none. > >>> EXT4-fs (sdb): unmounting filesystem. > >> > >> I don't think sysadmins should be relying on the kernel log for this, > >> since the information can easily be overwritten by new messages there. > >> Is there a reason why you can't just monitor /proc/self/mountinfo? > > > > You're right that it can be dangerous for sysadmins to be relying on > > the kernel log for mount and umount notifications --- but it depends > > on what they think it means, and the potential pitfalls are there for > > both the mount and unmount messages. The problem of course, is that > > bind mounts, and mount name spaces, so if the question is whether a > > file system is available at a particular mount point, then using the > > kernel log is definitely not going to be reliable. > > > > But if the goal is to determine whether a particular device is safe to > > run fsck or otherwise access directly, or for the purposes of > > debugging the kernel and looking at the logs to understand when the > > device is being accessed by the kernel and when the file system is > > done with the device, I can see how it might be useful. > > > > Yes, I understand that the kernel log is not reliable, and > /proc/self/mountinfo neither. Our goal is simple, As Ted said, just add a > method to help sysadmins to know whether a particular ext4 device is really > doing unmount procedure, it could be helpful for us to debug kernel and > locate kernel bug. But if the mount/unmount messages are ratelimited, how will you know for sure if the ratelimiting mechanism elides the message? --D > Thanks, > Yi. > > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH] ext4: add unmount filesystem message 2022-04-13 3:51 ` Darrick J. Wong @ 2022-04-13 6:33 ` Zhang Yi 2022-04-13 8:16 ` Jan Kara 0 siblings, 1 reply; 9+ messages in thread From: Zhang Yi @ 2022-04-13 6:33 UTC (permalink / raw) To: Darrick J. Wong Cc: Theodore Ts'o, Gabriel Krisman Bertazi, linux-ext4, adilger.kernel, jack, yukuai3, yebin10, liuzhiqiang26, liangyun2 On 2022/4/13 11:51, Darrick J. Wong wrote: > On Wed, Apr 13, 2022 at 10:23:31AM +0800, Zhang Yi wrote: >> On 2022/4/13 9:35, Theodore Ts'o wrote: >>> On Tue, Apr 12, 2022 at 12:01:37PM -0400, Gabriel Krisman Bertazi wrote: >>>> Zhang Yi <yi.zhang@huawei.com> writes: >>>> >>>>> Now that we have kernel message at mount time, system administrator >>> >>> "Now that we have...." is a bit misleading, since (at least to an >>> English speaker) that this is something that was recently added, and >>> that's not the case. >>> >>>>> could acquire the mount time, device and options easily. But we don't >>>>> have corresponding unmounting message at umount time, so we cannot know >>>>> if someone umount a filesystem easily. Some of the modern filesystems >>>>> (e.g. xfs) have the umounting kernel message, so add one for ext4 >>>>> filesystem for convenience. >>>>> >>>>> EXT4-fs (sdb): mounted filesystem with ordered data mode. Quota mode: none. >>>>> EXT4-fs (sdb): unmounting filesystem. >>>> >>>> I don't think sysadmins should be relying on the kernel log for this, >>>> since the information can easily be overwritten by new messages there. >>>> Is there a reason why you can't just monitor /proc/self/mountinfo? >>> >>> You're right that it can be dangerous for sysadmins to be relying on >>> the kernel log for mount and umount notifications --- but it depends >>> on what they think it means, and the potential pitfalls are there for >>> both the mount and unmount messages. The problem of course, is that >>> bind mounts, and mount name spaces, so if the question is whether a >>> file system is available at a particular mount point, then using the >>> kernel log is definitely not going to be reliable. >>> >>> But if the goal is to determine whether a particular device is safe to >>> run fsck or otherwise access directly, or for the purposes of >>> debugging the kernel and looking at the logs to understand when the >>> device is being accessed by the kernel and when the file system is >>> done with the device, I can see how it might be useful. >>> >> >> Yes, I understand that the kernel log is not reliable, and >> /proc/self/mountinfo neither. Our goal is simple, As Ted said, just add a >> method to help sysadmins to know whether a particular ext4 device is really >> doing unmount procedure, it could be helpful for us to debug kernel and >> locate kernel bug. > > But if the mount/unmount messages are ratelimited, how will you know for > sure if the ratelimiting mechanism elides the message? > This is to be expected that the messages are ratelimited, it's just a "try best" way to let us acquire more information, it's best if it write something down and not surprising if not. If the messages are ratelimited will get the "...suppressed" message and could know what happened, we will combine other logs (e.g. systemd log) to make things clear as far as possible. Thanks, Yi. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH] ext4: add unmount filesystem message 2022-04-13 6:33 ` Zhang Yi @ 2022-04-13 8:16 ` Jan Kara 0 siblings, 0 replies; 9+ messages in thread From: Jan Kara @ 2022-04-13 8:16 UTC (permalink / raw) To: Zhang Yi Cc: Darrick J. Wong, Theodore Ts'o, Gabriel Krisman Bertazi, linux-ext4, adilger.kernel, jack, yukuai3, yebin10, liuzhiqiang26, liangyun2 On Wed 13-04-22 14:33:53, Zhang Yi wrote: > On 2022/4/13 11:51, Darrick J. Wong wrote: > > On Wed, Apr 13, 2022 at 10:23:31AM +0800, Zhang Yi wrote: > >> On 2022/4/13 9:35, Theodore Ts'o wrote: > >>> On Tue, Apr 12, 2022 at 12:01:37PM -0400, Gabriel Krisman Bertazi wrote: > >>>> Zhang Yi <yi.zhang@huawei.com> writes: > >>>> > >>>>> Now that we have kernel message at mount time, system administrator > >>> > >>> "Now that we have...." is a bit misleading, since (at least to an > >>> English speaker) that this is something that was recently added, and > >>> that's not the case. > >>> > >>>>> could acquire the mount time, device and options easily. But we don't > >>>>> have corresponding unmounting message at umount time, so we cannot know > >>>>> if someone umount a filesystem easily. Some of the modern filesystems > >>>>> (e.g. xfs) have the umounting kernel message, so add one for ext4 > >>>>> filesystem for convenience. > >>>>> > >>>>> EXT4-fs (sdb): mounted filesystem with ordered data mode. Quota mode: none. > >>>>> EXT4-fs (sdb): unmounting filesystem. > >>>> > >>>> I don't think sysadmins should be relying on the kernel log for this, > >>>> since the information can easily be overwritten by new messages there. > >>>> Is there a reason why you can't just monitor /proc/self/mountinfo? > >>> > >>> You're right that it can be dangerous for sysadmins to be relying on > >>> the kernel log for mount and umount notifications --- but it depends > >>> on what they think it means, and the potential pitfalls are there for > >>> both the mount and unmount messages. The problem of course, is that > >>> bind mounts, and mount name spaces, so if the question is whether a > >>> file system is available at a particular mount point, then using the > >>> kernel log is definitely not going to be reliable. > >>> > >>> But if the goal is to determine whether a particular device is safe to > >>> run fsck or otherwise access directly, or for the purposes of > >>> debugging the kernel and looking at the logs to understand when the > >>> device is being accessed by the kernel and when the file system is > >>> done with the device, I can see how it might be useful. > >>> > >> > >> Yes, I understand that the kernel log is not reliable, and > >> /proc/self/mountinfo neither. Our goal is simple, As Ted said, just add a > >> method to help sysadmins to know whether a particular ext4 device is really > >> doing unmount procedure, it could be helpful for us to debug kernel and > >> locate kernel bug. > > > > But if the mount/unmount messages are ratelimited, how will you know for > > sure if the ratelimiting mechanism elides the message? > > > > This is to be expected that the messages are ratelimited, it's just a "try best" > way to let us acquire more information, it's best if it write something down and > not surprising if not. If the messages are ratelimited will get the "...suppressed" > message and could know what happened, we will combine other logs (e.g. systemd log) > to make things clear as far as possible. Just to add my 2c, several times when I was debugging some issue and staring into the kernel logs, I was trying to figure out whether some ext4 filesystem was still mounted or not and a message about unmounting a fs in the kernel log would have been useful to me (e.g. when I was trying to figure out whether a shared device with ext4 filesystem got really mounted from two nodes at once or whether it was first unmounted on one of the nodes). Sure, you can live without that and sure it isn't 100% reliable in all the corner cases but it is convenient at times... Honza -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH] ext4: add unmount filesystem message 2022-04-12 14:53 [RFC PATCH] ext4: add unmount filesystem message Zhang Yi 2022-04-12 16:01 ` Gabriel Krisman Bertazi @ 2022-04-12 16:40 ` Jan Kara 2022-05-13 21:15 ` Theodore Ts'o 2 siblings, 0 replies; 9+ messages in thread From: Jan Kara @ 2022-04-12 16:40 UTC (permalink / raw) To: Zhang Yi Cc: linux-ext4, tytso, adilger.kernel, jack, yukuai3, yebin10, liuzhiqiang26, liangyun2 On Tue 12-04-22 22:53:20, Zhang Yi wrote: > Now that we have kernel message at mount time, system administrator > could acquire the mount time, device and options easily. But we don't > have corresponding unmounting message at umount time, so we cannot know > if someone umount a filesystem easily. Some of the modern filesystems > (e.g. xfs) have the umounting kernel message, so add one for ext4 > filesystem for convenience. > > EXT4-fs (sdb): mounted filesystem with ordered data mode. Quota mode: none. > EXT4-fs (sdb): unmounting filesystem. > > Signed-off-by: Zhang Yi <yi.zhang@huawei.com> Makes sense. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > --- > fs/ext4/super.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index 81749eaddf4c..bdecf62f4b55 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -1199,6 +1199,9 @@ static void ext4_put_super(struct super_block *sb) > int aborted = 0; > int i, err; > > + if (___ratelimit(&ext4_mount_msg_ratelimit, "EXT4-fs unmount")) > + ext4_msg(sb, KERN_INFO, "unmounting filesystem."); > + > ext4_unregister_li_request(sb); > ext4_quota_off_umount(sb); > > -- > 2.31.1 > -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH] ext4: add unmount filesystem message 2022-04-12 14:53 [RFC PATCH] ext4: add unmount filesystem message Zhang Yi 2022-04-12 16:01 ` Gabriel Krisman Bertazi 2022-04-12 16:40 ` Jan Kara @ 2022-05-13 21:15 ` Theodore Ts'o 2 siblings, 0 replies; 9+ messages in thread From: Theodore Ts'o @ 2022-05-13 21:15 UTC (permalink / raw) To: Zhang Yi, linux-ext4 Cc: Theodore Ts'o, liuzhiqiang26, liangyun2, jack, adilger.kernel, yebin10, yukuai3 On Tue, 12 Apr 2022 22:53:20 +0800, Zhang Yi wrote: > Now that we have kernel message at mount time, system administrator > could acquire the mount time, device and options easily. But we don't > have corresponding unmounting message at umount time, so we cannot know > if someone umount a filesystem easily. Some of the modern filesystems > (e.g. xfs) have the umounting kernel message, so add one for ext4 > filesystem for convenience. > > [...] Applied, thanks! [1/1] ext4: add unmount filesystem message commit: 4808cb5b98b436f1110d83c65541dd43beb45f63 Best regards, -- Theodore Ts'o <tytso@mit.edu> ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-05-13 21:15 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-04-12 14:53 [RFC PATCH] ext4: add unmount filesystem message Zhang Yi 2022-04-12 16:01 ` Gabriel Krisman Bertazi 2022-04-13 1:35 ` Theodore Ts'o 2022-04-13 2:23 ` Zhang Yi 2022-04-13 3:51 ` Darrick J. Wong 2022-04-13 6:33 ` Zhang Yi 2022-04-13 8:16 ` Jan Kara 2022-04-12 16:40 ` Jan Kara 2022-05-13 21:15 ` Theodore Ts'o
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox