From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb0-f195.google.com ([209.85.213.195]:33550 "EHLO mail-yb0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933298AbeFUVZo (ORCPT ); Thu, 21 Jun 2018 17:25:44 -0400 Received: by mail-yb0-f195.google.com with SMTP id e84-v6so1785972ybb.0 for ; Thu, 21 Jun 2018 14:25:44 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1529615710251120@kroah.com> References: <1529615710251120@kroah.com> From: Amir Goldstein Date: Fri, 22 Jun 2018 00:25:43 +0300 Message-ID: Subject: Re: FAILED: patch "[PATCH] ext4: do not update s_last_mounted of a frozen fs" failed to apply to 4.17-stable tree To: Greg KH Cc: Jan Kara , Theodore Tso , stable Content-Type: text/plain; charset="UTF-8" Sender: stable-owner@vger.kernel.org List-ID: On Fri, Jun 22, 2018 at 12:15 AM, wrote: > > The patch below does not apply to the 4.17-stable tree. There is a [backport hint] at the end of the commit message. Need to take the 2 prep commits. Same for all stable branches. Cheers, Amir. > If someone wants it applied there, or to any other stable or longterm > tree, then please email the backport, including the original git commit > id to . > > thanks, > > greg k-h > > ------------------ original commit in Linus's tree ------------------ > > From db6516a5e7ddb6dc72d167b920f2f272596ea22d Mon Sep 17 00:00:00 2001 > From: Amir Goldstein > Date: Sun, 13 May 2018 22:54:44 -0400 > Subject: [PATCH] ext4: do not update s_last_mounted of a frozen fs > > If fs is frozen after mount and before the first file open, the > update of s_last_mounted bypasses freeze protection and prints out > a WARNING splat: > > $ mount /vdf > $ fsfreeze -f /vdf > $ cat /vdf/foo > > [ 31.578555] WARNING: CPU: 1 PID: 1415 at > fs/ext4/ext4_jbd2.c:53 ext4_journal_check_start+0x48/0x82 > > [ 31.614016] Call Trace: > [ 31.614997] __ext4_journal_start_sb+0xe4/0x1a4 > [ 31.616771] ? ext4_file_open+0xb6/0x189 > [ 31.618094] ext4_file_open+0xb6/0x189 > > If fs is frozen, skip s_last_mounted update. > > [backport hint: to apply to stable tree, need to apply also patches > vfs: add the sb_start_intwrite_trylock() helper > ext4: factor out helper ext4_sample_last_mounted()] > > Cc: stable@vger.kernel.org > Fixes: bc0b0d6d69ee ("ext4: update the s_last_mounted field in the superblock") > Signed-off-by: Amir Goldstein > Signed-off-by: Theodore Ts'o > Reviewed-by: Jan Kara > > diff --git a/fs/ext4/file.c b/fs/ext4/file.c > index c48ea76b63e4..7f8023340eb8 100644 > --- a/fs/ext4/file.c > +++ b/fs/ext4/file.c > @@ -393,7 +393,7 @@ static int ext4_sample_last_mounted(struct super_block *sb, > if (likely(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED)) > return 0; > > - if (sb_rdonly(sb)) > + if (sb_rdonly(sb) || !sb_start_intwrite_trylock(sb)) > return 0; > > sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED; > @@ -407,21 +407,25 @@ static int ext4_sample_last_mounted(struct super_block *sb, > path.mnt = mnt; > path.dentry = mnt->mnt_root; > cp = d_path(&path, buf, sizeof(buf)); > + err = 0; > if (IS_ERR(cp)) > - return 0; > + goto out; > > handle = ext4_journal_start_sb(sb, EXT4_HT_MISC, 1); > + err = PTR_ERR(handle); > if (IS_ERR(handle)) > - return PTR_ERR(handle); > + goto out; > BUFFER_TRACE(sbi->s_sbh, "get_write_access"); > err = ext4_journal_get_write_access(handle, sbi->s_sbh); > if (err) > - goto out; > + goto out_journal; > strlcpy(sbi->s_es->s_last_mounted, cp, > sizeof(sbi->s_es->s_last_mounted)); > ext4_handle_dirty_super(handle, sb); > -out: > +out_journal: > ext4_journal_stop(handle); > +out: > + sb_end_intwrite(sb); > return err; > } > >