diff options
author | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-02-17 21:51:42 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-02-17 21:51:42 -0500 |
commit | c58310bf4933986513020fa90b4190c7492995ae (patch) | |
tree | 143f2c7578d02ebef5db8fc57ae69e951ae0e2ee /fs/reiserfs/super.c | |
parent | 269cdfaf769f5cd831284cc831790c7c5038040f (diff) | |
parent | 1309d4e68497184d2fd87e892ddf14076c2bda98 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
Diffstat (limited to 'fs/reiserfs/super.c')
-rw-r--r-- | fs/reiserfs/super.c | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 5cd85fe5df5d..6841452e0dea 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -617,6 +617,7 @@ static const struct super_operations reiserfs_sops = { | |||
617 | .unlockfs = reiserfs_unlockfs, | 617 | .unlockfs = reiserfs_unlockfs, |
618 | .statfs = reiserfs_statfs, | 618 | .statfs = reiserfs_statfs, |
619 | .remount_fs = reiserfs_remount, | 619 | .remount_fs = reiserfs_remount, |
620 | .show_options = generic_show_options, | ||
620 | #ifdef CONFIG_QUOTA | 621 | #ifdef CONFIG_QUOTA |
621 | .quota_read = reiserfs_quota_read, | 622 | .quota_read = reiserfs_quota_read, |
622 | .quota_write = reiserfs_quota_write, | 623 | .quota_write = reiserfs_quota_write, |
@@ -1138,6 +1139,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1138 | unsigned long safe_mask = 0; | 1139 | unsigned long safe_mask = 0; |
1139 | unsigned int commit_max_age = (unsigned int)-1; | 1140 | unsigned int commit_max_age = (unsigned int)-1; |
1140 | struct reiserfs_journal *journal = SB_JOURNAL(s); | 1141 | struct reiserfs_journal *journal = SB_JOURNAL(s); |
1142 | char *new_opts = kstrdup(arg, GFP_KERNEL); | ||
1141 | int err; | 1143 | int err; |
1142 | #ifdef CONFIG_QUOTA | 1144 | #ifdef CONFIG_QUOTA |
1143 | int i; | 1145 | int i; |
@@ -1153,7 +1155,8 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1153 | REISERFS_SB(s)->s_qf_names[i] = NULL; | 1155 | REISERFS_SB(s)->s_qf_names[i] = NULL; |
1154 | } | 1156 | } |
1155 | #endif | 1157 | #endif |
1156 | return -EINVAL; | 1158 | err = -EINVAL; |
1159 | goto out_err; | ||
1157 | } | 1160 | } |
1158 | 1161 | ||
1159 | handle_attrs(s); | 1162 | handle_attrs(s); |
@@ -1191,9 +1194,9 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1191 | } | 1194 | } |
1192 | 1195 | ||
1193 | if (blocks) { | 1196 | if (blocks) { |
1194 | int rc = reiserfs_resize(s, blocks); | 1197 | err = reiserfs_resize(s, blocks); |
1195 | if (rc != 0) | 1198 | if (err != 0) |
1196 | return rc; | 1199 | goto out_err; |
1197 | } | 1200 | } |
1198 | 1201 | ||
1199 | if (*mount_flags & MS_RDONLY) { | 1202 | if (*mount_flags & MS_RDONLY) { |
@@ -1201,16 +1204,16 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1201 | /* remount read-only */ | 1204 | /* remount read-only */ |
1202 | if (s->s_flags & MS_RDONLY) | 1205 | if (s->s_flags & MS_RDONLY) |
1203 | /* it is read-only already */ | 1206 | /* it is read-only already */ |
1204 | return 0; | 1207 | goto out_ok; |
1205 | /* try to remount file system with read-only permissions */ | 1208 | /* try to remount file system with read-only permissions */ |
1206 | if (sb_umount_state(rs) == REISERFS_VALID_FS | 1209 | if (sb_umount_state(rs) == REISERFS_VALID_FS |
1207 | || REISERFS_SB(s)->s_mount_state != REISERFS_VALID_FS) { | 1210 | || REISERFS_SB(s)->s_mount_state != REISERFS_VALID_FS) { |
1208 | return 0; | 1211 | goto out_ok; |
1209 | } | 1212 | } |
1210 | 1213 | ||
1211 | err = journal_begin(&th, s, 10); | 1214 | err = journal_begin(&th, s, 10); |
1212 | if (err) | 1215 | if (err) |
1213 | return err; | 1216 | goto out_err; |
1214 | 1217 | ||
1215 | /* Mounting a rw partition read-only. */ | 1218 | /* Mounting a rw partition read-only. */ |
1216 | reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1); | 1219 | reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1); |
@@ -1220,11 +1223,13 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1220 | /* remount read-write */ | 1223 | /* remount read-write */ |
1221 | if (!(s->s_flags & MS_RDONLY)) { | 1224 | if (!(s->s_flags & MS_RDONLY)) { |
1222 | reiserfs_xattr_init(s, *mount_flags); | 1225 | reiserfs_xattr_init(s, *mount_flags); |
1223 | return 0; /* We are read-write already */ | 1226 | goto out_ok; /* We are read-write already */ |
1224 | } | 1227 | } |
1225 | 1228 | ||
1226 | if (reiserfs_is_journal_aborted(journal)) | 1229 | if (reiserfs_is_journal_aborted(journal)) { |
1227 | return journal->j_errno; | 1230 | err = journal->j_errno; |
1231 | goto out_err; | ||
1232 | } | ||
1228 | 1233 | ||
1229 | handle_data_mode(s, mount_options); | 1234 | handle_data_mode(s, mount_options); |
1230 | handle_barrier_mode(s, mount_options); | 1235 | handle_barrier_mode(s, mount_options); |
@@ -1232,7 +1237,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1232 | s->s_flags &= ~MS_RDONLY; /* now it is safe to call journal_begin */ | 1237 | s->s_flags &= ~MS_RDONLY; /* now it is safe to call journal_begin */ |
1233 | err = journal_begin(&th, s, 10); | 1238 | err = journal_begin(&th, s, 10); |
1234 | if (err) | 1239 | if (err) |
1235 | return err; | 1240 | goto out_err; |
1236 | 1241 | ||
1237 | /* Mount a partition which is read-only, read-write */ | 1242 | /* Mount a partition which is read-only, read-write */ |
1238 | reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1); | 1243 | reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1); |
@@ -1247,7 +1252,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1247 | SB_JOURNAL(s)->j_must_wait = 1; | 1252 | SB_JOURNAL(s)->j_must_wait = 1; |
1248 | err = journal_end(&th, s, 10); | 1253 | err = journal_end(&th, s, 10); |
1249 | if (err) | 1254 | if (err) |
1250 | return err; | 1255 | goto out_err; |
1251 | s->s_dirt = 0; | 1256 | s->s_dirt = 0; |
1252 | 1257 | ||
1253 | if (!(*mount_flags & MS_RDONLY)) { | 1258 | if (!(*mount_flags & MS_RDONLY)) { |
@@ -1255,7 +1260,14 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1255 | reiserfs_xattr_init(s, *mount_flags); | 1260 | reiserfs_xattr_init(s, *mount_flags); |
1256 | } | 1261 | } |
1257 | 1262 | ||
1263 | out_ok: | ||
1264 | kfree(s->s_options); | ||
1265 | s->s_options = new_opts; | ||
1258 | return 0; | 1266 | return 0; |
1267 | |||
1268 | out_err: | ||
1269 | kfree(new_opts); | ||
1270 | return err; | ||
1259 | } | 1271 | } |
1260 | 1272 | ||
1261 | static int read_super_block(struct super_block *s, int offset) | 1273 | static int read_super_block(struct super_block *s, int offset) |
@@ -1559,6 +1571,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
1559 | struct reiserfs_sb_info *sbi; | 1571 | struct reiserfs_sb_info *sbi; |
1560 | int errval = -EINVAL; | 1572 | int errval = -EINVAL; |
1561 | 1573 | ||
1574 | save_mount_options(s, data); | ||
1575 | |||
1562 | sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); | 1576 | sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); |
1563 | if (!sbi) { | 1577 | if (!sbi) { |
1564 | errval = -ENOMEM; | 1578 | errval = -ENOMEM; |
@@ -2012,29 +2026,29 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2012 | if (err) | 2026 | if (err) |
2013 | return err; | 2027 | return err; |
2014 | /* Quotafile not on the same filesystem? */ | 2028 | /* Quotafile not on the same filesystem? */ |
2015 | if (nd.mnt->mnt_sb != sb) { | 2029 | if (nd.path.mnt->mnt_sb != sb) { |
2016 | path_release(&nd); | 2030 | path_put(&nd.path); |
2017 | return -EXDEV; | 2031 | return -EXDEV; |
2018 | } | 2032 | } |
2019 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ | 2033 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ |
2020 | if (!REISERFS_I(nd.dentry->d_inode)->i_flags & i_nopack_mask) { | 2034 | if (!REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask) { |
2021 | reiserfs_warning(sb, | 2035 | reiserfs_warning(sb, |
2022 | "reiserfs: Quota file must have tail packing disabled."); | 2036 | "reiserfs: Quota file must have tail packing disabled."); |
2023 | path_release(&nd); | 2037 | path_put(&nd.path); |
2024 | return -EINVAL; | 2038 | return -EINVAL; |
2025 | } | 2039 | } |
2026 | /* Not journalling quota? No more tests needed... */ | 2040 | /* Not journalling quota? No more tests needed... */ |
2027 | if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && | 2041 | if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && |
2028 | !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) { | 2042 | !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) { |
2029 | path_release(&nd); | 2043 | path_put(&nd.path); |
2030 | return vfs_quota_on(sb, type, format_id, path); | 2044 | return vfs_quota_on(sb, type, format_id, path); |
2031 | } | 2045 | } |
2032 | /* Quotafile not of fs root? */ | 2046 | /* Quotafile not of fs root? */ |
2033 | if (nd.dentry->d_parent->d_inode != sb->s_root->d_inode) | 2047 | if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) |
2034 | reiserfs_warning(sb, | 2048 | reiserfs_warning(sb, |
2035 | "reiserfs: Quota file not on filesystem root. " | 2049 | "reiserfs: Quota file not on filesystem root. " |
2036 | "Journalled quota will not work."); | 2050 | "Journalled quota will not work."); |
2037 | path_release(&nd); | 2051 | path_put(&nd.path); |
2038 | return vfs_quota_on(sb, type, format_id, path); | 2052 | return vfs_quota_on(sb, type, format_id, path); |
2039 | } | 2053 | } |
2040 | 2054 | ||