]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xfs: fix chown with rt quota
authorDarrick J. Wong <djwong@kernel.org>
Mon, 4 Nov 2024 04:19:39 +0000 (20:19 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 5 Nov 2024 21:38:45 +0000 (13:38 -0800)
commitb28564cae1e4215db785c11c5f23cbf5268335a1
tree2683c3d951ed81cc08633c9fab6e96ed4f2eb0b4
parentd5d9dd5b3026a8bf58f21228b47df9e9942a9c42
xfs: fix chown with rt quota

Make chown's quota adjustments work with realtime files.  This is mostly
a matter of calling xfs_inode_count_blocks on a given file to figure out
the number of blocks allocated to the data device and to the realtime
device, and using those quantities to update the quota accounting when
the id changes.  Delayed allocation reservations are moved from the old
dquot's incore reservation to the new dquot's incore reservation.

Note that there was a missing ILOCK bug in xfs_qm_dqusage_adjust that we
must fix before calling xfs_iread_extents.  Prior to 2.6.37 the locking
was correct, but then someone removed the ILOCK as part of a cleanup.
Nobody noticed because nowhere in the git history have we ever supported
rt+quota so nobody can use this.

I'm leaving git breadcrumbs in case anyone is desperate enough to try to
backport the rtquota code to old kernels.

Not-Cc: <stable@vger.kernel.org> # v2.6.37
Fixes: 52fda114249578 ("xfs: simplify xfs_qm_dqusage_adjust")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_qm.c
fs/xfs/xfs_trans.c