Re: [PATCH 05/43] xfs: don't take m_sb_lock in xfs_fs_statfs

Christoph Hellwig
2024-12-13T05:06:19Z

On Thu, Dec 12, 2024 at 01:42:06PM -0800, Darrick J. Wong wrote:
> On Wed, Dec 11, 2024 at 09:54:30AM +0100, Christoph Hellwig wrote:
> > The only non-constant value read under m_sb_lock in xfs_fs_statfs is
> > sb_dblocks, and it could become stale right after dropping the lock
> > anyway. Remove the thus pointless lock section.
>
> Is there a stronger reason later for removing the critical section?
> Do we lose much by leaving the protection in place?

It makes a completely mess of xfs_fs_statfs, and as stated in the
commit message about it's not actually useful at all. I also don't
think taking a global lock from a non-privileged operation is an
old that good idea to start with if we can avoid it.