linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Warn when skipping snapshots created with older kernels.
@ 2012-09-04 16:40 Gabriel de Perthuis
  2012-09-05  4:22 ` Jan Schmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel de Perthuis @ 2012-09-04 16:40 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Gabriel de Perthuis

This message is more explicit than "ERROR: could not resolve root_id",
the message that will be shown immediately before `btrfs send` bails.

Also skip invalid high OIDs.

Signed-off-by: Gabriel de Perthuis <g2p.code+btrfs@gmail.com>
---
 send-utils.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/send-utils.c b/send-utils.c
index a43d47e..386aeb3 100644
--- a/send-utils.c
+++ b/send-utils.c
@@ -224,6 +224,7 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)
 
 			if ((sh->objectid != 5 &&
 			    sh->objectid < BTRFS_FIRST_FREE_OBJECTID) ||
+			    sh->objectid >= BTRFS_LAST_FREE_OBJECTID ||
 			    sh->objectid == BTRFS_FREE_INO_OBJECTID)
 				goto skip;
 
@@ -231,6 +232,11 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)
 				/* older kernels don't have uuids+times */
 				if (sh->len < sizeof(root_item)) {
 					root_item_valid = 0;
+					fprintf(stderr,
+					        "Ignoring subvolume id %llu, "
+					        "btrfs send needs snapshots "
+					        "created with kernel 3.6+\n",
+					        sh->objectid);
 					goto skip;
 				}
 				root_item_ptr = (struct btrfs_root_item *)
-- 
1.7.12.117.gdc24c27


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Warn when skipping snapshots created with older kernels.
  2012-09-04 16:40 [PATCH] Warn when skipping snapshots created with older kernels Gabriel de Perthuis
@ 2012-09-05  4:22 ` Jan Schmidt
  2012-09-05  7:50   ` [PATCH] warn when skipping snapshots created with older Gabriel de Perthuis
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Schmidt @ 2012-09-05  4:22 UTC (permalink / raw)
  To: Gabriel de Perthuis; +Cc: linux-btrfs

On Tue, September 04, 2012 at 18:40 (+0200), Gabriel de Perthuis wrote:
> This message is more explicit than "ERROR: could not resolve root_id",
> the message that will be shown immediately before `btrfs send` bails.
> 
> Also skip invalid high OIDs.
> 
> Signed-off-by: Gabriel de Perthuis <g2p.code+btrfs@gmail.com>
> ---
>  send-utils.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/send-utils.c b/send-utils.c
> index a43d47e..386aeb3 100644
> --- a/send-utils.c
> +++ b/send-utils.c
> @@ -224,6 +224,7 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)
>  
>  			if ((sh->objectid != 5 &&
>  			    sh->objectid < BTRFS_FIRST_FREE_OBJECTID) ||
> +			    sh->objectid >= BTRFS_LAST_FREE_OBJECTID ||
>  			    sh->objectid == BTRFS_FREE_INO_OBJECTID)
>  				goto skip;

Should be "sh->objectid > BTRFS_LAST_FREE_OBJECTID" (not ">=") and we should
drop the explicit check for BTRFS_FREE_INO_OBJECTID then, because that one is
not between first-free and last-free.

> @@ -231,6 +232,11 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)
>  				/* older kernels don't have uuids+times */
>  				if (sh->len < sizeof(root_item)) {
>  					root_item_valid = 0;
> +					fprintf(stderr,
> +					        "Ignoring subvolume id %llu, "
> +					        "btrfs send needs snapshots "
> +					        "created with kernel 3.6+\n",
> +					        sh->objectid);
>  					goto skip;
>  				}
>  				root_item_ptr = (struct btrfs_root_item *)

Makes sense. Thanks,
-Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] warn when skipping snapshots created with older
  2012-09-05  4:22 ` Jan Schmidt
@ 2012-09-05  7:50   ` Gabriel de Perthuis
  0 siblings, 0 replies; 3+ messages in thread
From: Gabriel de Perthuis @ 2012-09-05  7:50 UTC (permalink / raw)
  To: Jan Schmidt, linux-btrfs; +Cc: Gabriel de Perthuis

Thanks, I fixed the objectid test.
Apply with --scissors.

-- >8 --
Subject: [PATCH] btrfs send: warn when skipping snapshots created with older
 kernels.

This message is more explicit than "ERROR: could not resolve root_id",
the message that will be shown immediately before `btrfs send` bails.

Also skip invalid high OIDs, to prevent spurious warnings.

Signed-off-by: Gabriel de Perthuis <g2p.code+btrfs@gmail.com>
---
 send-utils.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/send-utils.c b/send-utils.c
index a43d47e..03ca72a 100644
--- a/send-utils.c
+++ b/send-utils.c
@@ -224,13 +224,18 @@ int subvol_uuid_search_init(int mnt_fd, struct subvol_uuid_search *s)
 
 			if ((sh->objectid != 5 &&
 			    sh->objectid < BTRFS_FIRST_FREE_OBJECTID) ||
-			    sh->objectid == BTRFS_FREE_INO_OBJECTID)
+			    sh->objectid > BTRFS_LAST_FREE_OBJECTID)
 				goto skip;
 
 			if (sh->type == BTRFS_ROOT_ITEM_KEY) {
 				/* older kernels don't have uuids+times */
 				if (sh->len < sizeof(root_item)) {
 					root_item_valid = 0;
+					fprintf(stderr,
+					        "Ignoring subvolume id %llu, "
+					        "btrfs send needs snapshots "
+					        "created with kernel 3.6+\n",
+					        sh->objectid);
 					goto skip;
 				}
 				root_item_ptr = (struct btrfs_root_item *)
-- 
1.7.12.117.gdc24c27


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-05  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-04 16:40 [PATCH] Warn when skipping snapshots created with older kernels Gabriel de Perthuis
2012-09-05  4:22 ` Jan Schmidt
2012-09-05  7:50   ` [PATCH] warn when skipping snapshots created with older Gabriel de Perthuis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).