[PATCH] ext4: fix handling mount -o remount,nolazytime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tool "mount" from util-linux >= 2.27 knows about flag MS_LAZYTIME and
handles options "lazytime" and "nolazytime" as fs-independent.

For ext4 it works for enabling lazytime: mount(MS_REMOUNT | MS_LAZYTIME),
but does not work for disabling: mount(MS_REMOUNT).

Currently ext4 has performance issue in lazytime implementation caused by
contention around inode_hash_lock in ext4_update_other_inodes_time().

Fortunately lazytime still could be disabled without unmounting by passing
"nolazytime" as fs-specific mount option: mount(MS_REMOUNT, "nolazytime").
But modern versions of tool "mount" cannot do that.

This patch fixes remount for modern tool and keeps backward compatibility.

Fixes: a2fd66d069d8 ("ext4: set lazytime on remount if MS_LAZYTIME is set by mount")
Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxxxxxx>
Link: https://lore.kernel.org/lkml/158040603451.1879.7954684107752709143.stgit@buzz/
---
 fs/ext4/super.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index f464dff09774..c901dc957b97 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5339,6 +5339,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 	if (sbi->s_journal && sbi->s_journal->j_task->io_context)
 		journal_ioprio = sbi->s_journal->j_task->io_context->ioprio;
 
+	if (!(*flags & SB_LAZYTIME))
+		sb->s_flags &= ~SB_LAZYTIME;
+
 	if (!parse_options(data, sb, NULL, &journal_ioprio, 1)) {
 		err = -EINVAL;
 		goto restore_opts;




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux