aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-10-05 16:33:53 -0400
committerJosef Bacik <josef@redhat.com>2011-10-19 15:12:53 -0400
commit549b4fdb8f3c0708bbc0ee12ff955cd206c0f60c (patch)
tree8ee21d81f99dd2efd801c59c1d5eaf800f6b0ec0 /fs/btrfs
parenta67509c30079f4c5025fb19ea443fb2906c3a85e (diff)
Btrfs: check the return value of filemap_write_and_wait in the space cache
We need to check the return value of filemap_write_and_wait in the space cache writeout code. Also don't set the inode's generation until we're sure nothing else is going to fail. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/free-space-cache.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 35bfc13c9d42..abc924c9467c 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -852,9 +852,10 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
852 if (ret) 852 if (ret)
853 goto out; 853 goto out;
854 854
855 BTRFS_I(inode)->generation = trans->transid;
856 855
857 filemap_write_and_wait(inode->i_mapping); 856 ret = filemap_write_and_wait(inode->i_mapping);
857 if (ret)
858 goto out;
858 859
859 key.objectid = BTRFS_FREE_SPACE_OBJECTID; 860 key.objectid = BTRFS_FREE_SPACE_OBJECTID;
860 key.offset = offset; 861 key.offset = offset;
@@ -884,6 +885,8 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
884 goto out; 885 goto out;
885 } 886 }
886 } 887 }
888
889 BTRFS_I(inode)->generation = trans->transid;
887 header = btrfs_item_ptr(leaf, path->slots[0], 890 header = btrfs_item_ptr(leaf, path->slots[0],
888 struct btrfs_free_space_header); 891 struct btrfs_free_space_header);
889 btrfs_set_free_space_entries(leaf, header, entries); 892 btrfs_set_free_space_entries(leaf, header, entries);