diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-09-03 18:22:38 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-09-03 18:22:38 -0400 |
commit | 56889787cfa77dfd96f0b3a3e6a4f26c2e4a5134 (patch) | |
tree | 5fb1be2d593fae0bb1a566397c58dc4f7ce010f2 /fs/ext4 | |
parent | 2be4751b21ae1cacb002da48cfc5bf6743fee8c1 (diff) |
ext4: improve handling of conflicting mount options
If the user explicitly specifies conflicting mount options for
delalloc or dioread_nolock and data=journal, fail the mount, instead
of printing a warning and continuing (since many user's won't look at
dmesg and notice the warning).
Also, print a single warning that data=journal implies that delayed
allocation is not on by default (since it's not supported), and
furthermore that O_DIRECT is not supported. Improve the text in
Documentation/filesystems/ext4.txt so this is clear there as well.
Similarly, if the dioread_nolock mount option is specified when the
file system block size != PAGE_SIZE, fail the mount instead of
printing a warning message and ignoring the mount option.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ext4.h | 3 | ||||
-rw-r--r-- | fs/ext4/super.c | 50 |
2 files changed, 32 insertions, 21 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index ccfa81f33bb0..48ae98819d35 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -922,6 +922,9 @@ struct ext4_inode_info { | |||
922 | #define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */ | 922 | #define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */ |
923 | #define EXT4_MOUNT_INIT_INODE_TABLE 0x80000000 /* Initialize uninitialized itables */ | 923 | #define EXT4_MOUNT_INIT_INODE_TABLE 0x80000000 /* Initialize uninitialized itables */ |
924 | 924 | ||
925 | #define EXT4_MOUNT2_EXPLICIT_DELALLOC 0x00000001 /* User explicitly | ||
926 | specified delalloc */ | ||
927 | |||
925 | #define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \ | 928 | #define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \ |
926 | ~EXT4_MOUNT_##opt | 929 | ~EXT4_MOUNT_##opt |
927 | #define set_opt(sb, opt) EXT4_SB(sb)->s_mount_opt |= \ | 930 | #define set_opt(sb, opt) EXT4_SB(sb)->s_mount_opt |= \ |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 44d0c8db2239..ee2f74a7084d 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1801,6 +1801,7 @@ set_qf_format: | |||
1801 | break; | 1801 | break; |
1802 | case Opt_nodelalloc: | 1802 | case Opt_nodelalloc: |
1803 | clear_opt(sb, DELALLOC); | 1803 | clear_opt(sb, DELALLOC); |
1804 | clear_opt2(sb, EXPLICIT_DELALLOC); | ||
1804 | break; | 1805 | break; |
1805 | case Opt_mblk_io_submit: | 1806 | case Opt_mblk_io_submit: |
1806 | set_opt(sb, MBLK_IO_SUBMIT); | 1807 | set_opt(sb, MBLK_IO_SUBMIT); |
@@ -1817,6 +1818,7 @@ set_qf_format: | |||
1817 | break; | 1818 | break; |
1818 | case Opt_delalloc: | 1819 | case Opt_delalloc: |
1819 | set_opt(sb, DELALLOC); | 1820 | set_opt(sb, DELALLOC); |
1821 | set_opt2(sb, EXPLICIT_DELALLOC); | ||
1820 | break; | 1822 | break; |
1821 | case Opt_block_validity: | 1823 | case Opt_block_validity: |
1822 | set_opt(sb, BLOCK_VALIDITY); | 1824 | set_opt(sb, BLOCK_VALIDITY); |
@@ -3224,6 +3226,33 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3224 | &journal_ioprio, NULL, 0)) | 3226 | &journal_ioprio, NULL, 0)) |
3225 | goto failed_mount; | 3227 | goto failed_mount; |
3226 | 3228 | ||
3229 | if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { | ||
3230 | printk_once(KERN_WARNING "EXT4-fs: Warning: mounting " | ||
3231 | "with data=journal disables delayed " | ||
3232 | "allocation and O_DIRECT support!\n"); | ||
3233 | if (test_opt2(sb, EXPLICIT_DELALLOC)) { | ||
3234 | ext4_msg(sb, KERN_ERR, "can't mount with " | ||
3235 | "both data=journal and delalloc"); | ||
3236 | goto failed_mount; | ||
3237 | } | ||
3238 | if (test_opt(sb, DIOREAD_NOLOCK)) { | ||
3239 | ext4_msg(sb, KERN_ERR, "can't mount with " | ||
3240 | "both data=journal and delalloc"); | ||
3241 | goto failed_mount; | ||
3242 | } | ||
3243 | if (test_opt(sb, DELALLOC)) | ||
3244 | clear_opt(sb, DELALLOC); | ||
3245 | } | ||
3246 | |||
3247 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | ||
3248 | if (test_opt(sb, DIOREAD_NOLOCK)) { | ||
3249 | if (blocksize < PAGE_SIZE) { | ||
3250 | ext4_msg(sb, KERN_ERR, "can't mount with " | ||
3251 | "dioread_nolock if block size != PAGE_SIZE"); | ||
3252 | goto failed_mount; | ||
3253 | } | ||
3254 | } | ||
3255 | |||
3227 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 3256 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
3228 | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); | 3257 | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); |
3229 | 3258 | ||
@@ -3265,8 +3294,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3265 | if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) | 3294 | if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) |
3266 | goto failed_mount; | 3295 | goto failed_mount; |
3267 | 3296 | ||
3268 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | ||
3269 | |||
3270 | if (blocksize < EXT4_MIN_BLOCK_SIZE || | 3297 | if (blocksize < EXT4_MIN_BLOCK_SIZE || |
3271 | blocksize > EXT4_MAX_BLOCK_SIZE) { | 3298 | blocksize > EXT4_MAX_BLOCK_SIZE) { |
3272 | ext4_msg(sb, KERN_ERR, | 3299 | ext4_msg(sb, KERN_ERR, |
@@ -3679,25 +3706,6 @@ no_journal: | |||
3679 | "available"); | 3706 | "available"); |
3680 | } | 3707 | } |
3681 | 3708 | ||
3682 | if (test_opt(sb, DELALLOC) && | ||
3683 | (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)) { | ||
3684 | ext4_msg(sb, KERN_WARNING, "Ignoring delalloc option - " | ||
3685 | "requested data journaling mode"); | ||
3686 | clear_opt(sb, DELALLOC); | ||
3687 | } | ||
3688 | if (test_opt(sb, DIOREAD_NOLOCK)) { | ||
3689 | if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { | ||
3690 | ext4_msg(sb, KERN_WARNING, "Ignoring dioread_nolock " | ||
3691 | "option - requested data journaling mode"); | ||
3692 | clear_opt(sb, DIOREAD_NOLOCK); | ||
3693 | } | ||
3694 | if (sb->s_blocksize < PAGE_SIZE) { | ||
3695 | ext4_msg(sb, KERN_WARNING, "Ignoring dioread_nolock " | ||
3696 | "option - block size is too small"); | ||
3697 | clear_opt(sb, DIOREAD_NOLOCK); | ||
3698 | } | ||
3699 | } | ||
3700 | |||
3701 | err = ext4_setup_system_zone(sb); | 3709 | err = ext4_setup_system_zone(sb); |
3702 | if (err) { | 3710 | if (err) { |
3703 | ext4_msg(sb, KERN_ERR, "failed to initialize system " | 3711 | ext4_msg(sb, KERN_ERR, "failed to initialize system " |