Skip to contentSkip to conversation

UBIFS is not remounted read-only from within do_emergency_remount

DISCUSSION Alexander Stein 2 participants 3 messages Jul 31, 2012 – Aug 27, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

upon testing do_emergency_remount from a power fail interrupt (using the workqueue of course), we noticed UBIFS is not remounted read-only afterwards. The current code in do_emergency_remount checks if the kernel actually needs to remount a filesystem using the following code:

Quoted 7 lines

if (sb->s_root && sb->s_bdev && (sb->s_flags & MS_BORN) &&

    !(sb->s_flags & MS_RDONLY)) {
        /*
         * What lock protects sb->s_flags??
         */
        do_remount_sb(sb, MS_RDONLY, NULL, 1);
}

I'm not in the details of this part of the kernel, but I suspect that sb-

Quoted 1 line

s_bdev is NULL for UBIFS as it has no block device, but the character device

/dev/ubiX_Y instead. I have the information from a collegue that removing the check for testing purposes for sb->s_bdev mounts UBIFS read-only. Any comments/ideas how to remount UBIFS as read-only from do_emergency_remount?

Best regards,
Alexander

#1 lore raw
Quoted 12 lines · Alexander Stein

upon testing do_emergency_remount from a power fail interrupt (using the workqueue of course), we noticed UBIFS is not remounted read-only afterwards. The current code in do_emergency_remount checks if the kernel actually needs to remount a filesystem using the following code:

Quoted 7 lines

if (sb->s_root && sb->s_bdev && (sb->s_flags & MS_BORN) &&

    !(sb->s_flags & MS_RDONLY)) {
        /*
         * What lock protects sb->s_flags??
         */
        do_remount_sb(sb, MS_RDONLY, NULL, 1);
}
Quoted 6 lines

I'm not in the details of this part of the kernel, but I suspect that sb-

Quoted 1 line

s_bdev is NULL for UBIFS as it has no block device, but the character device

/dev/ubiX_Y instead. I have the information from a collegue that removing the check for testing purposes for sb->s_bdev mounts UBIFS read-only. Any comments/ideas how to remount UBIFS as read-only from do_emergency_remount?

I think this check is there to prevent file-systems like sysfs, tmpfs, procfs, cgroup and debugfs from re-mounting R/O. If we just remove the 'sb->s_bdev' check - they all become R/O as well. For me it sounds OK, but I've never used this functionality, so not sure.

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#2 lore raw

Hello,

Quoted 20 lines · Artem Bityutskiy
Quoted 12 lines · Alexander Stein

upon testing do_emergency_remount from a power fail interrupt (using the workqueue of course), we noticed UBIFS is not remounted read-only afterwards. The current code in do_emergency_remount checks if the kernel actually needs to remount a filesystem using the following code:

Quoted 7 lines

if (sb->s_root && sb->s_bdev && (sb->s_flags & MS_BORN) &&

    !(sb->s_flags & MS_RDONLY)) {
        /*
         * What lock protects sb->s_flags??
         */
        do_remount_sb(sb, MS_RDONLY, NULL, 1);
}
Quoted 6 lines

I'm not in the details of this part of the kernel, but I suspect that sb-

Quoted 1 line

s_bdev is NULL for UBIFS as it has no block device, but the character device

/dev/ubiX_Y instead. I have the information from a collegue that removing the check for testing purposes for sb->s_bdev mounts UBIFS read-only. Any comments/ideas how to remount UBIFS as read-only from do_emergency_remount?

Quoted 4 lines

I think this check is there to prevent file-systems like sysfs, tmpfs, procfs, cgroup and debugfs from re-mounting R/O. If we just remove the 'sb->s_bdev' check - they all become R/O as well. For me it sounds OK, but I've never used this functionality, so not sure.

I agree this check filters out file system without a backing storage (block device), which is fine. It just doesn't make a difference if those are remounted R/O. I'm just wondering how to make the emergeny_remount usable with ubifs which has a backing storage, obviously, but no block device.

Regards,
Alexander