Skip to content

Commit

Permalink
Btrfs: check the return value of filemap_write_and_wait in the space …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Josef Bacik committed Oct 19, 2011
1 parent a67509c commit 549b4fd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/btrfs/free-space-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,9 +852,10 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
if (ret)
goto out;

BTRFS_I(inode)->generation = trans->transid;

filemap_write_and_wait(inode->i_mapping);
ret = filemap_write_and_wait(inode->i_mapping);
if (ret)
goto out;

key.objectid = BTRFS_FREE_SPACE_OBJECTID;
key.offset = offset;
Expand Down Expand Up @@ -884,6 +885,8 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
goto out;
}
}

BTRFS_I(inode)->generation = trans->transid;
header = btrfs_item_ptr(leaf, path->slots[0],
struct btrfs_free_space_header);
btrfs_set_free_space_entries(leaf, header, entries);
Expand Down

0 comments on commit 549b4fd

Please sign in to comment.