On Wed, Jan 18, 2023 at 05:24:58PM -0800, Darrick J. Wong wrote: > xfs_ilock(ip, lock_mode); > + > + /* > + * It's possible that the unlocked access of the data fork to determine > + * the lock mode could have raced with another thread that was failing > + * to load the bmbt but hadn't yet torn down the iext tree. Recheck > + * the lock mode and upgrade to an exclusive lock if we need to. > + */ > + if (lock_mode == XFS_ILOCK_SHARED && > + xfs_need_iread_extents(&ip->i_df)) { Eww. I think the proper fix here is to make sure xfs_need_iread_extents does not return false until we're actually read the extents. So I think we'll need a new inode flag XFS_INEED_READ - gets set when reading inode in btree format, and gets cleared at the very end of xfs_iread_extents once we know the read succeeded.