On Mon, Apr 08, 2013 at 02:49:18PM +0200, David Sterba wrote: > On Sun, Apr 07, 2013 at 10:18:18PM +0800, Liu Bo wrote: > > We did not allow file data clone within the same file because of > > deadlock issues. > > > > However, we now use nested lock to avoid deadlock between the > > parent directory and the child file. > > > > So it's safe to do file clone at different offset within the > > same file. > > There's a todo comment inside the function saying that cloning within > the same file is possible but with an exception of overlapping ranges. > How does your patch prevent that? With current code + your patch it's > possible to call > > 2583 /* truncate page cache pages from target inode range */ > 2584 truncate_inode_pages_range(&inode->i_data, destoff, > 2585 PAGE_CACHE_ALIGN(destoff + len) - 1); > > where [destoff, destoff+len) intersects with the source [off, off+len) > thus destroying the data to be cloned. > > david Yeah, that's right, I missed this, what about another sanity check for overlapping ranges, of course in the case of the same file? thanks, liubo -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
