diff mbox series

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

Message ID 3035988eb320d8582006bbbfa0e872c0c4532889.1563822638.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 July 22, 2019, 7:15 p.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

David Sterba July 24, 2019, 11:22 a.m. UTC | #1
On Mon, Jul 22, 2019 at 12:15:02PM -0700, Omar Sandoval 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.
> 
> 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 b97850a7..830ed082 100644
> --- a/cmds/receive.c
> +++ b/cmds/receive.c
> @@ -344,15 +344,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) {

This looks like a (missing) sanity check, don't we want it?
Filipe Manana July 24, 2019, 12:10 p.m. UTC | #2
On Wed, Jul 24, 2019 at 12:23 PM David Sterba <dsterba@suse.cz> wrote:
>
> On Mon, Jul 22, 2019 at 12:15:02PM -0700, Omar Sandoval 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.
> >
> > 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 b97850a7..830ed082 100644
> > --- a/cmds/receive.c
> > +++ b/cmds/receive.c
> > @@ -344,15 +344,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) {
>
> This looks like a (missing) sanity check, don't we want it?

Un-commenting that will cause receive to fail if we deduplicate into
readonly subvolumes and snaphosts and then use them for send
operations, breaking existing use cases.
diff mbox series

Patch

diff --git a/cmds/receive.c b/cmds/receive.c
index b97850a7..830ed082 100644
--- a/cmds/receive.c
+++ b/cmds/receive.c
@@ -344,15 +344,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);
@@ -770,22 +761,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);