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

All further snapshots are aborted after the --pre-snapshot= command fails once. #81

Open
ackzsel opened this issue Jan 7, 2018 · 1 comment

Comments

@ackzsel
Copy link

ackzsel commented Jan 7, 2018

Summary
When taking snapshots of multiple datasets using a command with --pre-snapshot= to decide whether to proceed or not, all snapshots are aborted after the first time the command returns non-zero. If the command returns zero for a following dataset the snapshot is still aborted. According to the man-page the snapshot is aborted for -this- dataset.

How to reproduce
Abort any dataset that isn't the last in sequence by returning non-zero from a command specified with --pre-snapshot=.

Expected behavior
Snapshot of dataset is aborted. Datasets following the aborted snapshot are only aborted when the command returns non-zero.

Observed behavior
All further snapshots of dataset are aborted irrespective of command return value.

P.S: RUNSNAP is declared and set to 1 on line 155. RUNSNAP is set to 0 when do_run fails on line 168 and is never set again for the next iterations of the loop. My personal fix was to change line 168 from:
do_run "$opt_pre_snapshot $ii $NAME" || RUNSNAP=0
to:
do_run "$opt_pre_snapshot $ii $NAME" && RUNSNAP=1 || RUNSNAP=0

mateusz-kolecki added a commit to mateusz-kolecki/zfs-auto-snapshot that referenced this issue Nov 20, 2021
@mateusz-kolecki
Copy link

mateusz-kolecki commented Nov 20, 2021

Hi, I just created a really small PR to fix this issue. It is just a change that was proposed in the issue description by @ackzsel
#123

daniel-ayers added a commit to daniel-ayers/zfs-auto-snapshot that referenced this issue Jun 7, 2022
…lti-targets

Fix zfsonlinux#81 - further snapshots were aborted after the pre-snapshot comma…
GrayXu added a commit to GrayXu/zfs-auto-snapshot that referenced this issue Mar 20, 2023
…lti-targets

Fix zfsonlinux#81 - further snapshots were aborted after the pre-snapshot comma…
Guiorgy pushed a commit to Guiorgy/zfs-auto-snapshot that referenced this issue Aug 23, 2024
Guiorgy pushed a commit to Guiorgy/zfs-auto-snapshot that referenced this issue Aug 24, 2024
Guiorgy pushed a commit to Guiorgy/zfs-auto-snapshot that referenced this issue Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants