|
@@ -609,7 +609,6 @@ int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid)
|
|
|
if (transid <= root->fs_info->last_trans_committed)
|
|
if (transid <= root->fs_info->last_trans_committed)
|
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
|
|
- ret = -EINVAL;
|
|
|
|
|
/* find specified transaction */
|
|
/* find specified transaction */
|
|
|
spin_lock(&root->fs_info->trans_lock);
|
|
spin_lock(&root->fs_info->trans_lock);
|
|
|
list_for_each_entry(t, &root->fs_info->trans_list, list) {
|
|
list_for_each_entry(t, &root->fs_info->trans_list, list) {
|
|
@@ -625,9 +624,16 @@ int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
spin_unlock(&root->fs_info->trans_lock);
|
|
spin_unlock(&root->fs_info->trans_lock);
|
|
|
- /* The specified transaction doesn't exist */
|
|
|
|
|
- if (!cur_trans)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * The specified transaction doesn't exist, or we
|
|
|
|
|
+ * raced with btrfs_commit_transaction
|
|
|
|
|
+ */
|
|
|
|
|
+ if (!cur_trans) {
|
|
|
|
|
+ if (transid > root->fs_info->last_trans_committed)
|
|
|
|
|
+ ret = -EINVAL;
|
|
|
goto out;
|
|
goto out;
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
/* find newest transaction that is committing | committed */
|
|
/* find newest transaction that is committing | committed */
|
|
|
spin_lock(&root->fs_info->trans_lock);
|
|
spin_lock(&root->fs_info->trans_lock);
|