| To: | Eric Sandeen <sandeen@xxxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH] fix corruption case for block size < page size |
| From: | Lachlan McIlroy <lachlan@xxxxxxx> |
| Date: | Tue, 16 Dec 2008 18:54:14 +1100 |
| Cc: | xfs-oss <xfs@xxxxxxxxxxx> |
| In-reply-to: | <4947466D.7000705@sandeen.net> |
| Organization: | SGI |
| References: | <49435F35.40109@sandeen.net> <4943FCD7.2010509@sandeen.net> <494735D9.8020809@sgi.com> <49473F5C.3070308@sandeen.net> <49474530.2080809@sgi.com> <4947466D.7000705@sandeen.net> |
| Reply-to: | lachlan@xxxxxxx |
| User-agent: | Thunderbird 2.0.0.18 (X11/20081105) |
Eric Sandeen wrote:
Lachlan McIlroy wrote:I assumed that the zeroing would stop at the new file size. This bit of code in xfs_zero_eof() should ensure that:Eric Sandeen wrote:Only when extending the file size.Actually; after the truncate down step (3) we should have: if ((zero_off + zero_len) > offset)
zero_len = offset - zero_off;The truncate down eventually calls truncate_inode_pages_range() which will zero the remainder of a page beyond eof. This could be how block 1 is becoming dirty. If I remember correctly there are checks in fsx to ensure that when mmaping a file with a file size that is not page aligned that the space in the last page beyond eof is all zeroes (a POSIX requirement I think but only holds true on initial mapping since the area can be modified by a user). This has to be done somewhere and may well be in the truncate down.
Yes, true since the new file size (513 bytes) is not fsb aligned then the first byte in block 1 needs to be zeroed. But this will only happen if block 1 is allocated. If it's a hole or an unwritten extent then it will be skipped.
It mixes direct I/O with a mmap'ed reads. 1000 mapread 0x3800 thru 0x609c (0x289d bytes) 2000 mapread 0x7600 thru 0x16d0e (0xf70f bytes) READ BAD DATA: offset = 0x9a00, size = 0xa600, fname = file OFFSET GOOD BAD RANGE 0x aa00 0x0000 0x43fb 0x 0 operation# (mod 256) for the bad data may be 67 ... 2126(78 mod 256): SKIPPED (no operation) 2127(79 mod 256): TRUNCATE UP from 0xc580 to 0x26629 2128(80 mod 256): WRITE 0x2bc00 thru 0x35fff (0xa400 bytes) HOLE 2129(81 mod 256): TRUNCATE DOWN from 0x36000 to 0x231be 2130(82 mod 256): MAPREAD 0x9e00 thru 0xd6f6 (0x38f7 bytes) ***RRRR*** 2131(83 mod 256): READ 0x9a00 thru 0x13fff (0xa600 bytes) ***RRRR*** Correct content saved for comparison (maybe hexdump "file" vs "file.fsxgood") At operation 2130 the data at offset 0xaa00 is okay but on the next operation the data at that offset is now bad. Your patch stops this failure but frankly I don't know why. Zeroing to the end of the page in xfs_zero_last_block() also prevents the failure but now I'm not so sure that makes sense. The '-f' option to fsx (if you're using the fsx from the XFSQA suite) is supposed to flush and invalidate pages after write operations and force them to be read in from disk. This is very handy to find bugs in the read path that would otherwise be disguised by the page cache. But it looks like msync(MS_INVALIDATE) doesn't work anymore - I'm not seeing any reads, weird. |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH] xfs_quota: Don't ignore every error when asking for quota., Arkadiusz Miskiewicz |
|---|---|
| Next by Date: | Re: 12x performance drop on md/linux+sw raid1 due to barriers [xfs], Martin Steigerwald |
| Previous by Thread: | Re: [PATCH] fix corruption case for block size < page size, Eric Sandeen |
| Next by Thread: | Your Company's Web Site Design, Sean Wong |
| Indexes: | [Date] [Thread] [Top] [All Lists] |