At 09/20/2016 11:39 AM, Sean Greenslade wrote:
On Tue, Sep 20, 2016 at 10:49:42AM +0800, Qu Wenruo wrote:
OK, I see the problem now.

The new convert is designed to create minimal number of extents, so it
result the following file extents layout:

Ext2_save/image
        |
/-------------------------------\
|           Extent A             |
|<---Old Ext3 Used space  ------>|<--- Free space--->|
      \---/\---/\---/
        |    |    |
       F1    F2   F3

This causes a large extent A, refered by ext2_save/image, and files like
F1/2/3 just refer to part of the large extent A.

After removing the whole ext2_save subvolume, Extent A is still there, since
F1/2/3 are still referring it.

|<---Old Ext3 Used space  ------>|<--- Free space--->|
|           Extent A             |
      \---/\---/\---/
        |    |    |
       F1    F2   F3



In that case, not balance but defrag is responsible to "split" the large
extent and free the unused space.

However btrfs defrag doesn't work for case like subvolume or reflink for a
long time, which leaves the extent layout unchanged.
And balance doesn't handle it, as balance just relocated the large extent A
and modify all referencers' pointer.

Sigh, I just forgot the fact that defrag doesn't work for a long time when
designing the new convert.

So, we still need a working kernel defrag to make the fs to  be a "native"
btrfs.


However, such layout is completely valid for btrfs, one can generate it
quite easily which following script:
----
xfs_io -f -c "pwrite 0 16M" $mnt/orig
for i in $(seq 0 15); do
        xfs_io -f -c "reflink $mnt/orig ${i}M 0 1M" $mnt/file${i}
done
----

So there is still something wrong in your backtrace so that we need to dig
further.

Any idea of your load pattern to trigger the bug?

Glad to hear you've found the core of the issue.

At this point, I can trigger it immediately. As soon as I log in and run
dmenu, it will attempt to rebuild its cache file (small text file that's
just a list of all executables in the PATH). Once that write happens,
the bug triggers and the fs goes read only.

Rewrite? Or write into new inode?

And is the same inode always causing the problem?

Thanks,
Qu


--Sean





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

Reply via email to