提交 17e8a893 编写于 作者: J Jan Kara

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: NTed Tso <tytso@mit.edu>
Signed-off-by: NJan Kara <jack@suse.cz>
上级 1993b176
......@@ -2047,11 +2047,20 @@ int dquot_get_next_id(struct super_block *sb, struct kqid *qid)
struct quota_info *dqopt = sb_dqopt(sb);
int err;
if (!dqopt->ops[qid->type]->get_next_id)
return -ENOSYS;
mutex_lock(&dqopt->dqonoff_mutex);
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);
err = dqopt->ops[qid->type]->get_next_id(sb, qid);
mutex_unlock(&dqopt->dqio_mutex);
out:
mutex_unlock(&dqopt->dqonoff_mutex);
return err;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册