1
0
Fork 0

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull quota fixes from Jan Kara:
 "Fixes for oopses when the new quotactl gets used with quotas disabled"

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  ocfs2: Fix Q_GETNEXTQUOTA for filesystem without quotas
  quota: Handle Q_GETNEXTQUOTA when quota is disabled
hifive-unleashed-5.1
Linus Torvalds 2016-04-04 13:18:27 -07:00
commit e865f4965f
2 changed files with 20 additions and 4 deletions

View File

@ -867,6 +867,10 @@ static int ocfs2_get_next_id(struct super_block *sb, struct kqid *qid)
int status = 0;
trace_ocfs2_get_next_id(from_kqid(&init_user_ns, *qid), type);
if (!sb_has_quota_loaded(sb, type)) {
status = -ESRCH;
goto out;
}
status = ocfs2_lock_global_qf(info, 0);
if (status < 0)
goto out;
@ -878,8 +882,11 @@ static int ocfs2_get_next_id(struct super_block *sb, struct kqid *qid)
out_global:
ocfs2_unlock_global_qf(info, 0);
out:
/* Avoid logging ENOENT since it just means there isn't next ID */
if (status && status != -ENOENT)
/*
* Avoid logging ENOENT since it just means there isn't next ID and
* ESRCH which means quota isn't enabled for the filesystem.
*/
if (status && status != -ENOENT && status != -ESRCH)
mlog_errno(status);
return status;
}

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);
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;
}