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

xfs: Fix quota type in quota structures when reusing quota file

For filesystems without separate project quota inode field in the
superblock we just reuse project quota file for group quotas (and vice
versa) if project quota file is allocated and we need group quota file.
When we reuse the file, quota structures on disk suddenly have wrong
type stored in d_flags though. Nobody really cares about this (although
structure type reported to userspace was wrong as well) except
that after commit 14bf61ffe6ac (quota: Switch ->get_dqblk() and
->set_dqblk() to use bytes as space units) assertion in
xfs_qm_scall_getquota() started to trigger on xfs/106 test (apparently I
was testing without XFS_DEBUG so I didn't notice when submitting the
above commit).

Fix the problem by properly resetting ddq->d_flags when running quotacheck
for a quota file.

CC: stable@vger.kernel.org
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>

authored by

Jan Kara and committed by
Dave Chinner
dfcc70a8 c517d838

+5
+5
fs/xfs/xfs_qm.c
··· 836 836 */ 837 837 xfs_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR, 838 838 "xfs_quotacheck"); 839 + /* 840 + * Reset type in case we are reusing group quota file for 841 + * project quotas or vice versa 842 + */ 843 + ddq->d_flags = type; 839 844 ddq->d_bcount = 0; 840 845 ddq->d_icount = 0; 841 846 ddq->d_rtbcount = 0;