aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 203f9e4a70be..22546ad7f0ae 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -54,9 +54,9 @@
54 54
55static struct proc_dir_entry *ext4_proc_root; 55static struct proc_dir_entry *ext4_proc_root;
56static struct kset *ext4_kset; 56static struct kset *ext4_kset;
57struct ext4_lazy_init *ext4_li_info; 57static struct ext4_lazy_init *ext4_li_info;
58struct mutex ext4_li_mtx; 58static struct mutex ext4_li_mtx;
59struct ext4_features *ext4_feat; 59static struct ext4_features *ext4_feat;
60 60
61static int ext4_load_journal(struct super_block *, struct ext4_super_block *, 61static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
62 unsigned long journal_devnum); 62 unsigned long journal_devnum);
@@ -75,6 +75,7 @@ static void ext4_write_super(struct super_block *sb);
75static int ext4_freeze(struct super_block *sb); 75static int ext4_freeze(struct super_block *sb);
76static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags, 76static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags,
77 const char *dev_name, void *data); 77 const char *dev_name, void *data);
78static int ext4_feature_set_ok(struct super_block *sb, int readonly);
78static void ext4_destroy_lazyinit_thread(void); 79static void ext4_destroy_lazyinit_thread(void);
79static void ext4_unregister_li_request(struct super_block *sb); 80static void ext4_unregister_li_request(struct super_block *sb);
80static void ext4_clear_request_list(void); 81static void ext4_clear_request_list(void);
@@ -594,7 +595,7 @@ __acquires(bitlock)
594 595
595 vaf.fmt = fmt; 596 vaf.fmt = fmt;
596 vaf.va = &args; 597 vaf.va = &args;
597 printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: group %u", 598 printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: group %u, ",
598 sb->s_id, function, line, grp); 599 sb->s_id, function, line, grp);
599 if (ino) 600 if (ino)
600 printk(KERN_CONT "inode %lu: ", ino); 601 printk(KERN_CONT "inode %lu: ", ino);
@@ -997,13 +998,10 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
997 if (test_opt(sb, OLDALLOC)) 998 if (test_opt(sb, OLDALLOC))
998 seq_puts(seq, ",oldalloc"); 999 seq_puts(seq, ",oldalloc");
999#ifdef CONFIG_EXT4_FS_XATTR 1000#ifdef CONFIG_EXT4_FS_XATTR
1000 if (test_opt(sb, XATTR_USER) && 1001 if (test_opt(sb, XATTR_USER))
1001 !(def_mount_opts & EXT4_DEFM_XATTR_USER))
1002 seq_puts(seq, ",user_xattr"); 1002 seq_puts(seq, ",user_xattr");
1003 if (!test_opt(sb, XATTR_USER) && 1003 if (!test_opt(sb, XATTR_USER))
1004 (def_mount_opts & EXT4_DEFM_XATTR_USER)) {
1005 seq_puts(seq, ",nouser_xattr"); 1004 seq_puts(seq, ",nouser_xattr");
1006 }
1007#endif 1005#endif
1008#ifdef CONFIG_EXT4_FS_POSIX_ACL 1006#ifdef CONFIG_EXT4_FS_POSIX_ACL
1009 if (test_opt(sb, POSIX_ACL) && !(def_mount_opts & EXT4_DEFM_ACL)) 1007 if (test_opt(sb, POSIX_ACL) && !(def_mount_opts & EXT4_DEFM_ACL))
@@ -1041,8 +1039,8 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
1041 !(def_mount_opts & EXT4_DEFM_NODELALLOC)) 1039 !(def_mount_opts & EXT4_DEFM_NODELALLOC))
1042 seq_puts(seq, ",nodelalloc"); 1040 seq_puts(seq, ",nodelalloc");
1043 1041
1044 if (test_opt(sb, MBLK_IO_SUBMIT)) 1042 if (!test_opt(sb, MBLK_IO_SUBMIT))
1045 seq_puts(seq, ",mblk_io_submit"); 1043 seq_puts(seq, ",nomblk_io_submit");
1046 if (sbi->s_stripe) 1044 if (sbi->s_stripe)
1047 seq_printf(seq, ",stripe=%lu", sbi->s_stripe); 1045 seq_printf(seq, ",stripe=%lu", sbi->s_stripe);
1048 /* 1046 /*
@@ -1451,7 +1449,7 @@ static int parse_options(char *options, struct super_block *sb,
1451 * Initialize args struct so we know whether arg was 1449 * Initialize args struct so we know whether arg was
1452 * found; some options take optional arguments. 1450 * found; some options take optional arguments.
1453 */ 1451 */
1454 args[0].to = args[0].from = 0; 1452 args[0].to = args[0].from = NULL;
1455 token = match_token(p, tokens, args); 1453 token = match_token(p, tokens, args);
1456 switch (token) { 1454 switch (token) {
1457 case Opt_bsd_df: 1455 case Opt_bsd_df:
@@ -1771,7 +1769,7 @@ set_qf_format:
1771 return 0; 1769 return 0;
1772 if (option < 0 || option > (1 << 30)) 1770 if (option < 0 || option > (1 << 30))
1773 return 0; 1771 return 0;
1774 if (!is_power_of_2(option)) { 1772 if (option && !is_power_of_2(option)) {
1775 ext4_msg(sb, KERN_ERR, 1773 ext4_msg(sb, KERN_ERR,
1776 "EXT4-fs: inode_readahead_blks" 1774 "EXT4-fs: inode_readahead_blks"
1777 " must be a power of 2"); 1775 " must be a power of 2");
@@ -2120,6 +2118,13 @@ static void ext4_orphan_cleanup(struct super_block *sb,
2120 return; 2118 return;
2121 } 2119 }
2122 2120
2121 /* Check if feature set would not allow a r/w mount */
2122 if (!ext4_feature_set_ok(sb, 0)) {
2123 ext4_msg(sb, KERN_INFO, "Skipping orphan cleanup due to "
2124 "unknown ROCOMPAT features");
2125 return;
2126 }
2127
2123 if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) { 2128 if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) {
2124 if (es->s_last_orphan) 2129 if (es->s_last_orphan)
2125 jbd_debug(1, "Errors on filesystem, " 2130 jbd_debug(1, "Errors on filesystem, "
@@ -2412,7 +2417,7 @@ static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
2412 if (parse_strtoul(buf, 0x40000000, &t)) 2417 if (parse_strtoul(buf, 0x40000000, &t))
2413 return -EINVAL; 2418 return -EINVAL;
2414 2419
2415 if (!is_power_of_2(t)) 2420 if (t && !is_power_of_2(t))
2416 return -EINVAL; 2421 return -EINVAL;
2417 2422
2418 sbi->s_inode_readahead_blks = t; 2423 sbi->s_inode_readahead_blks = t;
@@ -3095,14 +3100,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3095 } 3100 }
3096 if (def_mount_opts & EXT4_DEFM_UID16) 3101 if (def_mount_opts & EXT4_DEFM_UID16)
3097 set_opt(sb, NO_UID32); 3102 set_opt(sb, NO_UID32);
3103 /* xattr user namespace & acls are now defaulted on */
3098#ifdef CONFIG_EXT4_FS_XATTR 3104#ifdef CONFIG_EXT4_FS_XATTR
3099 if (def_mount_opts & EXT4_DEFM_XATTR_USER) 3105 set_opt(sb, XATTR_USER);
3100 set_opt(sb, XATTR_USER);
3101#endif 3106#endif
3102#ifdef CONFIG_EXT4_FS_POSIX_ACL 3107#ifdef CONFIG_EXT4_FS_POSIX_ACL
3103 if (def_mount_opts & EXT4_DEFM_ACL) 3108 set_opt(sb, POSIX_ACL);
3104 set_opt(sb, POSIX_ACL);
3105#endif 3109#endif
3110 set_opt(sb, MBLK_IO_SUBMIT);
3106 if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA) 3111 if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)
3107 set_opt(sb, JOURNAL_DATA); 3112 set_opt(sb, JOURNAL_DATA);
3108 else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED) 3113 else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED)
@@ -3516,7 +3521,7 @@ no_journal:
3516 * concurrency isn't really necessary. Limit it to 1. 3521 * concurrency isn't really necessary. Limit it to 1.
3517 */ 3522 */
3518 EXT4_SB(sb)->dio_unwritten_wq = 3523 EXT4_SB(sb)->dio_unwritten_wq =
3519 alloc_workqueue("ext4-dio-unwritten", WQ_MEM_RECLAIM, 1); 3524 alloc_workqueue("ext4-dio-unwritten", WQ_MEM_RECLAIM | WQ_UNBOUND, 1);
3520 if (!EXT4_SB(sb)->dio_unwritten_wq) { 3525 if (!EXT4_SB(sb)->dio_unwritten_wq) {
3521 printk(KERN_ERR "EXT4-fs: failed to create DIO workqueue\n"); 3526 printk(KERN_ERR "EXT4-fs: failed to create DIO workqueue\n");
3522 goto failed_mount_wq; 3527 goto failed_mount_wq;
@@ -3531,17 +3536,16 @@ no_journal:
3531 if (IS_ERR(root)) { 3536 if (IS_ERR(root)) {
3532 ext4_msg(sb, KERN_ERR, "get root inode failed"); 3537 ext4_msg(sb, KERN_ERR, "get root inode failed");
3533 ret = PTR_ERR(root); 3538 ret = PTR_ERR(root);
3539 root = NULL;
3534 goto failed_mount4; 3540 goto failed_mount4;
3535 } 3541 }
3536 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { 3542 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
3537 iput(root);
3538 ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck"); 3543 ext4_msg(sb, KERN_ERR, "corrupt root inode, run e2fsck");
3539 goto failed_mount4; 3544 goto failed_mount4;
3540 } 3545 }
3541 sb->s_root = d_alloc_root(root); 3546 sb->s_root = d_alloc_root(root);
3542 if (!sb->s_root) { 3547 if (!sb->s_root) {
3543 ext4_msg(sb, KERN_ERR, "get root dentry failed"); 3548 ext4_msg(sb, KERN_ERR, "get root dentry failed");
3544 iput(root);
3545 ret = -ENOMEM; 3549 ret = -ENOMEM;
3546 goto failed_mount4; 3550 goto failed_mount4;
3547 } 3551 }
@@ -3657,6 +3661,8 @@ cantfind_ext4:
3657 goto failed_mount; 3661 goto failed_mount;
3658 3662
3659failed_mount4: 3663failed_mount4:
3664 iput(root);
3665 sb->s_root = NULL;
3660 ext4_msg(sb, KERN_ERR, "mount failed"); 3666 ext4_msg(sb, KERN_ERR, "mount failed");
3661 destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq); 3667 destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq);
3662failed_mount_wq: 3668failed_mount_wq: