| .. | .. |
|---|
| 301 | 301 | spin_unlock(&fs_info->trans_lock); |
|---|
| 302 | 302 | |
|---|
| 303 | 303 | /* |
|---|
| 304 | | - * If we are ATTACH, we just want to catch the current transaction, |
|---|
| 305 | | - * and commit it. If there is no transaction, just return ENOENT. |
|---|
| 304 | + * If we are ATTACH or TRANS_JOIN_NOSTART, we just want to catch the |
|---|
| 305 | + * current transaction, and commit it. If there is no transaction, just |
|---|
| 306 | + * return ENOENT. |
|---|
| 306 | 307 | */ |
|---|
| 307 | | - if (type == TRANS_ATTACH) |
|---|
| 308 | + if (type == TRANS_ATTACH || type == TRANS_JOIN_NOSTART) |
|---|
| 308 | 309 | return -ENOENT; |
|---|
| 309 | 310 | |
|---|
| 310 | 311 | /* |
|---|
| .. | .. |
|---|
| 821 | 822 | |
|---|
| 822 | 823 | trans = start_transaction(root, 0, TRANS_ATTACH, |
|---|
| 823 | 824 | BTRFS_RESERVE_NO_FLUSH, true); |
|---|
| 824 | | - if (trans == ERR_PTR(-ENOENT)) |
|---|
| 825 | | - btrfs_wait_for_commit(root->fs_info, 0); |
|---|
| 825 | + if (trans == ERR_PTR(-ENOENT)) { |
|---|
| 826 | + int ret; |
|---|
| 827 | + |
|---|
| 828 | + ret = btrfs_wait_for_commit(root->fs_info, 0); |
|---|
| 829 | + if (ret) |
|---|
| 830 | + return ERR_PTR(ret); |
|---|
| 831 | + } |
|---|
| 826 | 832 | |
|---|
| 827 | 833 | return trans; |
|---|
| 828 | 834 | } |
|---|
| .. | .. |
|---|
| 886 | 892 | } |
|---|
| 887 | 893 | |
|---|
| 888 | 894 | wait_for_commit(cur_trans); |
|---|
| 895 | + ret = cur_trans->aborted; |
|---|
| 889 | 896 | btrfs_put_transaction(cur_trans); |
|---|
| 890 | 897 | out: |
|---|
| 891 | 898 | return ret; |
|---|