Bug 254152

Summary: [zfs] can not boot with option rewind
Product: Base System Reporter: Zhenlei Huang <zlei>
Component: miscAssignee: Mariusz Zaborski <oshogbo>
Status: Closed FIXED    
Severity: Affects Only Me CC: oshogbo, zlei
Priority: --- Keywords: loader, mountroot
Version: 13.0-STABLE   
Hardware: amd64   
OS: Any   

Description Zhenlei Huang freebsd_committer freebsd_triage 2021-03-09 07:41:01 UTC
I'm exploring the new feature introduced by https://reviews.freebsd.org/D24920 , but without success. There're lots of `Solaris: NOTICE: Cannot find the pool label for '!zroot' ` in console log, and the boot end up with `Mounting from zfs:!zroot/ROOT/default failed with error 5. `. Manually input `zfs:zroot/ROOT/default` in the mountroot prompt then it boots successfully but checkpoint of the zfs pool zroot keeps untouched.

Environment:
A Fusion 12.1.0 VM with 4 processor cores and 2G memory, an 4G NVME disk, firmware type BIOS .

Steps to repeat:
1. Fresh install FreeBSD 13.0-RC1
2. Boot and login with root user and make a checkpoint, zpool checkpoint zroot
3. Reboot, and toggle the option `Rewind ZFS Checkpoint` Yes in the bootloader menu
4. Enter to boot, and the boot end up with errors. 

Expected behavior: The boot should succeed and the zfs pool should be rewound upon succeed.
Comment 1 Mariusz Zaborski freebsd_committer freebsd_triage 2021-03-11 17:49:37 UTC
When I was up-streaming the change to OpenZFS somehow, I didn't upstream the whole FreeBSD part. When the merge between the OpenZFS and FreeBSD happened -the code responsible for the parsing rewind option was removed.

This patch should fix your problem: https://github.com/openzfs/zfs/pull/11730
Comment 2 Zhenlei Huang freebsd_committer freebsd_triage 2021-03-12 05:02:56 UTC
Test on latest branch stable/13 with the patch https://github.com/openzfs/zfs/pull/11730, I can confirm that the patch works solidly. Thx :)
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-03-13 12:01:20 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=653ed678c70376b15cdc42daafa7b4554570cea2

commit 653ed678c70376b15cdc42daafa7b4554570cea2
Author:     Mariusz Zaborski <oshogbo@FreeBSD.org>
AuthorDate: 2021-03-13 11:56:17 +0000
Commit:     Mariusz Zaborski <oshogbo@FreeBSD.org>
CommitDate: 2021-03-13 11:56:17 +0000

    zfs: bring back possibility to rewind the checkpoint from

    Add parsing of the rewind options.

    When I was upstreaming the change [1], I omitted the part where we
    detect that the pool should be rewind. When the FreeBSD repo has
    synced with the OpenZFS, this part of the code was removed.

    [1] FreeBSD repo: 277f38abffc6a8160b5044128b5b2c620fbb970c
    [2] OpenZFS repo: f2c027bd6a003ec5793f8716e6189c389c60f47a

    Originally reviewed by:         tsoome, allanjude
    Originally reviewed by:         kevans (ok from high-level overview)

    Signed-off-by: Mariusz Zaborski <oshogbo@vexillium.org>

    PR:             254152
    Reported by:    Zhenlei Huang <zlei.huang at gmail.com>
    Obtained from:  https://github.com/openzfs/zfs/pull/11730

 sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
Comment 4 Zhenlei Huang freebsd_committer freebsd_triage 2021-03-15 05:13:57 UTC
Hi, Mariusz Zaborski,

will the fix be part of FreeBSD 13.0-RELEASE ?

Thanks :)
Comment 5 Mariusz Zaborski freebsd_committer freebsd_triage 2021-03-15 16:18:54 UTC
Yes, I will contact re@ and try to get it to 13.
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-03-18 21:12:31 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6bbca5ca3a6634fc10b93da203df2ae92cf60b61

commit 6bbca5ca3a6634fc10b93da203df2ae92cf60b61
Author:     Mariusz Zaborski <oshogbo@FreeBSD.org>
AuthorDate: 2021-03-13 11:56:17 +0000
Commit:     Mariusz Zaborski <oshogbo@FreeBSD.org>
CommitDate: 2021-03-18 21:10:59 +0000

    zfs: bring back possibility to rewind the checkpoint from

    Add parsing of the rewind options.

    When I was upstreaming the change [1], I omitted the part where we
    detect that the pool should be rewind. When the FreeBSD repo has
    synced with the OpenZFS, this part of the code was removed.

    [1] FreeBSD repo: 277f38abffc6a8160b5044128b5b2c620fbb970c
    [2] OpenZFS repo: f2c027bd6a003ec5793f8716e6189c389c60f47a

    Originally reviewed by:         tsoome, allanjude
    Originally reviewed by:         kevans (ok from high-level overview)

    Signed-off-by: Mariusz Zaborski <oshogbo@vexillium.org>

    PR:             254152
    Reported by:    Zhenlei Huang <zlei.huang at gmail.com>
    Obtained from:  https://github.com/openzfs/zfs/pull/11730

    (cherry picked from commit 653ed678c70376b15cdc42daafa7b4554570cea2)

 sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-03-18 23:03:49 UTC
A commit in branch releng/13.0 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=c145b7954656601d92f578b08183fbf78e1a249b

commit c145b7954656601d92f578b08183fbf78e1a249b
Author:     Mariusz Zaborski <oshogbo@FreeBSD.org>
AuthorDate: 2021-03-13 11:56:17 +0000
Commit:     Mariusz Zaborski <oshogbo@FreeBSD.org>
CommitDate: 2021-03-18 23:02:57 +0000

    zfs: bring back possibility to rewind the checkpoint from

    Add parsing of the rewind options.

    When I was upstreaming the change [1], I omitted the part where we
    detect that the pool should be rewind. When the FreeBSD repo has
    synced with the OpenZFS, this part of the code was removed.

    [1] FreeBSD repo: 277f38abffc6a8160b5044128b5b2c620fbb970c
    [2] OpenZFS repo: f2c027bd6a003ec5793f8716e6189c389c60f47a

    Originally reviewed by:         tsoome, allanjude
    Originally reviewed by:         kevans (ok from high-level overview)

    Signed-off-by: Mariusz Zaborski <oshogbo@vexillium.org>

    PR:             254152
    Approved by:    re(gjb)
    Reported by:    Zhenlei Huang <zlei.huang at gmail.com>
    Obtained from:  https://github.com/openzfs/zfs/pull/11730

    (cherry picked from commit 653ed678c70376b15cdc42daafa7b4554570cea2)
    (cherry picked from commit 6bbca5ca3a6634fc10b93da203df2ae92cf60b61)

 sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
Comment 8 Mariusz Zaborski freebsd_committer freebsd_triage 2021-03-18 23:08:06 UTC
The fix will be in next 13 build.
Thank you!