From patchwork Tue Sep 19 08:35:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Trippelsdorf X-Patchwork-Id: 9958463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E349B601E9 for ; Tue, 19 Sep 2017 08:41:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB7B7288AD for ; Tue, 19 Sep 2017 08:41:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B04B628C70; Tue, 19 Sep 2017 08:41:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBAB5288AD for ; Tue, 19 Sep 2017 08:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751227AbdISIlu (ORCPT ); Tue, 19 Sep 2017 04:41:50 -0400 Received: from ud10.udmedia.de ([194.117.254.50]:46224 "EHLO mail.ud10.udmedia.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751109AbdISIlu (ORCPT ); Tue, 19 Sep 2017 04:41:50 -0400 X-Greylist: delayed 401 seconds by postgrey-1.27 at vger.kernel.org; Tue, 19 Sep 2017 04:41:49 EDT DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=mail.ud10.udmedia.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=k1; bh=zTnmEwQkiVA3059WrtyD+Xa0PYti Ubf0eHxPoZKJrvM=; b=MzcwHCbvuIEYhcn+clOf+TSb8CvgZVOyo5yrC8PI4wDk tQ2oplo3xQ8gBFmsSPCrtaesKT3u2eNdGs+4RxopkXvD2m0QT/KdxLi/Zz3jTEoC ffSHnJ9aAnRMOcgHryukeZZxwfNLFIDuqthWf2UUF2hym0/PJmwcFr8nYfye8X4= Received: (qmail 22852 invoked from network); 19 Sep 2017 10:35:06 +0200 Received: from ip5b405f48.dynamic.kabel-deutschland.de (HELO x4) (ud10?360p3@91.64.95.72) by mail.ud10.udmedia.de with ESMTPSA (ECDHE-RSA-AES256-SHA encrypted, authenticated); 19 Sep 2017 10:35:06 +0200 Date: Tue, 19 Sep 2017 10:35:06 +0200 From: Markus Trippelsdorf To: Theodore Ts'o Cc: Andreas Dilger , linux-ext4@vger.kernel.org, Alexander Viro , linux-fsdevel@vger.kernel.org Subject: Re: mounting with lazytime doesn't work on ext4 Message-ID: <20170919083506.GA233@x4> References: <20170918192644.GA232@x4> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170918192644.GA232@x4> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 2017.09.18 at 21:26 +0200, Markus Trippelsdorf wrote: > I switched back to ext4 yesterday, because my btrfs fs got corrupted. > However mounting with lazytime doesn't work, neither specifying it in > /etc/fstab nor a manual remount. It looks like the option is simply > ignored. > > Strace shows, e.g.: > > # mount -o lazytime /boot > mount("/dev/sdc2", "/boot", "ext4", MS_LAZYTIME, NULL) = 0 > EXT4-fs (sdc2): mounted filesystem with ordered data mode. Opts: (null) > /dev/sdc2 on /boot type ext4 (rw,relatime,data=ordered) > > # mount -o remount,lazytime /var > mount("/dev/sdb2", "/var", 0x12c4460, MS_REMOUNT|MS_NOATIME|MS_LAZYTIME, NULL) = 0 > EXT4-fs (sdb2): re-mounted. Opts: (null) > /dev/sdb2 on /var type ext4 (rw,noatime,data=ordered) > > When I set "sb->s_flags |= MS_LAZYTIME;" unconditionally in > fs/ext4/super.c:5057 (just deleting the if statement), then lazytime > gets used when I remount. > > I'm running the latest git tree (4.14.0-rc1). The following patch seems to fix the issue for remounts: diff --git a/fs/namespace.c b/fs/namespace.c index 54059b142d6b..d0b386706c5b 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2322,6 +2322,9 @@ static int do_remount(struct path *path, int ms_flags, int sb_flags, if (err) return err; + if (mnt_flags & MS_LAZYTIME) + sb_flags |= MS_LAZYTIME; + down_write(&sb->s_umount); if (ms_flags & MS_BIND) err = change_mount_flags(path->mnt, ms_flags); @@ -2809,6 +2812,8 @@ long do_mount(const char *dev_name, const char __user *dir_name, mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME); if (flags & SB_RDONLY) mnt_flags |= MNT_READONLY; + if (flags & MS_LAZYTIME) + mnt_flags |= MS_LAZYTIME; /* The default atime for remount is preservation */ if ((flags & MS_REMOUNT) &&