From: "Timo Schlüßler" <timo@schluessler.org>
To: linux-fsdevel@vger.kernel.org
Subject: [PATCH 2/2] HFS: clear dirty flags on remount read-only
Date: Sun, 29 Nov 2015 15:59:49 +0100 [thread overview]
Message-ID: <565B12E5.3090600@schluessler.org> (raw)
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 <timo@schluessler.org>
---
--- 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;
}
next reply other threads:[~2015-11-29 15:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-29 14:59 Timo Schlüßler [this message]
2015-11-29 23:03 ` [PATCH 2/2] HFS: clear dirty flags on remount read-only Vyacheslav Dubeyko
2015-12-03 18:42 ` Timo Schlüßler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=565B12E5.3090600@schluessler.org \
--to=timo@schluessler.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).