linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] mount: warn only once about timestamp range expiration
@ 2022-01-19 20:29 Anthony Iliopoulos
  2022-01-20  7:25 ` Christoph Hellwig
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Anthony Iliopoulos @ 2022-01-19 20:29 UTC (permalink / raw)
  To: Alexander Viro, Andrew Morton, Deepa Dinamani; +Cc: linux-fsdevel, linux-kernel

Commit f8b92ba67c5d ("mount: Add mount warning for impending timestamp
expiry") introduced a mount warning regarding filesystem timestamp
limits, that is printed upon each writable mount or remount.

This can result in a lot of unnecessary messages in the kernel log in
setups where filesystems are being frequently remounted (or mounted
multiple times).

Avoid this by setting a superblock flag which indicates that the warning
has been emitted at least once for any particular mount, as suggested in
[1].

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>

[1] https://lore.kernel.org/CAHk-=wim6VGnxQmjfK_tDg6fbHYKL4EFkmnTjVr9QnRqjDBAeA@mail.gmail.com/
---
 fs/namespace.c     | 2 ++
 include/linux/fs.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/fs/namespace.c b/fs/namespace.c
index c6feb92209a6..fec0f79aa2eb 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2583,6 +2583,7 @@ static void mnt_warn_timestamp_expiry(struct path *mountpoint, struct vfsmount *
 	struct super_block *sb = mnt->mnt_sb;
 
 	if (!__mnt_is_readonly(mnt) &&
+	   (!(sb->s_iflags & SB_I_TS_EXPIRY_WARNED)) &&
 	   (ktime_get_real_seconds() + TIME_UPTIME_SEC_MAX > sb->s_time_max)) {
 		char *buf = (char *)__get_free_page(GFP_KERNEL);
 		char *mntpath = buf ? d_path(mountpoint, buf, PAGE_SIZE) : ERR_PTR(-ENOMEM);
@@ -2597,6 +2598,7 @@ static void mnt_warn_timestamp_expiry(struct path *mountpoint, struct vfsmount *
 			tm.tm_year+1900, (unsigned long long)sb->s_time_max);
 
 		free_page((unsigned long)buf);
+		sb->s_iflags |= SB_I_TS_EXPIRY_WARNED;
 	}
 }
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f3daaea16554..5c537cd9b006 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1435,6 +1435,7 @@ extern int send_sigurg(struct fown_struct *fown);
 
 #define SB_I_SKIP_SYNC	0x00000100	/* Skip superblock at global sync */
 #define SB_I_PERSB_BDI	0x00000200	/* has a per-sb bdi */
+#define SB_I_TS_EXPIRY_WARNED 0x00000400 /* warned about timestamp range expiry */
 
 /* Possible states of 'frozen' field */
 enum {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] mount: warn only once about timestamp range expiration
  2022-01-19 20:29 [PATCH RESEND] mount: warn only once about timestamp range expiration Anthony Iliopoulos
@ 2022-01-20  7:25 ` Christoph Hellwig
  2022-01-20  8:47 ` Christian Brauner
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2022-01-20  7:25 UTC (permalink / raw)
  To: Anthony Iliopoulos
  Cc: Alexander Viro, Andrew Morton, Deepa Dinamani, linux-fsdevel,
	linux-kernel

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] mount: warn only once about timestamp range expiration
  2022-01-19 20:29 [PATCH RESEND] mount: warn only once about timestamp range expiration Anthony Iliopoulos
  2022-01-20  7:25 ` Christoph Hellwig
