Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zfs send -R -I "helpfully" doesn't error on being given a nonexistent snapshot #12574

Closed
rincebrain opened this issue Sep 18, 2021 · 0 comments
Closed
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@rincebrain
Copy link
Contributor

rincebrain commented Sep 18, 2021

System information

Type Version/Name
Distribution Name Debian
Distribution Version 11
Kernel Version 5.10.0-8-amd64
Architecture x86_64
OpenZFS Version 2.0.3 / 2a49ebb

Describe the problem you're observing

I was rather confused on 2.0.3 when I tried doing zfs send -R -I mydataset@2021-08-14 mydataset@2021-09-17 | ... | zfs recv somewhere and it spat up "cannot receive new filesystem stream: destination 'somewhere' exists".

On further debugging, mydataset@2021-08-14 had been destroyed, and zfs send -R -I was helpfully generating a send stream of every snapshot on the filesystem, but with a fromsnap of a non-present snapshot inside, which seems to result in a send stream you cannot receive to a new location (because it's got fromsnap) or the existing location without destroying everything.

This doesn't seem to be documented, so I could just go cut a man page update, but it seems surprising enough that I'd argue it's not really desired behavior.

Describe how to reproduce the problem

root@debrepro:~# for i in `seq 1 7`;do dd if=/dev/urandom of=/mypool/$i bs=1M count=64 && zfs snapshot mypool@snap$i;done;
64+0 records in
64+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 2.22001 s, 30.2 MB/s
64+0 records in
64+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 3.00796 s, 22.3 MB/s
64+0 records in
64+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 2.85519 s, 23.5 MB/s
64+0 records in
64+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 2.86249 s, 23.4 MB/s
64+0 records in
64+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 2.59387 s, 25.9 MB/s
64+0 records in
64+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 2.921 s, 23.0 MB/s
64+0 records in
64+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 2.65469 s, 25.3 MB/s
root@debrepro:~# zfs list -t all -r mypool
NAME           USED  AVAIL     REFER  MOUNTPOINT
mypool         449M   383M      448M  /mypool
mypool@snap1    13K      -     64.1M  -
mypool@snap2    13K      -      128M  -
mypool@snap3    13K      -      192M  -
mypool@snap4    13K      -      256M  -
mypool@snap5    13K      -      320M  -
mypool@snap6    13K      -      384M  -
mypool@snap7     0B      -      448M  -
root@debrepro:~# zfs send -I mypool@nonsense mypool@snap5 > /tmp/whateven3
WARNING: could not send mypool@snap5:
incremental source (mypool@nonsense) does not exist
root@debrepro:~# zfs send -R -I mypool@nonsense mypool@snap5 > /tmp/whateven
root@debrepro:~# zfs send -R mypool@snap5 > /tmp/whateven2
root@debrepro:~# zstreamdump -vv < /tmp/whateven | grep -v checksum > /tmp/1
root@debrepro:~# zstreamdump -vv < /tmp/whateven2 | grep -v checksum > /tmp/2
root@debrepro:~# diff -urN /tmp/[12]
--- /tmp/1      2021-09-18 14:44:10.995540871 -0400
+++ /tmp/2      2021-09-18 14:44:14.843475467 -0400
@@ -8,10 +8,9 @@
        toguid = 0
        fromguid = 0
        toname = mypool@snap5
-       payloadlen = 812
+       payloadlen = 772

 nvlist version: 0
-       fromsnap = nonsense
        tosnap = snap5
        fss = (embedded nvlist)
        nvlist version: 0
@@ -220,7 +219,7 @@
 FREE object = 512 offset = 67108864 length = -1
 FREEOBJECTS firstobj = 513 numobjs = 31
 SUMMARY:
-       Total DRR_BEGIN records = 6 (812 bytes)
+       Total DRR_BEGIN records = 6 (772 bytes)
        Total DRR_END records = 7 (0 bytes)
        Total DRR_OBJECT records = 31 (1720 bytes)
        Total DRR_FREEOBJECTS records = 16 (0 bytes)
@@ -230,6 +229,6 @@
        Total DRR_FREE records = 52 (0 bytes)
        Total DRR_SPILL records = 0 (0 bytes)
        Total records = 2683
-       Total payload size = 335585252 (0x14009fe4)
+       Total payload size = 335585212 (0x14009fbc)
        Total header overhead = 837096 (0xcc5e8)
-       Total stream length = 336422348 (0x140d65cc)
+       Total stream length = 336422308 (0x140d65a4)
root@debrepro:~#

Include any warning/errors/backtraces from the system logs

Above.

@rincebrain rincebrain added the Type: Defect Incorrect behavior (e.g. crash, hang) label Sep 18, 2021
rincebrain added a commit to rincebrain/zfs that referenced this issue Sep 18, 2021
Right now, zfs send -I dataset@nonexistent dataset@existent fails, but
zfs send -RI dataset@nonexistent dataset@existent does not.

Closes: openzfs#12574

Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
rincebrain added a commit to rincebrain/zfs that referenced this issue Sep 18, 2021
Right now, zfs send -I dataset@nonexistent dataset@existent fails, but
zfs send -RI dataset@nonexistent dataset@existent does not.

Closes: openzfs#12574

Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Jun 7, 2022
Right now, zfs send -I dataset@nonexistent dataset@existent fails, but
zfs send -RI dataset@nonexistent dataset@existent does not.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes openzfs#12574
Closes openzfs#12575
ghost pushed a commit to truenas/zfs that referenced this issue Jun 27, 2022
Right now, zfs send -I dataset@nonexistent dataset@existent fails, but
zfs send -RI dataset@nonexistent dataset@existent does not.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes openzfs#12574
Closes openzfs#12575
ghost pushed a commit to truenas/zfs that referenced this issue Jun 29, 2022
Right now, zfs send -I dataset@nonexistent dataset@existent fails, but
zfs send -RI dataset@nonexistent dataset@existent does not.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes openzfs#12574
Closes openzfs#12575
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

1 participant