hfsplus mount logic in super.c

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

 



Hello!
I have a question on hfsplus mount logic. I also propose some changes
to the code and ask for comments.

Take a look at this excerpt from hfsplus/super.c:

static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
{
...
    if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
        pr_warn("Filesystem was not cleanly unmounted, running
fsck.hfsplus is recommended.  mounting read-only.\n");
        sb->s_flags |= MS_RDONLY;
    } else if (test_and_clear_bit(HFSPLUS_SB_FORCE, &sbi->flags)) {
        /* nothing */
    } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
...

There is also analogous code in hfsplus_remount().

Why does the "force" mount option have a lower priority than the
"unmounted" flag in the volume header? I'd like being able to mount
for read-write using "mount -o force,rw /dev/..." regardless of any
flags including the "unmounted" flag. Now "-o force,rw" has no effect
in the case of unset "unmounted" flag, the filesystem is still mounted
for read-only. Wouldn't it be better to give the "force" mount option
the top priority? Simply by changing the code to:

    if (test_and_clear_bit(HFSPLUS_SB_FORCE, &sbi->flags)) {
        /* nothing */
    } else if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
        pr_warn("Filesystem was not cleanly unmounted, running
fsck.hfsplus is recommended.  mounting read-only.\n");
        sb->s_flags |= MS_RDONLY;
    } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {

And why is the "inconsistent" flag not checked? The code could be like this:

    if (test_and_clear_bit(HFSPLUS_SB_FORCE, &sbi->flags)) {
        /* nothing */
    } else if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
        pr_warn("Filesystem was not cleanly unmounted, running
fsck.hfsplus is recommended.  mounting read-only.\n");
        sb->s_flags |= MS_RDONLY;
    } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_INCNSTNT)) {
        pr_warn("Filesystem is marked inconsistent, running
fsck.hfsplus is recommended.  mounting read-only.\n");
        sb->s_flags |= MS_RDONLY;
   } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
--
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