Skip to content

Commit

Permalink
ocfs2: Fix Q_GETNEXTQUOTA for filesystem without quotas
Browse files Browse the repository at this point in the history
When Q_GETNEXTQUOTA was called for filesystem with quotas disabled
ocfs2_get_next_id() oopses. Fix the problem by checking early whether
the filesystem has quotas enabled.

Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
jankara committed Mar 29, 2016
1 parent 17e8a89 commit 8f9e8f5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fs/ocfs2/quota_global.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 8f9e8f5

Please sign in to comment.