From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay06.alfahosting-server.de ([109.237.142.242]:60986 "EHLO relay06.alfahosting-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750714AbbK2PNH (ORCPT ); Sun, 29 Nov 2015 10:13:07 -0500 Received: from alfa3011.alfahosting-server.de (alfa3011.alfahosting-server.de [109.237.134.14]) by relay01.alfahosting-server.de (Postfix) with ESMTPS id 18F5232D7F78 for ; Sun, 29 Nov 2015 15:59:27 +0100 (CET) Received: from [192.168.1.26] (x5d82204b.dyn.telefonica.de [93.130.32.75]) by alfa3011.alfahosting-server.de (Postfix) with ESMTPSA id EDA973EF87B4 for ; Sun, 29 Nov 2015 15:59:26 +0100 (CET) From: =?UTF-8?Q?Timo_Schl=c3=bc=c3=9fler?= Subject: [PATCH 2/2] HFS: clear dirty flags on remount read-only To: linux-fsdevel@vger.kernel.org Message-ID: <565B12E5.3090600@schluessler.org> Date: Sun, 29 Nov 2015 15:59:49 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Remounting a HFS filesystem read-only doesn't clear the "DIRTY"-flags (not HFS_SB_ATTRIB_UNMNT and HFS_SB_ATTRIB_INCNSTNT) correctly. Subsequent mounts then report a dirty filesystem and enforce a check before willing to mount it read-write again. Signed-off-by: Timo Schlüßler --- --- linux/fs/hfs/super.c.orig 2015-11-29 14:42:22.000000000 +0100 +++ linux/fs/hfs/super.c 2015-11-29 15:22:03.000000000 +0100 @@ -113,11 +113,13 @@ static int hfs_statfs(struct dentry *den static int hfs_remount(struct super_block *sb, int *flags, char *data) { - sync_filesystem(sb); *flags |= MS_NODIRATIME; - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) + if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { + sync_filesystem(sb); return 0; + } if (!(*flags & MS_RDONLY)) { + sync_filesystem(sb); if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) { pr_warn("filesystem was not cleanly unmounted, running fsck.hfs is recommended. leaving read-only.\n"); sb->s_flags |= MS_RDONLY; @@ -127,6 +129,9 @@ static int hfs_remount(struct super_bloc sb->s_flags |= MS_RDONLY; *flags |= MS_RDONLY; } + } else { + hfs_mdb_close(sb); + sync_filesystem(sb); } return 0; }