Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+20 -4
+9 -2
fs/ocfs2/quota_global.c
··· 867 867 int status = 0; 868 868 869 869 trace_ocfs2_get_next_id(from_kqid(&init_user_ns, *qid), type); 870 + if (!sb_has_quota_loaded(sb, type)) { 871 + status = -ESRCH; 872 + goto out; 873 + } 870 874 status = ocfs2_lock_global_qf(info, 0); 871 875 if (status < 0) 872 876 goto out; ··· 882 878 out_global: 883 879 ocfs2_unlock_global_qf(info, 0); 884 880 out: 885 - /* Avoid logging ENOENT since it just means there isn't next ID */ 886 - if (status && status != -ENOENT) 881 + /* 882 + * Avoid logging ENOENT since it just means there isn't next ID and 883 + * ESRCH which means quota isn't enabled for the filesystem. 884 + */ 885 + if (status && status != -ENOENT && status != -ESRCH) 887 886 mlog_errno(status); 888 887 return status; 889 888 }
+11 -2
fs/quota/dquot.c
··· 2047 2047 struct quota_info *dqopt = sb_dqopt(sb); 2048 2048 int err; 2049 2049 2050 - if (!dqopt->ops[qid->type]->get_next_id) 2051 - return -ENOSYS; 2050 + mutex_lock(&dqopt->dqonoff_mutex); 2051 + if (!sb_has_quota_active(sb, qid->type)) { 2052 + err = -ESRCH; 2053 + goto out; 2054 + } 2055 + if (!dqopt->ops[qid->type]->get_next_id) { 2056 + err = -ENOSYS; 2057 + goto out; 2058 + } 2052 2059 mutex_lock(&dqopt->dqio_mutex); 2053 2060 err = dqopt->ops[qid->type]->get_next_id(sb, qid); 2054 2061 mutex_unlock(&dqopt->dqio_mutex); 2062 + out: 2063 + mutex_unlock(&dqopt->dqonoff_mutex); 2055 2064 2056 2065 return err; 2057 2066 }