Skip to contentSkip to conversation

xfs: remove incorrect log write optimization

PATCH In review Christoph Hellwig 2 participants 5 messages Jun 28, 2010 – Jul 13, 2010 XFS filesystem

lore
Share & tools
lore
#0 lore raw

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
Index: xfs-dev/fs/xfs/xfs_log.c
===================================================================
@@ -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

#1 lore raw

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.

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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Christoph Hellwig
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

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

#3 lore raw
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

#4 lore raw
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