quota: Handle Q_GETNEXTQUOTA when quota is disabled

Currently we oopsed when Q_GETNEXTQUOTA got called when quota was
disabled. Properly check whether quota is enabled for the filesystem
before calling into quota format handler.

Reported-by: Ted Tso <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Jan Kara 2016-03-29 17:20:10 +02:00
parent 1993b176a8
commit 17e8a8936c

View File

@ -2047,11 +2047,20 @@ int dquot_get_next_id(struct super_block *sb, struct kqid *qid)
struct quota_info *dqopt = sb_dqopt(sb); struct quota_info *dqopt = sb_dqopt(sb);
int err; int err;
if (!dqopt->ops[qid->type]->get_next_id) mutex_lock(&dqopt->dqonoff_mutex);
return -ENOSYS; if (!sb_has_quota_active(sb, qid->type)) {
err = -ESRCH;
goto out;
}
if (!dqopt->ops[qid->type]->get_next_id) {
err = -ENOSYS;
goto out;
}
mutex_lock(&dqopt->dqio_mutex); mutex_lock(&dqopt->dqio_mutex);
err = dqopt->ops[qid->type]->get_next_id(sb, qid); err = dqopt->ops[qid->type]->get_next_id(sb, qid);
mutex_unlock(&dqopt->dqio_mutex); mutex_unlock(&dqopt->dqio_mutex);
out:
mutex_unlock(&dqopt->dqonoff_mutex);
return err; return err;
} }