Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1330916ybt; Sun, 14 Jun 2020 19:14:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ9v/z9tXzfOsFNYohwLETfAPPGbvFpIwiTXJVA1+voRnmPvh9egT4QhGaUD1lKGUrvRqq X-Received: by 2002:a17:906:aec5:: with SMTP id me5mr11562686ejb.54.1592187265998; Sun, 14 Jun 2020 19:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592187265; cv=none; d=google.com; s=arc-20160816; b=sZwQOQpRg5GHDGGwCFe3CGgvJ630pF0D5BDoMyrPFaSRDo14mwDuqhhUWGchuDYacZ fiO62gZpr2mUEy84u8pXIRRpX7HB7Wzuo2rvbOiLpEQ0wTN8nmPphdUtzSAp2Jkd5Fqe Dzvd9VHRx7mXTlS/q8gMdmdfxBVBZX4f4OoduxU01tXn/4V89MnlEOHQO8Af8k4SwHYa Ydb5wVLqYD+eB1t+Wb6dez6P5SYYAJYj+5HKVP8VyQXYTuWgKD2NySHGsOADQRLrjbS/ wW7HReQbcG9K+OSPaf+2IEdm0rDHYyDf57/aOMNyELiQ4YlDwhr5EZ5fI1GP9wlPZ+yI Yr3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dMBK5oYEMgHflOO7BRyl4WGKXVxa2jtMA+k/vhWciKk=; b=mdOeXt1TRgVQg8TqbK8fagt5uNB9DhJxtZWA+wmRlWbvnRpmeMZjLwLCfCOU7fZYaa pe/+c38OW9D1cwU9h0LAC+nK6d7KukYUWQg+mSgpzHTSs0HoHnWZYIlxBL4ArJqcHV5z CMpckMDjhw8ETnVyOkoMB7rbdXH7Ho5qH8dMHR/72BcYIk1Q+6rrCzqIBaLLr6BauzLU n6hbaoxEm59JPJcpemRrwAjDj8SeDsZWrU2RTdDjM8Bdg8XiFhDxhbOuiDAPCKPpDRt0 p6saSVDH4x0zeXQK+PyVnADLatJkJupl2ylbeetl+V1/xFndkoLN9bsCssimXfvEgS1S c56Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qu8bssB4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s7si8404409ejo.438.2020.06.14.19.14.04; Sun, 14 Jun 2020 19:14:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qu8bssB4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728121AbgFOCKo (ORCPT + 99 others); Sun, 14 Jun 2020 22:10:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727971AbgFOCKm (ORCPT ); Sun, 14 Jun 2020 22:10:42 -0400 Received: from mail-ua1-x943.google.com (mail-ua1-x943.google.com [IPv6:2607:f8b0:4864:20::943]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 020C7C061A0E; Sun, 14 Jun 2020 19:10:40 -0700 (PDT) Received: by mail-ua1-x943.google.com with SMTP id b10so5141106uaf.0; Sun, 14 Jun 2020 19:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=dMBK5oYEMgHflOO7BRyl4WGKXVxa2jtMA+k/vhWciKk=; b=qu8bssB48g/cVVJ8F2DTNqF3V0Ic9yaWaKNT7tW4xiOQcfUu8as+lhhv2YK2wNZRt8 HC5NH1n+MFLu1cqWf063DRiph/3/xNgL2thVA7s5Mzq1/1zTV5qM8uAHV7n9PcoDcMb5 OKsj0fZ6ASWyZNmFOaPBP4IUeelL2yq0SYj2Zc8HUm+7Y2QnjqULmR46uq7s15HrvfXg n+ewKODa/xzB0ULIemz/CQ/cuW+uT+UssMD1KwGmA4LRTPrfAzZcCZgL9RlkuD+yowQN rTFj3fDLnRAJ/ILZ+FY9XoH2zRTi286WLU1VpH3WoWeKT3Swh/y9N8R/7vl+wtLRA0px uXAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=dMBK5oYEMgHflOO7BRyl4WGKXVxa2jtMA+k/vhWciKk=; b=sES4NETx1vhQCm/siIE8AroqyhcwNJHOIsMMGf5fBgZYDMJSckkHgsV74TCJkk5kH2 ebSRFFqJy4trIW+Zs0auDtacnPjsIdYlHXrWP4PRSmCzlqn4JBxAK4Ts4mHPFU2A0c5C OvJEF9dLw271SKos8X08lX8kdSCxWmzqhpmcGbibMkeesYWoWaLSnpLcVUrIc7jGyFYS K3qPADLkIQaJRipQCAJiUwc75vri0KfY49/++DtMGTi+/72CPWhj+zFsM0NftokJkKGq /zIy8NCr/zOnd9q/lwT8x2nLRIGlZSqn3bFmEH00qn+RzOLMYf8KIKQ7ddNRsIyUlr8a YrEw== X-Gm-Message-State: AOAM530N/P263W5c0qwkSoLDNHdPsqZIDF2wO0nGgmSp0+cdtUyP+svi jBMsrZ+a59bKFlfuaCmvOcFm+ftglaoKvFNpCeCNjQ== X-Received: by 2002:ab0:7244:: with SMTP id d4mr16854925uap.60.1592187039792; Sun, 14 Jun 2020 19:10:39 -0700 (PDT) MIME-Version: 1.0 References: <20200612094250.9347-1-hyc.lee@gmail.com> <001401d642a9$f74c3040$e5e490c0$@samsung.com> In-Reply-To: <001401d642a9$f74c3040$e5e490c0$@samsung.com> From: Hyunchul Lee Date: Mon, 15 Jun 2020 11:10:24 +0900 Message-ID: Subject: Re: [PATCH 1/2] exfat: call sync_filesystem for read-only remount To: Namjae Jeon Cc: linux-fsdevel@vger.kernel.org, LKML , Sungjong Seo Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Namjae, 2020=EB=85=84 6=EC=9B=94 15=EC=9D=BC (=EC=9B=94) =EC=98=A4=EC=A0=84 9:14, N= amjae Jeon =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > Hi Hyunchul, > > We need to commit dirty metadata and pages to disk before remounting ex= fat as read-only. > > > > This fixes a failure in xfstests generic/452 > Could you please elaborate more the reason why generic/452 in xfstests fa= iled ? xfstests generic/452 does the following. cp /bin/ls / mount -o remount,ro the /ls file is corrupted, because while exfat is remounted as read-= only, exfat doesn't have a chance to commit metadata and vfs invalidates page caches in a block device. I will put this explanation in a commit message. > > > > Signed-off-by: Hyunchul Lee > > --- > > fs/exfat/super.c | 19 +++++++++++++++++++ > > 1 file changed, 19 insertions(+) > > > > diff --git a/fs/exfat/super.c b/fs/exfat/super.c index e650e65536f8..61= c6cf240c19 100644 > > --- a/fs/exfat/super.c > > +++ b/fs/exfat/super.c > > @@ -693,10 +693,29 @@ static void exfat_free(struct fs_context *fc) > > } > > } > > > > +static int exfat_reconfigure(struct fs_context *fc) { > > + struct super_block *sb =3D fc->root->d_sb; > > + int ret; > int ret =3D 0; > > + bool new_rdonly; > > + > > + new_rdonly =3D fc->sb_flags & SB_RDONLY; > > + if (new_rdonly !=3D sb_rdonly(sb)) { > If you modify it like this, would not we need new_rdonly? > if (fc->sb_flags & SB_RDONLY && !sb_rdonly(sb)) > This condition means that mount options are changed from "rw" to "ro", or "ro" to "rw". > > + if (new_rdonly) { And this condition means these options are changed from "rw" to "ro". It seems better to change two conditions to the one you suggested, or remove those. because sync_filesystem returns 0 when the filesystem is mounted as read-only. > > + /* volume flag will be updated in exfat_sync_fs *= / > > + ret =3D sync_filesystem(sb); > > + if (ret < 0) > > + return ret; > I think that this ret check can be removed by using return ret; below ? Okay, I will apply this. Thank you for your comments! > > + } > > + } > > + return 0; > return ret; > > +} > > + > > static const struct fs_context_operations exfat_context_ops =3D { > > .parse_param =3D exfat_parse_param, > > .get_tree =3D exfat_get_tree, > > .free =3D exfat_free, > > + .reconfigure =3D exfat_reconfigure, > > }; > > > > static int exfat_init_fs_context(struct fs_context *fc) > > -- > > 2.17.1 > >