Skip to content

Commit

Permalink
fs: Restore mnt_warn_timestamp_expiry
Browse files Browse the repository at this point in the history
Include removed code from upstream in a disabled state to make it easier
for us to follow upstream (e.g. when mnt_warn_timestamp_expiry evolves).
  • Loading branch information
donald committed Apr 4, 2022
1 parent 71c3565 commit 51f051d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions fs/namespace.c
Original file line number Diff line number Diff line change
@@ -2606,6 +2606,30 @@ static void set_mount_attributes(struct mount *mnt, unsigned int mnt_flags)
touch_mnt_namespace(mnt->mnt_ns);
}

static void mnt_warn_timestamp_expiry(struct path *mountpoint, struct vfsmount *mnt)
{
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);
struct tm tm;

time64_to_tm(sb->s_time_max, 0, &tm);

pr_warn("%s filesystem being %s at %s supports timestamps until %04ld (0x%llx)\n",
sb->s_type->name,
is_mounted(mnt) ? "remounted" : "mounted",
mntpath,
tm.tm_year+1900, (unsigned long long)sb->s_time_max);

free_page((unsigned long)buf);
sb->s_iflags |= SB_I_TS_EXPIRY_WARNED;
}
}

/*
* Handle reconfiguration of the mountpoint only without alteration of the
* superblock it refers to. This is triggered by specifying MS_REMOUNT|MS_BIND
@@ -2638,6 +2662,8 @@ static int do_reconfigure_mnt(struct path *path, unsigned int mnt_flags)
unlock_mount_hash();
up_read(&sb->s_umount);

if (0) mnt_warn_timestamp_expiry(path, &mnt->mnt);

return ret;
}

@@ -2683,6 +2709,8 @@ static int do_remount(struct path *path, int ms_flags, int sb_flags,
up_write(&sb->s_umount);
}

if (0) mnt_warn_timestamp_expiry(path, &mnt->mnt);

put_fs_context(fc);
return err;
}
@@ -2950,6 +2978,8 @@ static int do_new_mount_fc(struct fs_context *fc, struct path *mountpoint,
if (IS_ERR(mnt))
return PTR_ERR(mnt);

if (0) mnt_warn_timestamp_expiry(mountpoint, mnt);

mp = lock_mount(mountpoint);
if (IS_ERR(mp)) {
mntput(mnt);

0 comments on commit 51f051d

Please sign in to comment.