[PATCH 0/1] xfstest: using extsize cause corruption with multi buffer page
Alain Renaud
arenaud at sgi.com
Fri Jun 1 13:58:15 CDT 2012
Hi all,
I just found a problem which cause file corruption with filesystem that
have block size smaller then the page size. The problem occur when
using extsize on file and having multiple extents in the same PAGE.
The scenario that I am looking at is a page that look like this:
buffer content
0 empty b_state = 0
1 DATA b_state = 0x1023
2 DATA b_state = 0x1023
3 empty b_state = 0
4 empty b_state = 0
5 DATA b_state = 0x1023
6 DATA b_state = 0x1023
7 empty b_state = 0
At the end the extent should look like this
0 : unwritten extent.
1-2 : real extent
3-4 : unwritten extent.
5-6 : real extent.
7-EOF : unwritten extent.
However the current version of xfs_vm_writepage() will put all the buffer in
the page into 1 ioend which cause the extent list to look like this.
0 : unwritten extent.
1-4 : real extent
5-EOF : unwritten extent.
The test generate a 'template' file which is created
without using extsize look like this.
# xfs_bmap -vp /xfsqa_scratch/testdir/template
/xfsqa_scratch/testdir/template:
EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL FLAGS
0: [0..8]: hole 9
1: [9..23]: 48..62 0 (48..62) 15 00000
# hexdump /xfsqa_scratch/testdir/template
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0001200 4242 4242 4242 4242 4242 4242 4242 4242
*
0001600 0000 0000 0000 0000 0000 0000 0000 0000
*
0001a00 4343 4343 4343 4343 4343 4343 4343 4343
*
0001e00 0000 0000 0000 0000 0000 0000 0000 0000
*
0003000
The test file which is created with 'extsize == 10 pages' give us
this result.
(notice block 13-12 are unwritten but should contain the 'C')
# xfs_bmap -vp /xfsqa_scratch/testdir/zfile-00
/xfsqa_scratch/testdir/zfile-00:
EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL FLAGS
0: [0..8]: 167..175 0 (167..175) 9 10000
1: [9..12]: 176..179 0 (176..179) 4 00000
2: [13..23]: 180..190 0 (180..190) 11 10000
# hexdump /xfsqa_scratch/testdir/zfile-00
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0001200 4242 4242 4242 4242 4242 4242 4242 4242
*
0001600 0691 3c24 d01f 3de9 0597 3e65 b312 3ebf
*
0003000
Looking at the xfs_db output I know that the data get correctly written
to disk but the coversion from unwritten to real seem broken. I have
Isolated the problem to the fact that all buffer in the page are put
into a single xfs_ioend instead of 2. I will propose a fix in a separate
patch. This test is only to show the problem
--
===============================================
Alain Renaud - Cluster File System Engineer
arenaud at sgi.com - SGI
===============================================
More information about the xfs
mailing list