From: Eric Bollengier Date: Thu, 19 May 2022 15:18:22 +0000 (+0200) Subject: snapshot: Adapt for BTRFS 5.17 X-Git-Tag: Release-13.0.0~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea8ecf1f7cb8f082583ecb447f72662370b835d4;p=thirdparty%2Fbacula.git snapshot: Adapt for BTRFS 5.17 --- diff --git a/bacula/src/tools/bsnapshot.c b/bacula/src/tools/bsnapshot.c index 8c7a62e87..d618d60dc 100644 --- a/bacula/src/tools/bsnapshot.c +++ b/bacula/src/tools/bsnapshot.c @@ -1109,9 +1109,38 @@ public: printf("status=0 type=btrfs error=\"%s\"\n", errmsg); return 0; } - +/* + * [eric@zog8 /tmp/regress]$ sudo btrfs sub show /tmp/regress/btrfs/ + * / + * Name: + * UUID: 7b715434-bb3c-44ce-abcb-803e6bfcf78a + * Parent UUID: - + * Received UUID: - + * Creation time: 2022-05-18 09:43:15 +0200 + * Subvolume ID: 5 + * Generation: 82 + * Gen at creation: 0 + * Parent ID: 0 + * Top level ID: 0 + * Flags: - + * Send transid: 0 + * Send time: 2022-05-18 09:43:15 +0200 + * Receive transid: 0 + * Receive time: - + * Snapshot(s): + */ /* TODO: Very week way to analyse FS */ - if (!strstr(errmsg, "is btrfs root")) { + char *p = strstr(errmsg, "Parent ID:"); + if (p) { + p += strlen("Parent ID:"); + skip_spaces(&p); + if (*p != '0') { + Dmsg(10, "%s Not btrfs root (Parent ID > 0)\n", arg->mountpoint); + printf("status=0 type=btrfs error=\"Not btrfs root fs\"\n"); + return 0; + } + } else if (!strstr(errmsg, "is btrfs root")) { + Dmsg(10, "%s Not btrfs root\n", arg->mountpoint); printf("status=0 type=btrfs error=\"Not btrfs root fs\"\n"); return 0; }