diff options
author | Josef Bacik <jbacik@fusionio.com> | 2013-01-31 14:30:08 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-02-20 12:59:28 -0500 |
commit | 779880ef35b60ac82eed1dcaec6db5b34a170df8 (patch) | |
tree | 715770c70ccbfa1e2352c6cd2f4cddee50eca596 | |
parent | eb12db690c7eb0f6593ba5792f5861409e88bc03 (diff) |
Btrfs: fix how we discard outstanding ordered extents on abort
When we abort we've been just free'ing up all the ordered extents and
hoping for the best. This results in lots of warnings from various places,
warnings from btrfs_destroy_inode() because it's ENOSPC accounting isn't
fixed. It will also screw up lots of pages who have been set private but
never get cleared because the ordered extents are never allowed to be
submitted. This patch fixes those warnings. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
-rw-r--r-- | fs/btrfs/disk-io.c | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8140cb01951f..259d7891d10c 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -3565,35 +3565,16 @@ static void btrfs_destroy_ordered_operations(struct btrfs_root *root) | |||
3565 | 3565 | ||
3566 | static void btrfs_destroy_ordered_extents(struct btrfs_root *root) | 3566 | static void btrfs_destroy_ordered_extents(struct btrfs_root *root) |
3567 | { | 3567 | { |
3568 | struct list_head splice; | ||
3569 | struct btrfs_ordered_extent *ordered; | 3568 | struct btrfs_ordered_extent *ordered; |
3570 | struct inode *inode; | ||
3571 | |||
3572 | INIT_LIST_HEAD(&splice); | ||
3573 | 3569 | ||
3574 | spin_lock(&root->fs_info->ordered_extent_lock); | 3570 | spin_lock(&root->fs_info->ordered_extent_lock); |
3575 | 3571 | /* | |
3576 | list_splice_init(&root->fs_info->ordered_extents, &splice); | 3572 | * This will just short circuit the ordered completion stuff which will |
3577 | while (!list_empty(&splice)) { | 3573 | * make sure the ordered extent gets properly cleaned up. |
3578 | ordered = list_entry(splice.next, struct btrfs_ordered_extent, | 3574 | */ |
3579 | root_extent_list); | 3575 | list_for_each_entry(ordered, &root->fs_info->ordered_extents, |
3580 | 3576 | root_extent_list) | |
3581 | list_del_init(&ordered->root_extent_list); | 3577 | set_bit(BTRFS_ORDERED_IOERR, &ordered->flags); |
3582 | atomic_inc(&ordered->refs); | ||
3583 | |||
3584 | /* the inode may be getting freed (in sys_unlink path). */ | ||
3585 | inode = igrab(ordered->inode); | ||
3586 | |||
3587 | spin_unlock(&root->fs_info->ordered_extent_lock); | ||
3588 | if (inode) | ||
3589 | iput(inode); | ||
3590 | |||
3591 | atomic_set(&ordered->refs, 1); | ||
3592 | btrfs_put_ordered_extent(ordered); | ||
3593 | |||
3594 | spin_lock(&root->fs_info->ordered_extent_lock); | ||
3595 | } | ||
3596 | |||
3597 | spin_unlock(&root->fs_info->ordered_extent_lock); | 3578 | spin_unlock(&root->fs_info->ordered_extent_lock); |
3598 | } | 3579 | } |
3599 | 3580 | ||