diff mbox series

[RESEND,v2,1/3] btrfs-progs: receive: remove commented out transid checks

Message ID ba4cd47585197cb490afbd5ad22725adfd909381.1583914311.git.osandov@fb.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: fix clone from wrong subvolume | expand

Commit Message

Omar Sandoval March 11, 2020, 8:17 a.m. UTC
From: Omar Sandoval <osandov@fb.com>

The checks for a subvolume being modified after it was received have
been commented out since they were added back in commit f1c24cd80dfd
("Btrfs-progs: add btrfs send/receive commands"). Let's just get rid of
the noise.

Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 cmds/receive.c | 25 -------------------------
 1 file changed, 25 deletions(-)

Comments

Filipe Manana March 11, 2020, 3:50 p.m. UTC | #1
On Wed, Mar 11, 2020 at 8:17 AM Omar Sandoval <osandov@osandov.com> wrote:
>
> From: Omar Sandoval <osandov@fb.com>
>
> The checks for a subvolume being modified after it was received have
> been commented out since they were added back in commit f1c24cd80dfd
> ("Btrfs-progs: add btrfs send/receive commands"). Let's just get rid of
> the noise.

Indeed. If they were ever in place, it would have never been possible
to do an incremental send and running dedupe against the parent
snapshot.
That particular use case used to cause send, the kernel side, to fail
(initially with a BUG_ON() and later with -EIO returned to user
space):

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b4f9a1a87a48c255bb90d8a6c3d555a1abb88130

If this code in btrfs-progs was not commented, it would have been
easier to find that problem.

Reviewed-by: Filipe Manana <fdmanana@suse.com>

Thanks.



>
> Signed-off-by: Omar Sandoval <osandov@fb.com>
> ---
>  cmds/receive.c | 25 -------------------------
>  1 file changed, 25 deletions(-)
>
> diff --git a/cmds/receive.c b/cmds/receive.c
> index c4827c1d..a4bf8787 100644
> --- a/cmds/receive.c
> +++ b/cmds/receive.c
> @@ -345,15 +345,6 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid,
>                         parent_subvol->path[sub_len - root_len - 1] = '\0';
>                 }
>         }
> -       /*if (rs_args.ctransid > rs_args.rtransid) {
> -               if (!r->force) {
> -                       ret = -EINVAL;
> -                       fprintf(stderr, "ERROR: subvolume %s was modified after it was received.\n", r->subvol_parent_name);
> -                       goto out;
> -               } else {
> -                       fprintf(stderr, "WARNING: subvolume %s was modified after it was received.\n", r->subvol_parent_name);
> -               }
> -       }*/
>
>         if (*parent_subvol->path == 0)
>                 args_v2.fd = dup(rctx->mnt_fd);
> @@ -771,22 +762,6 @@ static int process_clone(const char *path, u64 offset, u64 len,
>                         goto out;
>                 }
>         } else {
> -               /*if (rs_args.ctransid > rs_args.rtransid) {
> -                       if (!r->force) {
> -                               ret = -EINVAL;
> -                               fprintf(stderr, "ERROR: subvolume %s was "
> -                                               "modified after it was "
> -                                               "received.\n",
> -                                               r->subvol_parent_name);
> -                               goto out;
> -                       } else {
> -                               fprintf(stderr, "WARNING: subvolume %s was "
> -                                               "modified after it was "
> -                                               "received.\n",
> -                                               r->subvol_parent_name);
> -                       }
> -               }*/
> -
>                 /* strip the subvolume that we are receiving to from the start of subvol_path */
>                 if (rctx->full_root_path) {
>                         size_t root_len = strlen(rctx->full_root_path);
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/cmds/receive.c b/cmds/receive.c
index c4827c1d..a4bf8787 100644
--- a/cmds/receive.c
+++ b/cmds/receive.c
@@ -345,15 +345,6 @@  static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid,
 			parent_subvol->path[sub_len - root_len - 1] = '\0';
 		}
 	}
-	/*if (rs_args.ctransid > rs_args.rtransid) {
-		if (!r->force) {
-			ret = -EINVAL;
-			fprintf(stderr, "ERROR: subvolume %s was modified after it was received.\n", r->subvol_parent_name);
-			goto out;
-		} else {
-			fprintf(stderr, "WARNING: subvolume %s was modified after it was received.\n", r->subvol_parent_name);
-		}
-	}*/
 
 	if (*parent_subvol->path == 0)
 		args_v2.fd = dup(rctx->mnt_fd);
@@ -771,22 +762,6 @@  static int process_clone(const char *path, u64 offset, u64 len,
 			goto out;
 		}
 	} else {
-		/*if (rs_args.ctransid > rs_args.rtransid) {
-			if (!r->force) {
-				ret = -EINVAL;
-				fprintf(stderr, "ERROR: subvolume %s was "
-						"modified after it was "
-						"received.\n",
-						r->subvol_parent_name);
-				goto out;
-			} else {
-				fprintf(stderr, "WARNING: subvolume %s was "
-						"modified after it was "
-						"received.\n",
-						r->subvol_parent_name);
-			}
-		}*/
-
 		/* strip the subvolume that we are receiving to from the start of subvol_path */
 		if (rctx->full_root_path) {
 			size_t root_len = strlen(rctx->full_root_path);