Files
linux/fs/xfs
Darrick J. Wong 7b6b50f55c xfs: release new dquot buffer on defer_finish error
In commit efa092f3d4 "[XFS] Fixes a bug in the quota code when
allocating a new dquot record", we allocate a new dquot block, grab a
buffer to initialize it, and return the locked initialized dquot buffer
to the caller for further in-core dquot initialization.  Unfortunately,
if the _bmap_finish errored out, _qm_dqalloc would also error out
without bothering to free the (locked) buffer.  Leaking a locked buffer
caused hangs in generic/388 when quotas are enabled.

Furthermore, the _bmap_finish -> _defer_finish conversion in
310a75a3c6 ("xfs: change xfs_bmap_{finish,cancel,init,free} ->
xfs_defer_*") failed to observe that the buffer was held going into
_defer_finish and therefore failed to notice that the buffer lock is
/not/ maintained afterwards.  Now that we can bjoin a buffer to a
defer_ops, use this mechanism to ensure that the buffer stays locked
across the _defer_finish.  Release the holds and locks on the buffer as
appropriate if we have to error out.

There is a subtlety here for the caller in that the buffer emerges
locked and held to the transaction, so if the _trans_commit fails we
have to release the buffer explicitly.  This fixes the unmount hang
in generic/388 when quotas are enabled.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
2018-05-10 08:56:47 -07:00
..
2018-04-11 10:28:39 -07:00
2018-03-30 11:34:55 -07:00
2017-11-09 15:50:29 -08:00
2017-10-26 15:38:26 -07:00
2018-05-10 08:56:41 -07:00
2018-05-09 10:04:00 -07:00
2018-05-10 08:56:41 -07:00
2017-04-03 15:18:17 -07:00
2018-05-10 08:56:41 -07:00
2018-05-10 08:56:41 -07:00
2017-11-09 15:50:29 -08:00
2017-10-26 15:38:27 -07:00
2018-05-10 08:56:41 -07:00
2018-05-10 08:56:41 -07:00
2017-12-08 17:51:05 -08:00
2018-05-10 08:56:46 -07:00