On Thu, Jan 28, 2021 at 09:57:37AM +0000, Christoph Hellwig wrote: > On Wed, Jan 27, 2021 at 10:02:06PM -0800, Darrick J. Wong wrote: > > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > > > For file creation, create a new helper xfs_trans_alloc_icreate that > > allocates a transaction and reserves the appropriate amount of quota > > against that transction. Replace all the open-coded idioms with a > > single call to this helper so that we can contain the retry loops in the > > next patchset. > > For most callers this moves the call to xfs_trans_reserve_quota_icreate > out of the ilock criticial section. Which seems fine and actually > mildly desirable. But please document it. Ok, done. Add this as a second paragraph: "This changes the locking behavior for non-tempfile creation slightly, in that we now make the quota reservation without holding the directory ILOCK. While the dquots chosen for inode creation are based on the directory state at a given point in time, the directory ILOCK was released as soon as the dquot references are picked up. Hence it was never necessary to hold the directory ILOCK for the quota reservation." --D