@ 2022-01-20  8:47 ` Christian Brauner
  2022-01-20 18:03 ` Darrick J. Wong
  2022-01-31  2:52 ` Al Viro
  3 siblings, 0 replies; 6+ messages in thread
From: Christian Brauner @ 2022-01-20  8:47 UTC (permalink / raw)
  To: Anthony Iliopoulos
  Cc: Alexander Viro, Andrew Morton, Deepa Dinamani, linux-fsdevel,
	linux-kernel

On Wed, Jan 19, 2022 at 09:29:34PM +0100, Anthony Iliopoulos wrote:
> Commit f8b92ba67c5d ("mount: Add mount warning for impending timestamp
> expiry") introduced a mount warning regarding filesystem timestamp
> limits, that is printed upon each writable mount or remount.
> 
> This can result in a lot of unnecessary messages in the kernel log in
> setups where filesystems are being frequently remounted (or mounted
> multiple times).
> 
> Avoid this by setting a superblock flag which indicates that the warning
> has been emitted at least once for any particular mount, as suggested in
> [1].
> 
> Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
> 
> [1] https://lore.kernel.org/CAHk-=wim6VGnxQmjfK_tDg6fbHYKL4EFkmnTjVr9QnRqjDBAeA@mail.gmail.com/
> ---

Acked-by: Christian Brauner <christian.brauner@ubuntu.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] mount: warn only once about timestamp range expiration
  2022-01-19 20:29 [PATCH RESEND] mount: warn only once about timestamp range expiration Anthony Iliopoulos
  2022-01-20  7:25 ` Christoph Hellwig
  2022-01-20  8:47 ` Christian Brauner
@ 2022-01-20 18:03 ` Darrick J. Wong
  2022-01-31  2:52 ` Al Viro
  3 siblings, 0 replies; 6+ messages in thread
From: Darrick J. Wong @ 2022-01-20 18:03 UTC (permalink / raw)
  To: Anthony Iliopoulos
  Cc: Alexander Viro, Andrew Morton, Deepa Dinamani, linux-fsdevel,
	linux-kernel

On Wed, Jan 19, 2022 at 09:29:34PM +0100, Anthony Iliopoulos wrote:
> Commit f8b92ba67c5d ("mount: Add mount warning for impending timestamp
> expiry") introduced a mount warning regarding filesystem timestamp
> limits, that is printed upon each writable mount or remount.
> 
> This can result in a lot of unnecessary messages in the kernel log in
> setups where filesystems are being frequently remounted (or mounted
> multiple times).
> 
> Avoid this by setting a superblock flag which indicates that the warning
> has been emitted at least once for any particular mount, as suggested in
> [1].
> 
> Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>

I'm glad someone finally turned down the volume on this.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> 
> [1] https://lore.kernel.org/CAHk-=wim6VGnxQmjfK_tDg6fbHYKL4EFkmnTjVr9QnRqjDBAeA@mail.gmail.com/
> ---
>  fs/namespace.c     | 2 ++
>  include/linux/fs.h | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/fs/namespace.c b/fs/namespace.c
> index c6feb92209a6..fec0f79aa2eb 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -2583,6 +2583,7 @@ static void mnt_warn_timestamp_expiry(struct path *mountpoint, struct vfsmount *
>  	struct super_block *sb = mnt->mnt_sb;
>  
>  	if (!__mnt_is_readonly(mnt) &&
> +	   (!(sb->s_iflags & SB_I_TS_EXPIRY_WARNED)) &&
>  	   (ktime_get_real_seconds() + TIME_UPTIME_SEC_MAX > sb->s_time_max)) {
>  		char *buf = (char *)__get_free_page(GFP_KERNEL);
>  		char *mntpath = buf ? d_path(mountpoint, buf, PAGE_SIZE) : ERR_PTR(-ENOMEM);
> @@ -2597,6 +2598,7 @@ static void mnt_warn_timestamp_expiry(struct path *mountpoint, struct vfsmount *
>  			tm.tm_year+1900, (unsigned long long)sb->s_time_max);
>  
>  		free_page((unsigned long)buf);
> +		sb->s_iflags |= SB_I_TS_EXPIRY_WARNED;
>  	}
>  }
>  
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index f3daaea16554..5c537cd9b006 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1435,6 +1435,7 @@ extern int send_sigurg(struct fown_struct *fown);
>  
>  #define SB_I_SKIP_SYNC	0x00000100	/* Skip superblock at global sync */
>  #define SB_I_PERSB_BDI	0x00000200	/* has a per-sb bdi */
> +#define SB_I_TS_EXPIRY_WARNED 0x00000400 /* warned about timestamp range expiry */
>  
>  /* Possible states of 'frozen' field */
>  enum {
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] mount: warn only once about timestamp range expiration
  2022-01-19 20:29 [PATCH RESEND] mount: warn only once about timestamp range expiration Anthony Iliopoulos
                   ` (2 preceding siblings ...)
  2022-01-20 18:03 ` Darrick J. Wong
@ 2022-01-31  2:52 ` Al Viro
  2022-02-07 22:10   ` Christian Kujau
  3 siblings, 1 reply; 6+ messages in thread
From: Al Viro @ 2022-01-31  2:52 UTC (permalink / raw)
  To: Anthony Iliopoulos
  Cc: Andrew Morton, Deepa Dinamani, linux-fsdevel, linux-kernel

On Wed, Jan 19, 2022 at 09:29:34PM +0100, Anthony Iliopoulos wrote:
> Commit f8b92ba67c5d ("mount: Add mount warning for impending timestamp
> expiry") introduced a mount warning regarding filesystem timestamp
> limits, that is printed upon each writable mount or remount.
> 
> This can result in a lot of unnecessary messages in the kernel log in
> setups where filesystems are being frequently remounted (or mounted
> multiple times).
> 
> Avoid this by setting a superblock flag which indicates that the warning
> has been emitted at least once for any particular mount, as suggested in
> [1].

Looks sane, except for the locking rules for ->s_iflags stores...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND] mount: warn only once about timestamp range expiration
  2022-01-31  2:52 ` Al Viro
@ 2022-02-07 22:10   ` Christian Kujau
  0 siblings, 0 replies; 6+ messages in thread
From: Christian Kujau @ 2022-02-07 22:10 UTC (permalink / raw)
  To: Anthony Iliopoulos
  Cc: Andrew Morton, Deepa Dinamani, linux-fsdevel, linux-kernel,
	Al Viro, Salvatore Bonaccorso, Jeff Layton, Eric Biggers

> On Wed, Jan 19, 2022 at 09:29:34PM +0100, Anthony Iliopoulos wrote:
> Commit f8b92ba67c5d ("mount: Add mount warning for impending timestamp
> expiry") introduced a mount warning regarding filesystem timestamp
> limits, that is printed upon each writable mount or remount.
> 
> This can result in a lot of unnecessary messages in the kernel log in
> setups where filesystems are being frequently remounted (or mounted
> multiple times).
> 
> Avoid this by setting a superblock flag which indicates that the warning
> has been emitted at least once for any particular mount, as suggested in

Great! I hope this lands in mainline soon. Applied this to 5.17.0-rc3 here 
and it warns on mounts, but not on remounts. Yay!

  Tested-by: Christian Kujau <lists@nerdbynature.de>

Thanks so much for not forgetting about this!
-- 
BOFH excuse #402:

Secretary sent chain letter to all 5000 employees.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-07 22:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 20:29 [PATCH RESEND] mount: warn only once about timestamp range expiration Anthony Iliopoulos
2022-01-20  7:25 ` Christoph Hellwig
2022-01-20  8:47 ` Christian Brauner
2022-01-20 18:03 ` Darrick J. Wong
2022-01-31  2:52 ` Al Viro
2022-02-07 22:10   ` Christian Kujau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).