diff options
-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 | ||