Skip to contentSkip to conversation

xfs: log recovery buffer fixes

PATCH In review Dave Chinner 3 participants 8 messages Sep 2, 2013 – Sep 10, 2013 XFS filesystem

lore
Share & tools
lore
#0 lore raw

cover xfs: log recovery buffer fixes

Folks, these two patches make sure log recovery correctly identifies the type of buffer being recovered. The buffer log format type field is not always being set correctly, and that leads to invalid remote symlink and directory blocks after recovery as they hav enot had the CRC recalculated after being recovered.

Cheers,

Dave.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw

PATCH 1/2 xfs: set remote symlink buffer type for recovery

From: Dave Chinner <[email protected]>

The logging of a remote symlink block does not set the buffer type being logged, and hence on recovery the type of buffer is not recognised and hence CRCs are not calculated after replay. This results in log recoery throwing:

XFS (vdc): Unknown buffer type 0

errors, and subsequent reads of the symlink failing CRC verification. Found via fsstress + godown.

Reported by: Michael L. Semon <[email protected]>

---
 fs/xfs/xfs_symlink.c | 2 ++
 1 file changed, 2 insertions(+)
fs/xfs/xfs_symlink.c +2 -0
index 2f2a7c0..f622a97 100644
@@ -41,6 +41,7 @@
 #include "xfs_trans_space.h"
 #include "xfs_trace.h"
 #include "xfs_symlink.h"
+#include "xfs_buf_item.h"
 
 /* ----- Kernel only functions below ----- */
 STATIC int
@@ -363,6 +364,7 @@ xfs_symlink(
 			pathlen -= byte_cnt;
 			offset += byte_cnt;
 
+			xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF);
 			xfs_trans_log_buf(tp, bp, 0, (buf + byte_cnt - 1) -
 							(char *)bp->b_addr);
 		}
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] xfs: set remote symlink buffer type for recovery

Quoted 2 lines · Dave Chinner

errors, and subsequent reads of the symlink failing CRC verification. Found via fsstress + godown.

Can you make sure xfstests triggers this case, please?

fs/xfs/xfs_symlink.c xfs_symlink( · line 369

Quoted 3 lines
fs/xfs/xfs_symlink.c +1 -0
+			xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF);
 			xfs_trans_log_buf(tp, bp, 0, (buf + byte_cnt - 1) -
 							(char *)bp->b_addr);

Looks good,

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw

Re: [PATCH 1/2] xfs: set remote symlink buffer type for recovery

Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Dave Chinner

errors, and subsequent reads of the symlink failing CRC verification. Found via fsstress + godown.

Can you make sure xfstests triggers this case, please?

Yeah, I've got a script that reproduced it, so i shoul dbe able to turn it into an xfstest easily enough...

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#4 lore raw

PATCH 2/2 xfs: ensure we copy buffer type in da btree root splits

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

When splitting the root of the da btree, we shuffled data between buffers and the structures that track them. At one point, we copy data and state from one buffer to another, including the ops aasociated with the buffer. When we do this, we also need to copy the buffer type associated with the buf log item so that the buffer is logged correctly. If we don't do that, log recovery won't recognise it and hence it won't recalculate the CRC on the buffer after recovery. This leads to a directory block that can't be read after recovery has run.

Found by inspection after finding the same problem with remote symlink buffers.

---
 fs/xfs/xfs_da_btree.c | 1 +
 1 file changed, 1 insertion(+)
fs/xfs/xfs_da_btree.c +1 -0
index d4e59a4..069537c 100644
@@ -635,6 +635,7 @@ xfs_da3_root_split(
 	xfs_trans_log_buf(tp, bp, 0, size - 1);
 
 	bp->b_ops = blk1->bp->b_ops;
+	xfs_trans_buf_copy_type(bp, blk1->bp);
 	blk1->bp = bp;
 	blk1->blkno = blkno;
 
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#5 lore raw

Re: [PATCH 2/2] xfs: ensure we copy buffer type in da btree root splits

Quoted 12 lines · Dave Chinner

From: Dave Chinner <[email protected]>

When splitting the root of the da btree, we shuffled data between buffers and the structures that track them. At one point, we copy data and state from one buffer to another, including the ops aasociated with the buffer. When we do this, we also need to copy the buffer type associated with the buf log item so that the buffer is logged correctly. If we don't do that, log recovery won't recognise it and hence it won't recalculate the CRC on the buffer after recovery. This leads to a directory block that can't be read after recovery has run.

Quoted 2 lines

Found by inspection after finding the same problem with remote symlink buffers.

It would be great to find a way to trigger this in QA as this shows another area lacking coverage.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#6 lore raw

Re: [PATCH 2/2] xfs: ensure we copy buffer type in da btree root splits

Quoted 13 lines · Christoph Hellwig
Quoted 12 lines · Dave Chinner

From: Dave Chinner <[email protected]>

When splitting the root of the da btree, we shuffled data between buffers and the structures that track them. At one point, we copy data and state from one buffer to another, including the ops aasociated with the buffer. When we do this, we also need to copy the buffer type associated with the buf log item so that the buffer is logged correctly. If we don't do that, log recovery won't recognise it and hence it won't recalculate the CRC on the buffer after recovery. This leads to a directory block that can't be read after recovery has run.

Quoted 5 lines
Quoted 2 lines

Found by inspection after finding the same problem with remote symlink buffers.

It would be great to find a way to trigger this in QA as this shows another area lacking coverage.

I'm pretty sure the same script I discovered the symlink problem was triggering it. It was actually trying to track down an assert failure in the directory code that Michael Semon had reported to me with a rough test case that I then scripted.

I just haven't done enough testing to be certain it wasn't something else. Also, xfs/182 was assert failures after log recovery that had a similar signature that I also haven't seen since adding this patch. So I think we got some coverage of it...

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#7 lore raw
In reply to Dave Chinner
Quoted 5 lines · Dave Chinner

Folks, these two patches make sure log recovery correctly identifies the type of buffer being recovered. The buffer log format type field is not always being set correctly, and that leads to invalid remote symlink and directory blocks after recovery as they hav enot had the CRC recalculated after being recovered.

Applied these 2.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs