public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>
Cc: Karel Zak <kzak@redhat.com>,
	Dmitry Monakhov <dmtrmonakhov@yandex-team.ru>
Subject: [PATCH] ext4: fix handling mount -o remount,nolazytime
Date: Wed, 19 Feb 2020 12:19:52 +0300	[thread overview]
Message-ID: <158210399258.5335.3994877510070204710.stgit@buzz> (raw)

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@yandex-team.ru>
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;


             reply	other threads:[~2020-02-19  9:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19  9:19 Konstantin Khlebnikov [this message]
2020-02-19 16:22 ` [PATCH] ext4: fix handling mount -o remount,nolazytime Theodore Y. Ts'o
2020-02-20 15:11   ` Konstantin Khlebnikov
2020-02-20 18:22     ` Theodore Y. Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=158210399258.5335.3994877510070204710.stgit@buzz \
    --to=khlebnikov@yandex-team.ru \
    --cc=adilger.kernel@dilger.ca \
    --cc=dmtrmonakhov@yandex-team.ru \
    --cc=kzak@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox