diff options
-rw-r--r-- | Documentation/filesystems/ext3.txt | 7 | ||||
-rw-r--r-- | fs/ext3/super.c | 43 |
2 files changed, 47 insertions, 3 deletions
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt index 293855e95000..7ed0d17d6721 100644 --- a/Documentation/filesystems/ext3.txt +++ b/Documentation/filesystems/ext3.txt | |||
@@ -26,11 +26,12 @@ journal=inum When a journal already exists, this option is ignored. | |||
26 | Otherwise, it specifies the number of the inode which | 26 | Otherwise, it specifies the number of the inode which |
27 | will represent the ext3 file system's journal file. | 27 | will represent the ext3 file system's journal file. |
28 | 28 | ||
29 | journal_path=path | ||
29 | journal_dev=devnum When the external journal device's major/minor numbers | 30 | journal_dev=devnum When the external journal device's major/minor numbers |
30 | have changed, this option allows the user to specify | 31 | have changed, these options allow the user to specify |
31 | the new journal location. The journal device is | 32 | the new journal location. The journal device is |
32 | identified through its new major/minor numbers encoded | 33 | identified through either its new major/minor numbers |
33 | in devnum. | 34 | encoded in devnum, or via a path to the device. |
34 | 35 | ||
35 | norecovery Don't load the journal on mounting. Note that this forces | 36 | norecovery Don't load the journal on mounting. Note that this forces |
36 | noload mount of inconsistent filesystem, which can lead to | 37 | noload mount of inconsistent filesystem, which can lead to |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index c47f14750722..c50c76190373 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
28 | #include <linux/log2.h> | 28 | #include <linux/log2.h> |
29 | #include <linux/cleancache.h> | 29 | #include <linux/cleancache.h> |
30 | #include <linux/namei.h> | ||
30 | 31 | ||
31 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
32 | 33 | ||
@@ -819,6 +820,7 @@ enum { | |||
819 | Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, | 820 | Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, |
820 | Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, Opt_bh, | 821 | Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, Opt_bh, |
821 | Opt_commit, Opt_journal_update, Opt_journal_inum, Opt_journal_dev, | 822 | Opt_commit, Opt_journal_update, Opt_journal_inum, Opt_journal_dev, |
823 | Opt_journal_path, | ||
822 | Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, | 824 | Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, |
823 | Opt_data_err_abort, Opt_data_err_ignore, | 825 | Opt_data_err_abort, Opt_data_err_ignore, |
824 | Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, | 826 | Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, |
@@ -860,6 +862,7 @@ static const match_table_t tokens = { | |||
860 | {Opt_journal_update, "journal=update"}, | 862 | {Opt_journal_update, "journal=update"}, |
861 | {Opt_journal_inum, "journal=%u"}, | 863 | {Opt_journal_inum, "journal=%u"}, |
862 | {Opt_journal_dev, "journal_dev=%u"}, | 864 | {Opt_journal_dev, "journal_dev=%u"}, |
865 | {Opt_journal_path, "journal_path=%s"}, | ||
863 | {Opt_abort, "abort"}, | 866 | {Opt_abort, "abort"}, |
864 | {Opt_data_journal, "data=journal"}, | 867 | {Opt_data_journal, "data=journal"}, |
865 | {Opt_data_ordered, "data=ordered"}, | 868 | {Opt_data_ordered, "data=ordered"}, |
@@ -975,6 +978,11 @@ static int parse_options (char *options, struct super_block *sb, | |||
975 | int option; | 978 | int option; |
976 | kuid_t uid; | 979 | kuid_t uid; |
977 | kgid_t gid; | 980 | kgid_t gid; |
981 | char *journal_path; | ||
982 | struct inode *journal_inode; | ||
983 | struct path path; | ||
984 | int error; | ||
985 | |||
978 | #ifdef CONFIG_QUOTA | 986 | #ifdef CONFIG_QUOTA |
979 | int qfmt; | 987 | int qfmt; |
980 | #endif | 988 | #endif |
@@ -1129,6 +1137,41 @@ static int parse_options (char *options, struct super_block *sb, | |||
1129 | return 0; | 1137 | return 0; |
1130 | *journal_devnum = option; | 1138 | *journal_devnum = option; |
1131 | break; | 1139 | break; |
1140 | case Opt_journal_path: | ||
1141 | if (is_remount) { | ||
1142 | ext3_msg(sb, KERN_ERR, "error: cannot specify " | ||
1143 | "journal on remount"); | ||
1144 | return 0; | ||
1145 | } | ||
1146 | |||
1147 | journal_path = match_strdup(&args[0]); | ||
1148 | if (!journal_path) { | ||
1149 | ext3_msg(sb, KERN_ERR, "error: could not dup " | ||
1150 | "journal device string"); | ||
1151 | return 0; | ||
1152 | } | ||
1153 | |||
1154 | error = kern_path(journal_path, LOOKUP_FOLLOW, &path); | ||
1155 | if (error) { | ||
1156 | ext3_msg(sb, KERN_ERR, "error: could not find " | ||
1157 | "journal device path: error %d", error); | ||
1158 | kfree(journal_path); | ||
1159 | return 0; | ||
1160 | } | ||
1161 | |||
1162 | journal_inode = path.dentry->d_inode; | ||
1163 | if (!S_ISBLK(journal_inode->i_mode)) { | ||
1164 | ext3_msg(sb, KERN_ERR, "error: journal path %s " | ||
1165 | "is not a block device", journal_path); | ||
1166 | path_put(&path); | ||
1167 | kfree(journal_path); | ||
1168 | return 0; | ||
1169 | } | ||
1170 | |||
1171 | *journal_devnum = new_encode_dev(journal_inode->i_rdev); | ||
1172 | path_put(&path); | ||
1173 | kfree(journal_path); | ||
1174 | break; | ||
1132 | case Opt_noload: | 1175 | case Opt_noload: |
1133 | set_opt (sbi->s_mount_opt, NOLOAD); | 1176 | set_opt (sbi->s_mount_opt, NOLOAD); |
1134 | break; | 1177 | break; |