[PATCH 2/2] HFS: clear dirty flags on remount read-only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---

--- 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;
 }


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux