aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 94a527261cae..cddf7f0e0fda 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3170,23 +3170,42 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
3170 3170
3171 if (!test_opt(sb, QUOTA)) 3171 if (!test_opt(sb, QUOTA))
3172 return -EINVAL; 3172 return -EINVAL;
3173 /* Not journalling quota? */ 3173 /* When remounting, no checks are needed and in fact, path is NULL */
3174 if ((!EXT4_SB(sb)->s_qf_names[USRQUOTA] && 3174 if (remount)
3175 !EXT4_SB(sb)->s_qf_names[GRPQUOTA]) || remount)
3176 return vfs_quota_on(sb, type, format_id, path, remount); 3175 return vfs_quota_on(sb, type, format_id, path, remount);
3176
3177 err = path_lookup(path, LOOKUP_FOLLOW, &nd); 3177 err = path_lookup(path, LOOKUP_FOLLOW, &nd);
3178 if (err) 3178 if (err)
3179 return err; 3179 return err;
3180
3180 /* Quotafile not on the same filesystem? */ 3181 /* Quotafile not on the same filesystem? */
3181 if (nd.path.mnt->mnt_sb != sb) { 3182 if (nd.path.mnt->mnt_sb != sb) {
3182 path_put(&nd.path); 3183 path_put(&nd.path);
3183 return -EXDEV; 3184 return -EXDEV;
3184 } 3185 }
3185 /* Quotafile not of fs root? */ 3186 /* Journaling quota? */
3186 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) 3187 if (EXT4_SB(sb)->s_qf_names[type]) {
3187 printk(KERN_WARNING 3188 /* Quotafile not of fs root? */
3188 "EXT4-fs: Quota file not on filesystem root. " 3189 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
3189 "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
3190 path_put(&nd.path); 3209 path_put(&nd.path);
3191 return vfs_quota_on(sb, type, format_id, path, remount); 3210 return vfs_quota_on(sb, type, format_id, path, remount);
3192} 3211}