From patchwork Tue Mar 22 21:39:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39B98C43217 for ; Tue, 22 Mar 2022 21:39:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A98446B0088; Tue, 22 Mar 2022 17:39:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A8C66B0089; Tue, 22 Mar 2022 17:39:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 898936B008A; Tue, 22 Mar 2022 17:39:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 6F6316B0088 for ; Tue, 22 Mar 2022 17:39:25 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2ECAEA4DDC for ; Tue, 22 Mar 2022 21:39:25 +0000 (UTC) X-FDA: 79273338690.19.8765046 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id AE7DB40035 for ; Tue, 22 Mar 2022 21:39:24 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1B6D861723; Tue, 22 Mar 2022 21:39:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7648DC340EC; Tue, 22 Mar 2022 21:39:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985163; bh=CSiPFmisQO0zSb6xFEMkzK913NpWiS9pxubMf+egv5w=; h=Date:To:From:In-Reply-To:Subject:From; b=01IZSxORs2gMHaLw8epFkj1j/leSGM7AwrVZfSJIe80qajj+0BOTCe9w3PD0q8dwR RvVKDLcN3tuJyzmmp1NSX1OU5Ozsvfo6YBLKeXViPRqxPsZvEQNKJHXuvD5d4bz0W2 qXGa9nAsOyNFjffUl21ysZg8KOsVA1HrkdErFKVc= Date: Tue, 22 Mar 2022 14:39:22 -0700 To: viro@zeniv.linux.org.uk,hch@lst.de,djwong@kernel.org,deepa.kernel@gmail.com,christian.brauner@ubuntu.com,ailiop@suse.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 017/227] mount: warn only once about timestamp range expiration Message-Id: <20220322213923.7648DC340EC@smtp.kernel.org> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: AE7DB40035 X-Stat-Signature: 8zwjf1m5ifrff8rpg437xd14anrxa5m9 X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=01IZSxOR; dmarc=none; spf=pass (imf27.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1647985164-639354 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Anthony Iliopoulos Subject: mount: warn only once about timestamp range expiration 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]. [1] https://lore.kernel.org/CAHk-=wim6VGnxQmjfK_tDg6fbHYKL4EFkmnTjVr9QnRqjDBAeA@mail.gmail.com/ Link: https://lkml.kernel.org/r/20220119202934.26495-1-ailiop@suse.com Signed-off-by: Anthony Iliopoulos Reviewed-by: Christoph Hellwig Acked-by: Christian Brauner Reviewed-by: Darrick J. Wong Cc: Alexander Viro Cc: Deepa Dinamani Signed-off-by: Andrew Morton --- fs/namespace.c | 2 ++ include/linux/fs.h | 1 + 2 files changed, 3 insertions(+) --- a/fs/namespace.c~mount-warn-only-once-about-timestamp-range-expiration +++ a/fs/namespace.c @@ -2597,6 +2597,7 @@ static void mnt_warn_timestamp_expiry(st 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); @@ -2611,6 +2612,7 @@ static void mnt_warn_timestamp_expiry(st tm.tm_year+1900, (unsigned long long)sb->s_time_max); free_page((unsigned long)buf); + sb->s_iflags |= SB_I_TS_EXPIRY_WARNED; } } --- a/include/linux/fs.h~mount-warn-only-once-about-timestamp-range-expiration +++ a/include/linux/fs.h @@ -1440,6 +1440,7 @@ extern int send_sigurg(struct fown_struc #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 {