Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1821166imm; Mon, 3 Sep 2018 10:17:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbB6uQ9ZTrFdIgluRFyW8MndVrqiviQXtKf4V3IYUsC50SCHADsOtO/eWlhtcR8FC+IZ1yb X-Received: by 2002:a17:902:6501:: with SMTP id b1-v6mr29551385plk.31.1535995051367; Mon, 03 Sep 2018 10:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995051; cv=none; d=google.com; s=arc-20160816; b=lNojtnE5BiIq4LBUSBS6lfjkDud1jNv6r4NIqUQV/Xj7AVAjTcwazgpgaMFS3N28XH bfFIzHtkMS9ITyA+AAGcPDwuLpQeTMbqWW59dSgi4G5Wd0HocsgcDLLG9Utz+ri8BmgH q5rTVIyimyEBue+wgDLzcHul8LHXL1HcE1EG0WYzNXJZ8I/olRQB2OpLk49JVYM3NcTm YTaQ3JvZsLVZqkdNmeXOCJy//a/Vp6EpXE5o7V5YCJwy8nhOaYwpMBxeo77VmJFbpePN 1ksmvuvm30YNnR/G3w0nzl4sGbUHtuYAj2iOPC37sAbpMDa+im+EkIEyTX3GjgVPBEGR +oUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=WoEnv+jgoRh0eK1esz+KYSvfAt7+V+/thu9uNUew5ts=; b=jNJoY4cC9678Vwpm7Gm1ZP4kQB81o9B6UPtpICXIgQ8K3Bxq2UAuCuZ4RvlnFmSpsZ v+Hy71WyxFSm8tCsudfLEORjnthOaYmStXdpDvnMQLqhgzBqZBnVJGBGqY+R/1Yj2Syr N8dMgCcrHQouRi4XLv3zySIuyFDcEYe6OZDIIffr1XUUycsIG8phyyzWenga8olLOKWf PzfG2dPT58o3ugSw0Xb8InVNfMQVlUQ8GRvBchV7/ybucYHjQc/L0nSHCJSt9LnZEiLa v0cqYoQamBw71evAkOA/E/Pm1Vo4mp7pmseKqsQm543tExVNSF3+Yv3He3Nn9PXkmKOl RYvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s29-v6si17738772pgn.47.2018.09.03.10.17.15; Mon, 03 Sep 2018 10:17:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729842AbeICVhR (ORCPT + 99 others); Mon, 3 Sep 2018 17:37:17 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42518 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727942AbeICVhQ (ORCPT ); Mon, 3 Sep 2018 17:37:16 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D9CF9D06; Mon, 3 Sep 2018 17:16:11 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , Andreas Dilger , Sasha Levin Subject: [PATCH 4.14 007/165] ext4: clear mmp sequence number when remounting read-only Date: Mon, 3 Sep 2018 18:54:53 +0200 Message-Id: <20180903165655.374039052@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Theodore Ts'o [ Upstream commit 2dca60d98e241bea686004168f85208f215fc697 ] Previously, when an MMP-protected file system is remounted read-only, the kmmpd thread would exit the next time it woke up (a few seconds later), without resetting the MMP sequence number back to EXT4_MMP_SEQ_CLEAN. Fix this by explicitly killing the MMP thread when the file system is remounted read-only. Signed-off-by: Theodore Ts'o Cc: Andreas Dilger Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/ext4/mmp.c | 7 ++----- fs/ext4/super.c | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) --- a/fs/ext4/mmp.c +++ b/fs/ext4/mmp.c @@ -186,11 +186,8 @@ static int kmmpd(void *data) goto exit_thread; } - if (sb_rdonly(sb)) { - ext4_warning(sb, "kmmpd being stopped since filesystem " - "has been remounted as readonly."); - goto exit_thread; - } + if (sb_rdonly(sb)) + break; diff = jiffies - last_update_time; if (diff < mmp_update_interval * HZ) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5163,6 +5163,8 @@ static int ext4_remount(struct super_blo if (sbi->s_journal) ext4_mark_recovery_complete(sb, es); + if (sbi->s_mmp_tsk) + kthread_stop(sbi->s_mmp_tsk); } else { /* Make sure we can mount this feature set readwrite */ if (ext4_has_feature_readonly(sb) ||