xfs: wait for the write of the superblock on unmount
RFC 1/1 xfs: wait for the write of the superblock on unmount
In reply to a message not in the archiveSorry, I have been distracted away from this regression. This was previously titled "xfs: synchronously write the superblock on unmount".
xfs_wait_buftarg() does not wait for the completion of the write of the uncached superblock. This write can race with the shutdown of the log and causes a panic if the write does not win the race.
The log write of the superblock is important for possible recovery, but a second syncronous write of the same superblock seems redundant. Would just waiting for the iodone() of the log write before tearing down the log be enough?
--- fs/xfs/xfs_mount.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/xfs/xfs_mount.c +8 -0
@@ -1457,6 +1457,7 @@ voidxfs_unmountfs ( struct xfs_mount *mp) { +struct xfs_buf *bp = mp->m_sb_bp;__uint64_t resblks;int error;
@@ -1529,6 +1530,13 @@ xfs_unmountfs(xfs_ail_push_all_sync (mp->m_ail);xfs_wait_buftarg (mp->m_ddev_targp); +/* +* Wait for the superblock to be written out. The superblock buffer +* will remain locked until the iodone(). +*/ +xfs_buf_lock (bp); +xfs_buf_unlock (bp); +xfs_log_unmount_write (mp);xfs_log_unmount (mp);xfs_uuid_unmount (mp);
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 11 lines · On Wed, Jul 18, 2012 at 12:33:58PM -0500, [email protected] wrote:
Sorry, I have been distracted away from this regression. This was previously titled "xfs: synchronously write the superblock on unmount".
xfs_wait_buftarg()does not wait for the completion of the write of the uncached superblock. This write can race with the shutdown of the log and causes a panic if the write does not win the race.The log write of the superblock is important for possible recovery, but a second syncronous write of the same superblock seems redundant. Would just waiting for the
iodone()of the log write before tearing down the log be enough?
Yes. i.e. something like:
/* * The superblock buffer is uncached, so xfs_wait_buftarg() * will not wait for it. Hence we need to explicitly wait * for IO completion on the superblock to occur here. */ error = xfs_buf_iowait(mp->m_sb_bp); if (error) AAAAIEEEE!
This fix is also needed in xfs_quiesce_attr() for the freeze and ro,remount cases as well.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 24 lines · Dave Chinner
Quoted 11 lines · On Wed, Jul 18, 2012 at 12:33:58PM -0500, [email protected] wrote:
Sorry, I have been distracted away from this regression. This was previously titled "xfs: synchronously write the superblock on unmount".
xfs_wait_buftarg()does not wait for the completion of the write of the uncached superblock. This write can race with the shutdown of the log and causes a panic if the write does not win the race.The log write of the superblock is important for possible recovery, but a second syncronous write of the same superblock seems redundant. Would just waiting for the
iodone()of the log write before tearing down the log be enough?Yes. i.e. something like:
/* * The superblock buffer is uncached, so xfs_wait_buftarg() * will not wait for it. Hence we need to explicitly wait * for IO completion on the superblock to occur here. */ error = xfs_buf_iowait(mp->m_sb_bp); if (error) AAAAIEEEE!
Quoted 7 lines
This fix is also needed in
xfs_quiesce_attr()for the freeze and ro,remount cases as well.Cheers,
Dave.
Thanks for the feedback.
I chose the ugly lock to block on the superblock buffer because it has XBF_ASYNC set at that point and won't go through the complete() patch. I will look at turning the XBF_ASYNC flag off and wait on a xfs_buf_iowait().
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 37 lines · Mark Tinguely
Quoted 28 lines · Dave Chinner
Quoted 9 lines · On Wed, Jul 18, 2012 at 12:33:58PM -0500, [email protected] wrote:
Sorry, I have been distracted away from this regression. This was previously
titled "xfs: synchronously write the superblock on unmount".
xfs_wait_buftarg()does not wait for the completion of the write of the uncached superblock. This write can race with the shutdown of the log and
causes a panic if the write does not win the race.Quoted 6 lines
The log write of the superblock is important for possible recovery, but a
second syncronous write of the same superblock seems redundant. Would just
waiting for theiodone()of the log write before tearing down the log be enough?Yes. i.e. something like:
/*
* The superblock buffer is uncached, soxfs_wait_buftarg()
* will not wait for it. Hence we need to explicitly wait
* for IO completion on the superblock to occur here. */
error =xfs_buf_iowait(mp->m_sb_bp);
if (error)
AAAAIEEEE!Quoted 7 lines
This fix is also needed in
xfs_quiesce_attr()for the freeze and ro,remount cases as well.Cheers,
Dave.
Quoted 7 lines
Thanks for the feedback.
I chose the ugly lock to block on the superblock buffer because it has
XBF_ASYNCset at that point and won't go through thecomplete()patch. I will look at turning theXBF_ASYNCflag off and wait on axfs_buf_iowait().--Mark.
Looks like the xfsaild_push() sets the XBF_ASYNC flag on the superblock buffer. Waiting on the xfs_buf_iowait() won't work but have to use the less elegant lock.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 11 lines · On Wed, Jul 18, 2012 at 12:33:58PM -0500, [email protected] wrote:
Sorry, I have been distracted away from this regression. This was previously titled "xfs: synchronously write the superblock on unmount".
xfs_wait_buftarg()does not wait for the completion of the write of the uncached superblock. This write can race with the shutdown of the log and causes a panic if the write does not win the race.The log write of the superblock is important for possible recovery, but a second syncronous write of the same superblock seems redundant. Would just waiting for the
iodone()of the log write before tearing down the log be enough?
This doesn't look beautiful, but I suspect there's no good way around it. Can you add your explanation from the reply on why xfs_buf_iowait does not work here to the comment above the lock/unlock pair?
With that:
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 13 lines · Christoph Hellwig
Quoted 11 lines · On Wed, Jul 18, 2012 at 12:33:58PM -0500, [email protected] wrote:
Sorry, I have been distracted away from this regression. This was previously titled "xfs: synchronously write the superblock on unmount".
xfs_wait_buftarg()does not wait for the completion of the write of the uncached superblock. This write can race with the shutdown of the log and causes a panic if the write does not win the race.The log write of the superblock is important for possible recovery, but a second syncronous write of the same superblock seems redundant. Would just waiting for the
iodone()of the log write before tearing down the log be enough?
Quoted 7 lines
This doesn't look beautiful, but I suspect there's no good way around it. Can you add your explanation from the reply on why
xfs_buf_iowaitdoes not work here to the comment above the lock/unlock pair?With that:
Reviewed-by Christoph Hellwig<[email protected]>
Thank-you. I will repost with the same xfs_buf_lock() entry to xfs_quiesce_attr().
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs