libxfs: verifier should set buffer error when da block has a bad magic number
If xfs_da3_node_read_verify() doesn't recognize the magic number of a buffer it's just read, set the buffer error to -EFSCORRUPTED so that the error can be sent up to userspace. Without this patch we'll ASSERT on the bad magic eventually while trying to traverse or change the block, but we really ought to fail fast in the verifier.
--- fs/xfs/libxfs/xfs_da_btree.c | 1 + 1 file changed, 1 insertion(+)
fs/xfs/libxfs/xfs_da_btree.c +1 -0
@@ -238,6 +238,7 @@ xfs_da3_node_read_verify(/* corrupt block */ xfs_verifier_error (bp); +xfs_buf_ioerror (bp, -EFSCORRUPTED ); }const struct xfs_buf_ops xfs_da3_node_buf_ops = {
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 16 lines · Darrick J. Wong
If
xfs_da3_node_read_verify()doesn't recognize the magic number of a buffer it's just read, set the buffer error to-EFSCORRUPTEDso that the error can be sent up to userspace. Without this patch we'll ASSERT on the bad magic eventually while trying to traverse or change the block, but we really ought to fail fast in the verifier.Signed-off-by Darrick J. Wong <[email protected]>--- fs/xfs/libxfs/xfs_da_btree.c | 1 + 1 file changed, 1 insertion(+)fs/xfs/libxfs/xfs_da_btree.c +0
-0
fs/xfs/libxfs/xfs_da_btree.c xfs_da3_node_read_verify( · line 242
Quoted 5 lines
fs/xfs/libxfs/xfs_da_btree.c +1
-0@@ -238,6 +238,7 @@ xfs_da3_node_read_verify(/* corrupt block */ xfs_verifier_error (bp); +xfs_buf_ioerror (bp, -EFSCORRUPTED ); }
That should be in the default block of the switch statement, otherwise it will overwrite the error from the node format crc/ verifier failures....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 18 lines · Dave Chinner
Quoted 17 lines · Darrick J. Wong
If
xfs_da3_node_read_verify()doesn't recognize the magic number of a buffer it's just read, set the buffer error to-EFSCORRUPTEDso that the error can be sent up to userspace. Without this patch we'll ASSERT on the bad magic eventually while trying to traverse or change the block, but we really ought to fail fast in the verifier.Signed-off-by Darrick J. Wong <[email protected]>--- fs/xfs/libxfs/xfs_da_btree.c | 1 + 1 file changed, 1 insertion(+)fs/xfs/libxfs/xfs_da_btree.c +0
-0@@ -238,6 +238,7 @@ xfs_da3_node_read_verify(
Quoted 8 lines
fs/xfs/libxfs/xfs_da_btree.c xfs_da3_node_read_verify( · line 242
Quoted 4 lines
fs/xfs/libxfs/xfs_da_btree.c +1
-0/* corrupt block */ xfs_verifier_error (bp); +xfs_buf_ioerror (bp, -EFSCORRUPTED ); }That should be in the default block of the switch statement, otherwise it will overwrite the error from the node format crc/ verifier failures....
Aha, I missed that. Thank you.
--D
Quoted 12 lines
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs