On Thu, Oct 10, 2024 at 06:12:21PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > Make chown's quota adjustments work with realtime files. Maybe explain how you made it work here? > @@ -1393,18 +1393,17 @@ xfs_qm_dqusage_adjust( > > ASSERT(ip->i_delayed_blks == 0); > > + lock_mode = xfs_ilock_data_map_shared(ip); > if (XFS_IS_REALTIME_INODE(ip)) { > - struct xfs_ifork *ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK); > - > error = xfs_iread_extents(tp, ip, XFS_DATA_FORK); > - if (error) > + if (error) { > + xfs_iunlock(ip, lock_mode); > goto error0; > - > - xfs_bmap_count_leaves(ifp, &rtblks); > + } So this obviously was missing locking :) > } > - > - nblks = (xfs_qcnt_t)ip->i_nblocks - rtblks; > + xfs_inode_count_blocks(tp, ip, &nblks, &rtblks); > xfs_iflags_clear(ip, XFS_IQUOTAUNCHECKED); > + xfs_iunlock(ip, lock_mode); But this now also forces lockign for !rt file systems, I guess we don't really care about an extra ilock roundtrip in chown, though. The changes itself look good, but a useful commit log would be nice: Reviewed-by: Christoph Hellwig <hch@xxxxxx>