aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/send.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r--fs/btrfs/send.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index f7fe4770f0e5..69b59bf75882 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -686,7 +686,7 @@ static int send_cmd(struct send_ctx *sctx)
686 hdr->len = cpu_to_le32(sctx->send_size - sizeof(*hdr)); 686 hdr->len = cpu_to_le32(sctx->send_size - sizeof(*hdr));
687 hdr->crc = 0; 687 hdr->crc = 0;
688 688
689 crc = crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size); 689 crc = btrfs_crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size);
690 hdr->crc = cpu_to_le32(crc); 690 hdr->crc = cpu_to_le32(crc);
691 691
692 ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size, 692 ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size,
@@ -6929,9 +6929,23 @@ long btrfs_ioctl_send(struct file *mnt_file, struct btrfs_ioctl_send_args *arg)
6929 if (ret) 6929 if (ret)
6930 goto out; 6930 goto out;
6931 6931
6932 mutex_lock(&fs_info->balance_mutex);
6933 if (test_bit(BTRFS_FS_BALANCE_RUNNING, &fs_info->flags)) {
6934 mutex_unlock(&fs_info->balance_mutex);
6935 btrfs_warn_rl(fs_info,
6936 "cannot run send because a balance operation is in progress");
6937 ret = -EAGAIN;
6938 goto out;
6939 }
6940 fs_info->send_in_progress++;
6941 mutex_unlock(&fs_info->balance_mutex);
6942
6932 current->journal_info = BTRFS_SEND_TRANS_STUB; 6943 current->journal_info = BTRFS_SEND_TRANS_STUB;
6933 ret = send_subvol(sctx); 6944 ret = send_subvol(sctx);
6934 current->journal_info = NULL; 6945 current->journal_info = NULL;
6946 mutex_lock(&fs_info->balance_mutex);
6947 fs_info->send_in_progress--;
6948 mutex_unlock(&fs_info->balance_mutex);
6935 if (ret < 0) 6949 if (ret < 0)
6936 goto out; 6950 goto out;
6937 6951