[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb2027cdccc0a0ff0a9d061fa8dd04a927c63819.camel@codethink.co.uk>
Date: Mon, 05 Aug 2019 15:12:41 +0100
From: Ben Hutchings <ben.hutchings@...ethink.co.uk>
To: Deepa Dinamani <deepa.kernel@...il.com>, viro@...iv.linux.org.uk,
linux-kernel@...r.kernel.org
Cc: linux-fsdevel@...r.kernel.org, y2038@...ts.linaro.org,
arnd@...db.de
Subject: Re: [Y2038] [PATCH 04/20] mount: Add mount warning for impending
timestamp expiry
On Mon, 2019-07-29 at 18:49 -0700, Deepa Dinamani wrote:
> The warning reuses the uptime max of 30 years used by the
> setitimeofday().
>
> Note that the warning is only added for new filesystem mounts
> through the mount syscall. Automounts do not have the same warning.
>
> Signed-off-by: Deepa Dinamani <deepa.kernel@...il.com>
> ---
> fs/namespace.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/fs/namespace.c b/fs/namespace.c
> index b26778bdc236..5314fac8035e 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -2739,6 +2739,17 @@ static int do_new_mount_fc(struct fs_context *fc, struct path *mountpoint,
> error = do_add_mount(real_mount(mnt), mountpoint, mnt_flags);
> if (error < 0)
> mntput(mnt);
> +
> + if (!error && sb->s_time_max &&
I don't know why you are testing sb->s_time_max here - it should always
be non-zero since alloc_super() sets it to TIME64_MAX.
> + (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);
> +
> + pr_warn("Mounted %s file system at %s supports timestamps until 0x%llx\n",
> + fc->fs_type->name, mntpath, (unsigned long long)sb->s_time_max);
This doesn't seem like a helpful way to log the time. Maybe use
time64_to_tm() to convert to "broken down" time and then print it with
"%ptR"... but that wants struct rtc_time. If you apply the attached
patch, however, you should then be able to print struct tm with
"%ptT".
Ben.
> + free_page((unsigned long)buf);
> + }
> +
> return error;
> }
>
--
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United Kingdom
View attachment "0001-vsprintf-Add-support-for-printing-struct-tm-in-human.patch" of type "text/x-patch" (3926 bytes)
Powered by blists - more mailing lists