aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2013-02-02 22:52:19 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-02-02 22:52:19 -0500
commit0efb3b23002fea3ed996597783939617e50523ec (patch)
treee0ce9af1bbb32f6d915ef0ee9859fee4973771ac /fs
parent0e79537d30f9dd66ccef70f1c7571594088e30be (diff)
ext4: move several mount options to standard handling loop
Several mount option (resuid, resgid, journal_dev, journal_ioprio) are currently handled before we enter standard option handling loop. I don't see a reason for this so move them to normal handling loop to make things more regular. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/super.c69
1 files changed, 38 insertions, 31 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index aac52738eb60..69e5e70cfdee 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1444,6 +1444,10 @@ static const struct mount_opts {
1444 {Opt_inode_readahead_blks, 0, MOPT_GTE0}, 1444 {Opt_inode_readahead_blks, 0, MOPT_GTE0},
1445 {Opt_init_itable, 0, MOPT_GTE0}, 1445 {Opt_init_itable, 0, MOPT_GTE0},
1446 {Opt_stripe, 0, MOPT_GTE0}, 1446 {Opt_stripe, 0, MOPT_GTE0},
1447 {Opt_resuid, 0, MOPT_GTE0},
1448 {Opt_resgid, 0, MOPT_GTE0},
1449 {Opt_journal_dev, 0, MOPT_GTE0},
1450 {Opt_journal_ioprio, 0, MOPT_GTE0},
1447 {Opt_data_journal, EXT4_MOUNT_JOURNAL_DATA, MOPT_DATAJ}, 1451 {Opt_data_journal, EXT4_MOUNT_JOURNAL_DATA, MOPT_DATAJ},
1448 {Opt_data_ordered, EXT4_MOUNT_ORDERED_DATA, MOPT_DATAJ}, 1452 {Opt_data_ordered, EXT4_MOUNT_ORDERED_DATA, MOPT_DATAJ},
1449 {Opt_data_writeback, EXT4_MOUNT_WRITEBACK_DATA, MOPT_DATAJ}, 1453 {Opt_data_writeback, EXT4_MOUNT_WRITEBACK_DATA, MOPT_DATAJ},
@@ -1496,8 +1500,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1496 else if (token == Opt_offgrpjquota) 1500 else if (token == Opt_offgrpjquota)
1497 return clear_qf_name(sb, GRPQUOTA); 1501 return clear_qf_name(sb, GRPQUOTA);
1498#endif 1502#endif
1499 if (args->from && match_int(args, &arg))
1500 return -1;
1501 switch (token) { 1503 switch (token) {
1502 case Opt_noacl: 1504 case Opt_noacl:
1503 case Opt_nouser_xattr: 1505 case Opt_nouser_xattr:
@@ -1509,46 +1511,19 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1509 ext4_msg(sb, KERN_WARNING, 1511 ext4_msg(sb, KERN_WARNING,
1510 "Ignoring removed %s option", opt); 1512 "Ignoring removed %s option", opt);
1511 return 1; 1513 return 1;
1512 case Opt_resuid:
1513 uid = make_kuid(current_user_ns(), arg);
1514 if (!uid_valid(uid)) {
1515 ext4_msg(sb, KERN_ERR, "Invalid uid value %d", arg);
1516 return -1;
1517 }
1518 sbi->s_resuid = uid;
1519 return 1;
1520 case Opt_resgid:
1521 gid = make_kgid(current_user_ns(), arg);
1522 if (!gid_valid(gid)) {
1523 ext4_msg(sb, KERN_ERR, "Invalid gid value %d", arg);
1524 return -1;
1525 }
1526 sbi->s_resgid = gid;
1527 return 1;
1528 case Opt_abort: 1514 case Opt_abort:
1529 sbi->s_mount_flags |= EXT4_MF_FS_ABORTED; 1515 sbi->s_mount_flags |= EXT4_MF_FS_ABORTED;
1530 return 1; 1516 return 1;
1531 case Opt_i_version: 1517 case Opt_i_version:
1532 sb->s_flags |= MS_I_VERSION; 1518 sb->s_flags |= MS_I_VERSION;
1533 return 1; 1519 return 1;
1534 case Opt_journal_dev:
1535 if (is_remount) {
1536 ext4_msg(sb, KERN_ERR,
1537 "Cannot specify journal on remount");
1538 return -1;
1539 }
1540 *journal_devnum = arg;
1541 return 1;
1542 case Opt_journal_ioprio:
1543 if (arg < 0 || arg > 7)
1544 return -1;
1545 *journal_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, arg);
1546 return 1;
1547 } 1520 }
1548 1521
1549 for (m = ext4_mount_opts; m->token != Opt_err; m++) { 1522 for (m = ext4_mount_opts; m->token != Opt_err; m++) {
1550 if (token != m->token) 1523 if (token != m->token)
1551 continue; 1524 continue;
1525 if (args->from && match_int(args, &arg))
1526 return -1;
1552 if (args->from && (m->flags & MOPT_GTE0) && (arg < 0)) 1527 if (args->from && (m->flags & MOPT_GTE0) && (arg < 0))
1553 return -1; 1528 return -1;
1554 if (m->flags & MOPT_EXPLICIT) 1529 if (m->flags & MOPT_EXPLICIT)
@@ -1592,6 +1567,38 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1592 sbi->s_max_dir_size_kb = arg; 1567 sbi->s_max_dir_size_kb = arg;
1593 } else if (token == Opt_stripe) { 1568 } else if (token == Opt_stripe) {
1594 sbi->s_stripe = arg; 1569 sbi->s_stripe = arg;
1570 } else if (token == Opt_resuid) {
1571 uid = make_kuid(current_user_ns(), arg);
1572 if (!uid_valid(uid)) {
1573 ext4_msg(sb, KERN_ERR,
1574 "Invalid uid value %d", arg);
1575 return -1;
1576 }
1577 sbi->s_resuid = uid;
1578 } else if (token == Opt_resgid) {
1579 gid = make_kgid(current_user_ns(), arg);
1580 if (!gid_valid(gid)) {
1581 ext4_msg(sb, KERN_ERR,
1582 "Invalid gid value %d", arg);
1583 return -1;
1584 }
1585 sbi->s_resgid = gid;
1586 } else if (token == Opt_journal_dev) {
1587 if (is_remount) {
1588 ext4_msg(sb, KERN_ERR,
1589 "Cannot specify journal on remount");
1590 return -1;
1591 }
1592 *journal_devnum = arg;
1593 } else if (token == Opt_journal_ioprio) {
1594 if (arg > 7) {
1595 ext4_msg(sb, KERN_ERR,
1596 "Invalid journal IO priority"
1597 " (must be 0-7)");
1598 return -1;
1599 }
1600 *journal_ioprio =
1601 IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, arg);
1595 } else if (m->flags & MOPT_DATAJ) { 1602 } else if (m->flags & MOPT_DATAJ) {
1596 if (is_remount) { 1603 if (is_remount) {
1597 if (!sbi->s_journal) 1604 if (!sbi->s_journal)