summaryrefslogtreecommitdiff
path: root/fs/btrfs/free-space-cache.c
diff options
context:
space:
mode:
authorChris Mason <clm@fb.com>2015-04-23 18:02:49 +0300
committerChris Mason <clm@fb.com>2015-04-24 03:47:34 +0300
commit85db36cfb3de1422aeafb4e2ce83396333b744bb (patch)
treeb78e13e2f33cd34fc862f81e9a23e178a242dffa /fs/btrfs/free-space-cache.c
parente082f56313f374d723b0366978ddb062c8fe79ea (diff)
downloadlinux-85db36cfb3de1422aeafb4e2ce83396333b744bb.tar.xz
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 <fdmanana@suse.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r--fs/btrfs/free-space-cache.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 253cb74b0e27..d773f229d14d 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);
@@ -3463,9 +3464,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