xfs: remove incorrect log write optimization
PATCH 1/1 xfs: remove incorrect log write optimization
We do need a barrier for the first buffer of a split log write. Otherwise we might incorrectly stamp the tail LSN into transactions in the first block, or not flush data I/O before updating the inode size.
fs/xfs/xfs_log.c +2 -5
@@ -1423,11 +1423,8 @@ xlog_sync(xlog_t *log,XFS_BUF_BUSY (bp);XFS_BUF_ASYNC (bp); bp->b_flags |=XBF_LOG_BUFFER ; -/* -* Do an ordered write for the log block. -* Its unnecessary to flush the first split block in the log wrap case. -*/ -if (!split && (log->l_mp->m_flags &XFS_MOUNT_BARRIER )) + +if (log->l_mp->m_flags &XFS_MOUNT_BARRIER )XFS_BUF_ORDERED (bp);ASSERT (XFS_BUF_ADDR (bp) <= log->l_logBBsize-1 );
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
ping?
Quoted 25 lines · Christoph Hellwig
We do need a barrier for the first buffer of a split log write. Otherwise we might incorrectly stamp the tail LSN into transactions in the first block, or not flush data I/O before updating the inode size.
Signed-off-by Christoph Hellwig <[email protected]>Index:
xfs-dev/fs/xfs/xfs_log.c
===================================================================fs/xfs/xfs_log.c +2
-5@@ -1423,11 +1423,8 @@ xlog_sync(xlog_t *log,XFS_BUF_BUSY (bp);XFS_BUF_ASYNC (bp); bp->b_flags |=XBF_LOG_BUFFER ; -/* -* Do an ordered write for the log block. -* Its unnecessary to flush the first split block in the log wrap case. -*/ -if (!split && (log->l_mp->m_flags &XFS_MOUNT_BARRIER )) + +if (log->l_mp->m_flags &XFS_MOUNT_BARRIER )XFS_BUF_ORDERED (bp);ASSERT (XFS_BUF_ADDR (bp) <= log->l_logBBsize-1 );
Quoted 4 lines
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
---end quoted text---
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 3 lines · Christoph Hellwig
We do need a barrier for the first buffer of a split log write. Otherwise we might incorrectly stamp the tail LSN into transactions in the first block, or not flush data I/O before updating the inode size.
I'm not sure whether "first block" means the one at the beginning of the log, or the one at the beginning of a split log write. In any case recovery handles the situation correctly if the write at the end of the log didn't make it to disk before the start of the log. I think you're right about ordering with respect to data I/O though.
This looks good to me.
Quoted 21 lines
Signed-off-by Christoph Hellwig <[email protected]>Index:
xfs-dev/fs/xfs/xfs_log.c
===================================================================fs/xfs/xfs_log.c +2
-5@@ -1423,11 +1423,8 @@ xlog_sync(xlog_t *log,XFS_BUF_BUSY (bp);XFS_BUF_ASYNC (bp); bp->b_flags |=XBF_LOG_BUFFER ; -/* -* Do an ordered write for the log block. -* Its unnecessary to flush the first split block in the log wrap case. -*/ -if (!split && (log->l_mp->m_flags &XFS_MOUNT_BARRIER )) + +if (log->l_mp->m_flags &XFS_MOUNT_BARRIER )XFS_BUF_ORDERED (bp);ASSERT (XFS_BUF_ADDR (bp) <= log->l_logBBsize-1 );
Quoted 4 lines
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 7 lines · Alex Elder
Quoted 3 lines · Christoph Hellwig
We do need a barrier for the first buffer of a split log write. Otherwise we might incorrectly stamp the tail LSN into transactions in the first block, or not flush data I/O before updating the inode size.
I'm not sure whether "first block" means the one at the beginning of the log, or the one at the beginning of a split log write.
It means beginning of the split write. I can fix up the commit message if you want.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Alex Elder
Quoted 3 lines · Christoph Hellwig
We do need a barrier for the first buffer of a split log write. Otherwise we might incorrectly stamp the tail LSN into transactions in the first block, or not flush data I/O before updating the inode size.
Quoted 6 lines
Quoted 2 lines
I'm not sure whether "first block" means the one at the beginning of the log, or the one at the beginning of a split log write.
It means beginning of the split write. I can fix up the commit message if you want.
Don't bother, I will change it to:
We do need a barrier for the first buffer of a split log write. Otherwise we might incorrectly stamp the tail LSN into transactions in the first part of the split write, or not flush data I/O before updating the inode size.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs