diff options
author | Jan Kara <jack@suse.cz> | 2016-03-29 17:44:11 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2016-03-29 17:44:11 +0200 |
commit | 8f9e8f5fcc059a3cba87ce837c88316797ef3645 (patch) | |
tree | 70c0a92b5227dd17aedb00bd4addc73ff61d7d96 /fs | |
parent | 17e8a8936c3f28085a858e65baee90dff5e8d48b (diff) | |
download | op-kernel-dev-8f9e8f5fcc059a3cba87ce837c88316797ef3645.zip op-kernel-dev-8f9e8f5fcc059a3cba87ce837c88316797ef3645.tar.gz |
ocfs2: Fix Q_GETNEXTQUOTA for filesystem without quotas
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/quota_global.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index 3892f3c..ab6a6cd 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c @@ -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; } |