On 04/13/2014 10:44 PM, Qu Wenruo wrote:
When testing fsstress with snapshot making background, some snapshot
following problem.

Snapshot 270:
inode 323: size 0

Snapshot 271:
inode 323: size 349145
|-------Hole---|---------Empty gap-------|-------Hole-----|
0           122880                      172032        349145

Snapshot 272:
inode 323: size 349145
|-------Hole---|------------Data---------|-------Hole-----|
0           122880                      172032        349145

The fsstress operation on inode 323 is the following:
write:          offset  126832  len 43124
truncate:       size    349145

Since the write with offset is consist of 2 operations:
1. punch hole
2. write data
Hole punching is faster than data write, so hole punching in write
and truncate is done first and then buffered write, so the snapshot 271 got
empty gap, which will not pass btrfsck.

To fix the bug, this patch will change the write sequence which will
first punch a hole covering the write end if a hole is needed.

Reported-by: Gui Hecheng <[email protected]>
Signed-off-by: Qu Wenruo <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
---
changelog:
v2:
   Use 'pos + count' instead of 'pos + iov->iov_len' to deal with
multi-seg iov.

Thanks for the review Al.  Qu, could you please send an incremental?

-chris
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to