diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2008-02-08 07:21:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:40 -0500 |
commit | cdf6ccc8b88d667b3d326d3c506bca60b8c09939 (patch) | |
tree | b65e14d2e163f5b802e770413bf8c782afb7759a /fs/reiserfs | |
parent | 564cd138cb30658c12e80c33582bf50816ec7a41 (diff) |
mount options: fix reiserfs
Add a .show_options super operation to reiserfs.
Use generic_show_options() and save the complete option string in
reiserfs_fill_super() and reiserfs_remount().
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/super.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 5cd85fe5df5d..6033f0c3bd0b 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; |