Skip to content

Commit

Permalink
ext4: avoid calling dquot_get_next_id() if quota is not enabled
Browse files Browse the repository at this point in the history
This should be fixed in the quota layer so we can test with the quota
mutex held, but for now, we need this to avoid tests from crashing the
kernel aborting the regression test suite.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
Theodore Ts'o committed Apr 1, 2016
1 parent e84dfbe commit 8f0e874
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
unsigned int flags);
static int ext4_enable_quotas(struct super_block *sb);
static int ext4_get_next_id(struct super_block *sb, struct kqid *qid);

static struct dquot **ext4_get_dquots(struct inode *inode)
{
Expand All @@ -1129,7 +1130,7 @@ static const struct dquot_operations ext4_quota_operations = {
.alloc_dquot = dquot_alloc,
.destroy_dquot = dquot_destroy,
.get_projid = ext4_get_projid,
.get_next_id = dquot_get_next_id,
.get_next_id = ext4_get_next_id,
};

static const struct quotactl_ops ext4_qctl_operations = {
Expand Down Expand Up @@ -5274,6 +5275,17 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
return len;
}

static int ext4_get_next_id(struct super_block *sb, struct kqid *qid)
{
const struct quota_format_ops *ops;

if (!sb_has_quota_loaded(sb, qid->type))
return -ESRCH;
ops = sb_dqopt(sb)->ops[qid->type];
if (!ops || !ops->get_next_id)
return -ENOSYS;
return dquot_get_next_id(sb, qid);
}
#endif

static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags,
Expand Down

0 comments on commit 8f0e874

Please sign in to comment.