diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-10 05:22:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-10 05:22:26 -0400 |
commit | 65b53e4cc90e59936733b3b95b9451d2ca47528d (patch) | |
tree | 29932718192962671c48c3fd1ea017a6112459e8 /fs/ext4/super.c | |
parent | 788c0a53164c05c5ccdb1472474372b72ba74644 (diff) | |
parent | 2e761e0532a784816e7e822dbaaece8c5d4be14d (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/tg3.c
drivers/net/wireless/rt2x00/rt2x00dev.c
net/mac80211/ieee80211_i.h
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 80 |
1 files changed, 58 insertions, 22 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 52dd0679a4e2..09d9359c8055 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -979,7 +979,7 @@ static int parse_options (char *options, struct super_block *sb, | |||
979 | int data_opt = 0; | 979 | int data_opt = 0; |
980 | int option; | 980 | int option; |
981 | #ifdef CONFIG_QUOTA | 981 | #ifdef CONFIG_QUOTA |
982 | int qtype; | 982 | int qtype, qfmt; |
983 | char *qname; | 983 | char *qname; |
984 | #endif | 984 | #endif |
985 | 985 | ||
@@ -1162,9 +1162,11 @@ static int parse_options (char *options, struct super_block *sb, | |||
1162 | case Opt_grpjquota: | 1162 | case Opt_grpjquota: |
1163 | qtype = GRPQUOTA; | 1163 | qtype = GRPQUOTA; |
1164 | set_qf_name: | 1164 | set_qf_name: |
1165 | if (sb_any_quota_enabled(sb)) { | 1165 | if ((sb_any_quota_enabled(sb) || |
1166 | sb_any_quota_suspended(sb)) && | ||
1167 | !sbi->s_qf_names[qtype]) { | ||
1166 | printk(KERN_ERR | 1168 | printk(KERN_ERR |
1167 | "EXT4-fs: Cannot change journalled " | 1169 | "EXT4-fs: Cannot change journaled " |
1168 | "quota options when quota turned on.\n"); | 1170 | "quota options when quota turned on.\n"); |
1169 | return 0; | 1171 | return 0; |
1170 | } | 1172 | } |
@@ -1200,9 +1202,11 @@ set_qf_name: | |||
1200 | case Opt_offgrpjquota: | 1202 | case Opt_offgrpjquota: |
1201 | qtype = GRPQUOTA; | 1203 | qtype = GRPQUOTA; |
1202 | clear_qf_name: | 1204 | clear_qf_name: |
1203 | if (sb_any_quota_enabled(sb)) { | 1205 | if ((sb_any_quota_enabled(sb) || |
1206 | sb_any_quota_suspended(sb)) && | ||
1207 | sbi->s_qf_names[qtype]) { | ||
1204 | printk(KERN_ERR "EXT4-fs: Cannot change " | 1208 | printk(KERN_ERR "EXT4-fs: Cannot change " |
1205 | "journalled quota options when " | 1209 | "journaled quota options when " |
1206 | "quota turned on.\n"); | 1210 | "quota turned on.\n"); |
1207 | return 0; | 1211 | return 0; |
1208 | } | 1212 | } |
@@ -1213,10 +1217,20 @@ clear_qf_name: | |||
1213 | sbi->s_qf_names[qtype] = NULL; | 1217 | sbi->s_qf_names[qtype] = NULL; |
1214 | break; | 1218 | break; |
1215 | case Opt_jqfmt_vfsold: | 1219 | case Opt_jqfmt_vfsold: |
1216 | sbi->s_jquota_fmt = QFMT_VFS_OLD; | 1220 | qfmt = QFMT_VFS_OLD; |
1217 | break; | 1221 | goto set_qf_format; |
1218 | case Opt_jqfmt_vfsv0: | 1222 | case Opt_jqfmt_vfsv0: |
1219 | sbi->s_jquota_fmt = QFMT_VFS_V0; | 1223 | qfmt = QFMT_VFS_V0; |
1224 | set_qf_format: | ||
1225 | if ((sb_any_quota_enabled(sb) || | ||
1226 | sb_any_quota_suspended(sb)) && | ||
1227 | sbi->s_jquota_fmt != qfmt) { | ||
1228 | printk(KERN_ERR "EXT4-fs: Cannot change " | ||
1229 | "journaled quota options when " | ||
1230 | "quota turned on.\n"); | ||
1231 | return 0; | ||
1232 | } | ||
1233 | sbi->s_jquota_fmt = qfmt; | ||
1220 | break; | 1234 | break; |
1221 | case Opt_quota: | 1235 | case Opt_quota: |
1222 | case Opt_usrquota: | 1236 | case Opt_usrquota: |
@@ -1241,6 +1255,9 @@ clear_qf_name: | |||
1241 | case Opt_quota: | 1255 | case Opt_quota: |
1242 | case Opt_usrquota: | 1256 | case Opt_usrquota: |
1243 | case Opt_grpquota: | 1257 | case Opt_grpquota: |
1258 | printk(KERN_ERR | ||
1259 | "EXT4-fs: quota options not supported.\n"); | ||
1260 | break; | ||
1244 | case Opt_usrjquota: | 1261 | case Opt_usrjquota: |
1245 | case Opt_grpjquota: | 1262 | case Opt_grpjquota: |
1246 | case Opt_offusrjquota: | 1263 | case Opt_offusrjquota: |
@@ -1248,7 +1265,7 @@ clear_qf_name: | |||
1248 | case Opt_jqfmt_vfsold: | 1265 | case Opt_jqfmt_vfsold: |
1249 | case Opt_jqfmt_vfsv0: | 1266 | case Opt_jqfmt_vfsv0: |
1250 | printk(KERN_ERR | 1267 | printk(KERN_ERR |
1251 | "EXT4-fs: journalled quota options not " | 1268 | "EXT4-fs: journaled quota options not " |
1252 | "supported.\n"); | 1269 | "supported.\n"); |
1253 | break; | 1270 | break; |
1254 | case Opt_noquota: | 1271 | case Opt_noquota: |
@@ -1333,14 +1350,14 @@ clear_qf_name: | |||
1333 | } | 1350 | } |
1334 | 1351 | ||
1335 | if (!sbi->s_jquota_fmt) { | 1352 | if (!sbi->s_jquota_fmt) { |
1336 | printk(KERN_ERR "EXT4-fs: journalled quota format " | 1353 | printk(KERN_ERR "EXT4-fs: journaled quota format " |
1337 | "not specified.\n"); | 1354 | "not specified.\n"); |
1338 | return 0; | 1355 | return 0; |
1339 | } | 1356 | } |
1340 | } else { | 1357 | } else { |
1341 | if (sbi->s_jquota_fmt) { | 1358 | if (sbi->s_jquota_fmt) { |
1342 | printk(KERN_ERR "EXT4-fs: journalled quota format " | 1359 | printk(KERN_ERR "EXT4-fs: journaled quota format " |
1343 | "specified with no journalling " | 1360 | "specified with no journaling " |
1344 | "enabled.\n"); | 1361 | "enabled.\n"); |
1345 | return 0; | 1362 | return 0; |
1346 | } | 1363 | } |
@@ -1581,7 +1598,7 @@ static void ext4_orphan_cleanup (struct super_block * sb, | |||
1581 | int ret = ext4_quota_on_mount(sb, i); | 1598 | int ret = ext4_quota_on_mount(sb, i); |
1582 | if (ret < 0) | 1599 | if (ret < 0) |
1583 | printk(KERN_ERR | 1600 | printk(KERN_ERR |
1584 | "EXT4-fs: Cannot turn on journalled " | 1601 | "EXT4-fs: Cannot turn on journaled " |
1585 | "quota: error %d\n", ret); | 1602 | "quota: error %d\n", ret); |
1586 | } | 1603 | } |
1587 | } | 1604 | } |
@@ -3106,7 +3123,7 @@ static int ext4_release_dquot(struct dquot *dquot) | |||
3106 | 3123 | ||
3107 | static int ext4_mark_dquot_dirty(struct dquot *dquot) | 3124 | static int ext4_mark_dquot_dirty(struct dquot *dquot) |
3108 | { | 3125 | { |
3109 | /* Are we journalling quotas? */ | 3126 | /* Are we journaling quotas? */ |
3110 | if (EXT4_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] || | 3127 | if (EXT4_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] || |
3111 | EXT4_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) { | 3128 | EXT4_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) { |
3112 | dquot_mark_dquot_dirty(dquot); | 3129 | dquot_mark_dquot_dirty(dquot); |
@@ -3153,23 +3170,42 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, | |||
3153 | 3170 | ||
3154 | if (!test_opt(sb, QUOTA)) | 3171 | if (!test_opt(sb, QUOTA)) |
3155 | return -EINVAL; | 3172 | return -EINVAL; |
3156 | /* Not journalling quota? */ | 3173 | /* When remounting, no checks are needed and in fact, path is NULL */ |
3157 | if ((!EXT4_SB(sb)->s_qf_names[USRQUOTA] && | 3174 | if (remount) |
3158 | !EXT4_SB(sb)->s_qf_names[GRPQUOTA]) || remount) | ||
3159 | return vfs_quota_on(sb, type, format_id, path, remount); | 3175 | return vfs_quota_on(sb, type, format_id, path, remount); |
3176 | |||
3160 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); | 3177 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); |
3161 | if (err) | 3178 | if (err) |
3162 | return err; | 3179 | return err; |
3180 | |||
3163 | /* Quotafile not on the same filesystem? */ | 3181 | /* Quotafile not on the same filesystem? */ |
3164 | if (nd.path.mnt->mnt_sb != sb) { | 3182 | if (nd.path.mnt->mnt_sb != sb) { |
3165 | path_put(&nd.path); | 3183 | path_put(&nd.path); |
3166 | return -EXDEV; | 3184 | return -EXDEV; |
3167 | } | 3185 | } |
3168 | /* Quotafile not of fs root? */ | 3186 | /* Journaling quota? */ |
3169 | if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) | 3187 | if (EXT4_SB(sb)->s_qf_names[type]) { |
3170 | printk(KERN_WARNING | 3188 | /* Quotafile not of fs root? */ |
3171 | "EXT4-fs: Quota file not on filesystem root. " | 3189 | if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) |
3172 | "Journalled quota will not work.\n"); | 3190 | printk(KERN_WARNING |
3191 | "EXT4-fs: Quota file not on filesystem root. " | ||
3192 | "Journaled quota will not work.\n"); | ||
3193 | } | ||
3194 | |||
3195 | /* | ||
3196 | * When we journal data on quota file, we have to flush journal to see | ||
3197 | * all updates to the file when we bypass pagecache... | ||
3198 | */ | ||
3199 | if (ext4_should_journal_data(nd.path.dentry->d_inode)) { | ||
3200 | /* | ||
3201 | * We don't need to lock updates but journal_flush() could | ||
3202 | * otherwise be livelocked... | ||
3203 | */ | ||
3204 | jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); | ||
3205 | jbd2_journal_flush(EXT4_SB(sb)->s_journal); | ||
3206 | jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); | ||
3207 | } | ||
3208 | |||
3173 | path_put(&nd.path); | 3209 | path_put(&nd.path); |
3174 | return vfs_quota_on(sb, type, format_id, path, remount); | 3210 | return vfs_quota_on(sb, type, format_id, path, remount); |
3175 | } | 3211 | } |