On Thu, Apr 23, 2015 at 02:05:48PM +0100, Filipe David Manana wrote: > >> Trying the current integration-4.1 branch, I ran into the following > >> during xfstests/btrfs/049: > >> > > > > Ugh, I must not be waiting correctly in one of the inode cache writeout > > sections. But I've run 049 a whole bunch of times without triggering, > > can you get this to happen consistently? > > All the time so far.
I'm testing with this now: commit 9f433238891b1b243c4f19d3f36eed913b270cbc Author: Chris Mason <c...@fb.com> Date: Thu Apr 23 08:02:49 2015 -0700 Btrfs: fix inode cache writeout The code to fix stalls during free spache cache IO wasn't using the correct root when waiting on the IO for inode caches. This is only a problem when the inode cache is enabled with mount -o inode_cache This fixes the inode cache writeout to preserve any error values and makes sure not to override the root when inode cache writeout is done. Reported-by: Filipe Manana <fdman...@suse.com> Signed-off-by: Chris Mason <c...@fb.com> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 5a4f5d1..8cd797f 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -1149,7 +1149,8 @@ int btrfs_wait_cache_io(struct btrfs_root *root, if (!inode) return 0; - root = root->fs_info->tree_root; + if (block_group) + root = root->fs_info->tree_root; /* Flush the dirty pages in the cache file. */ ret = flush_dirty_cache(inode); @@ -3465,9 +3466,12 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root, if (!btrfs_test_opt(root, INODE_MAP_CACHE)) return 0; + memset(&io_ctl, 0, sizeof(io_ctl)); ret = __btrfs_write_out_cache(root, inode, ctl, NULL, &io_ctl, - trans, path, 0) || - btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); + trans, path, 0); + if (!ret) + ret = btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); + if (ret) { btrfs_delalloc_release_metadata(inode, inode->i_size); #ifdef DEBUG -- 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