diff options
| -rw-r--r-- | fs/btrfs/volumes.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index f1ecb938ba4d..84d37b4ab230 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -1750,20 +1750,24 @@ static int btrfs_rm_dev_item(struct btrfs_fs_info *fs_info, | |||
| 1750 | key.offset = device->devid; | 1750 | key.offset = device->devid; |
| 1751 | 1751 | ||
| 1752 | ret = btrfs_search_slot(trans, root, &key, path, -1, 1); | 1752 | ret = btrfs_search_slot(trans, root, &key, path, -1, 1); |
| 1753 | if (ret < 0) | 1753 | if (ret) { |
| 1754 | goto out; | 1754 | if (ret > 0) |
| 1755 | 1755 | ret = -ENOENT; | |
| 1756 | if (ret > 0) { | 1756 | btrfs_abort_transaction(trans, ret); |
| 1757 | ret = -ENOENT; | 1757 | btrfs_end_transaction(trans); |
| 1758 | goto out; | 1758 | goto out; |
| 1759 | } | 1759 | } |
| 1760 | 1760 | ||
| 1761 | ret = btrfs_del_item(trans, root, path); | 1761 | ret = btrfs_del_item(trans, root, path); |
| 1762 | if (ret) | 1762 | if (ret) { |
| 1763 | goto out; | 1763 | btrfs_abort_transaction(trans, ret); |
| 1764 | btrfs_end_transaction(trans); | ||
| 1765 | } | ||
| 1766 | |||
| 1764 | out: | 1767 | out: |
| 1765 | btrfs_free_path(path); | 1768 | btrfs_free_path(path); |
| 1766 | btrfs_commit_transaction(trans); | 1769 | if (!ret) |
| 1770 | ret = btrfs_commit_transaction(trans); | ||
| 1767 | return ret; | 1771 | return ret; |
| 1768 | } | 1772 | } |
| 1769 | 1773 | ||
