diff options
-rw-r--r-- | fs/ext4/ext4.h | 11 | ||||
-rw-r--r-- | fs/ext4/inode.c | 4 | ||||
-rw-r--r-- | fs/ext4/super.c | 10 |
3 files changed, 9 insertions, 16 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 9e268c97eeca..06ee5a582917 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -684,7 +684,6 @@ struct ext4_inode_info { | |||
684 | #define EXT4_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */ | 684 | #define EXT4_MOUNT_ERRORS_PANIC 0x00040 /* Panic on errors */ |
685 | #define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */ | 685 | #define EXT4_MOUNT_MINIX_DF 0x00080 /* Mimics the Minix statfs */ |
686 | #define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/ | 686 | #define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/ |
687 | #define EXT4_MOUNT_ABORT 0x00200 /* Fatal error detected */ | ||
688 | #define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */ | 687 | #define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */ |
689 | #define EXT4_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */ | 688 | #define EXT4_MOUNT_JOURNAL_DATA 0x00400 /* Write data to journal */ |
690 | #define EXT4_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */ | 689 | #define EXT4_MOUNT_ORDERED_DATA 0x00800 /* Flush data before commit */ |
@@ -706,17 +705,10 @@ struct ext4_inode_info { | |||
706 | #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */ | 705 | #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */ |
707 | #define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */ | 706 | #define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */ |
708 | 707 | ||
709 | /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ | ||
710 | #ifndef _LINUX_EXT2_FS_H | ||
711 | #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt | 708 | #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt |
712 | #define set_opt(o, opt) o |= EXT4_MOUNT_##opt | 709 | #define set_opt(o, opt) o |= EXT4_MOUNT_##opt |
713 | #define test_opt(sb, opt) (EXT4_SB(sb)->s_mount_opt & \ | 710 | #define test_opt(sb, opt) (EXT4_SB(sb)->s_mount_opt & \ |
714 | EXT4_MOUNT_##opt) | 711 | EXT4_MOUNT_##opt) |
715 | #else | ||
716 | #define EXT2_MOUNT_NOLOAD EXT4_MOUNT_NOLOAD | ||
717 | #define EXT2_MOUNT_ABORT EXT4_MOUNT_ABORT | ||
718 | #define EXT2_MOUNT_DATA_FLAGS EXT4_MOUNT_DATA_FLAGS | ||
719 | #endif | ||
720 | 712 | ||
721 | #define ext4_set_bit ext2_set_bit | 713 | #define ext4_set_bit ext2_set_bit |
722 | #define ext4_set_bit_atomic ext2_set_bit_atomic | 714 | #define ext4_set_bit_atomic ext2_set_bit_atomic |
@@ -836,9 +828,10 @@ struct ext4_super_block { | |||
836 | #ifdef __KERNEL__ | 828 | #ifdef __KERNEL__ |
837 | 829 | ||
838 | /* | 830 | /* |
839 | * Mount flags | 831 | * run-time mount flags |
840 | */ | 832 | */ |
841 | #define EXT4_MF_MNTDIR_SAMPLED 0x0001 | 833 | #define EXT4_MF_MNTDIR_SAMPLED 0x0001 |
834 | #define EXT4_MF_FS_ABORTED 0x0002 /* Fatal error detected */ | ||
842 | 835 | ||
843 | /* | 836 | /* |
844 | * fourth extended-fs super-block data in memory | 837 | * fourth extended-fs super-block data in memory |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index f8325a2bc897..5f927f6a1289 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2670,13 +2670,13 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2670 | * If the filesystem has aborted, it is read-only, so return | 2670 | * If the filesystem has aborted, it is read-only, so return |
2671 | * right away instead of dumping stack traces later on that | 2671 | * right away instead of dumping stack traces later on that |
2672 | * will obscure the real source of the problem. We test | 2672 | * will obscure the real source of the problem. We test |
2673 | * EXT4_MOUNT_ABORT instead of sb->s_flag's MS_RDONLY because | 2673 | * EXT4_MF_FS_ABORTED instead of sb->s_flag's MS_RDONLY because |
2674 | * the latter could be true if the filesystem is mounted | 2674 | * the latter could be true if the filesystem is mounted |
2675 | * read-only, and in that case, ext4_da_writepages should | 2675 | * read-only, and in that case, ext4_da_writepages should |
2676 | * *never* be called, so if that ever happens, we would want | 2676 | * *never* be called, so if that ever happens, we would want |
2677 | * the stack trace. | 2677 | * the stack trace. |
2678 | */ | 2678 | */ |
2679 | if (unlikely(sbi->s_mount_opt & EXT4_MOUNT_ABORT)) | 2679 | if (unlikely(sbi->s_mount_flags & EXT4_MF_FS_ABORTED)) |
2680 | return -EROFS; | 2680 | return -EROFS; |
2681 | 2681 | ||
2682 | /* | 2682 | /* |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 4c364ae7aeb1..04486a53469f 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -303,7 +303,7 @@ static void ext4_handle_error(struct super_block *sb) | |||
303 | if (!test_opt(sb, ERRORS_CONT)) { | 303 | if (!test_opt(sb, ERRORS_CONT)) { |
304 | journal_t *journal = EXT4_SB(sb)->s_journal; | 304 | journal_t *journal = EXT4_SB(sb)->s_journal; |
305 | 305 | ||
306 | EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT; | 306 | EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; |
307 | if (journal) | 307 | if (journal) |
308 | jbd2_journal_abort(journal, -EIO); | 308 | jbd2_journal_abort(journal, -EIO); |
309 | } | 309 | } |
@@ -416,7 +416,7 @@ void ext4_abort(struct super_block *sb, const char *function, | |||
416 | ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); | 416 | ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); |
417 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; | 417 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; |
418 | sb->s_flags |= MS_RDONLY; | 418 | sb->s_flags |= MS_RDONLY; |
419 | EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT; | 419 | EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; |
420 | if (EXT4_SB(sb)->s_journal) | 420 | if (EXT4_SB(sb)->s_journal) |
421 | jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); | 421 | jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); |
422 | } | 422 | } |
@@ -1476,7 +1476,7 @@ set_qf_format: | |||
1476 | break; | 1476 | break; |
1477 | #endif | 1477 | #endif |
1478 | case Opt_abort: | 1478 | case Opt_abort: |
1479 | set_opt(sbi->s_mount_opt, ABORT); | 1479 | sbi->s_mount_flags |= EXT4_MF_FS_ABORTED; |
1480 | break; | 1480 | break; |
1481 | case Opt_nobarrier: | 1481 | case Opt_nobarrier: |
1482 | clear_opt(sbi->s_mount_opt, BARRIER); | 1482 | clear_opt(sbi->s_mount_opt, BARRIER); |
@@ -3452,7 +3452,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
3452 | goto restore_opts; | 3452 | goto restore_opts; |
3453 | } | 3453 | } |
3454 | 3454 | ||
3455 | if (sbi->s_mount_opt & EXT4_MOUNT_ABORT) | 3455 | if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) |
3456 | ext4_abort(sb, __func__, "Abort forced by user"); | 3456 | ext4_abort(sb, __func__, "Abort forced by user"); |
3457 | 3457 | ||
3458 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 3458 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
@@ -3467,7 +3467,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
3467 | 3467 | ||
3468 | if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY) || | 3468 | if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY) || |
3469 | n_blocks_count > ext4_blocks_count(es)) { | 3469 | n_blocks_count > ext4_blocks_count(es)) { |
3470 | if (sbi->s_mount_opt & EXT4_MOUNT_ABORT) { | 3470 | if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) { |
3471 | err = -EROFS; | 3471 | err = -EROFS; |
3472 | goto restore_opts; | 3472 | goto restore_opts; |
3473 | } | 3473 | } |