]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/commit
MFC r226549,r226550,r226551,r226552,r226553,r226554,r226568,r226569,r226611,
authorpjd <pjd@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 19 Nov 2011 11:47:15 +0000 (11:47 +0000)
committerpjd <pjd@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sat, 19 Nov 2011 11:47:15 +0000 (11:47 +0000)
commit666edc60b81fe60fa0a0262148dee78aabae6552
tree08961995e41cf4ad0996b13b22015ed0f2867ad4
parent6350ade7a194a5f36f9204e78d1892e251dcb431
MFC r226549,r226550,r226551,r226552,r226553,r226554,r226568,r226569,r226611,
    r226612:

r226549:

Remove redundant size calculation.

r226550:

Initialize 'rc' properly before using it. This error could lead to infinite
loop when data reconstruction was needed.

r226551:

Don't mark vdev as healthy too soon, so we won't try to use invalid vdevs.

r226552:

Never pass NULL block pointer when reading. This is neither expected nor
handled by lower layers like vdev_raidz, which uses bp for checksum
verification. This bug could lead to NULL pointer reference and resets
during boot.

r226553:

Always pass data size for checksum verification function, as using
physical block size declared in bp may not always be what we want.
For example in case of gang block header physical block size declared
in bp is much larger than SPA_GANGBLOCKSIZE (512 bytes) and checksum
calculation failed. This bug could lead to accessing unallocated
memory and resets/failures during boot.

r226554:

Fix missing return when LOADER_GPT_SUPPORT is defined, but LOADER_MBR_SUPPORT
is not.

r226568:

- Correctly read gang header from raidz.
- Decompress assembled gang block data if compressed.
- Verify checksum of a gang header.
- Verify checksum of assembled gang block data.
- Verify checksum of uber block.

Submitted by: avg

r226569:

With LOADER_MBR_SUPPORT defined and LOADER_GPT_SUPPORT undefined we would
never call disk_openmbr().

Submitted by: avg

r226611:

- Allow to specify multiple files to check, eg.

zfsboottest gpt/system0 gpt/system1 - /boot/kernel/kernel /boot/zfsloader

- Instead of printing file's content calculate MD5 hash of the file,
  so it can be easly compared to the hash calculated via file system.
- Some other minor improvements.

r226612:

Because ZFS boot code was very fragile in the past and real PITA to debug,
introduce zfsboottest.sh script that will verify if it will be possible to boot
from the given pool.

# zfsboottest.sh system

Where "system" is pool name of the pool we want to boot from.

What is being verified by the script:
- Does the pool exist?
- Does it have bootfs property configured?
- Is mountpoint property of the boot dataset set to 'legacy'?

Dataset configured in bootfs property has to be mounted to perform more
checks:
- Does the /boot directory in boot dataset exist?
- Is this dataset configured as root file system in /etc/fstab or set
  in vfs.root.mountfrom variable in /boot/loader.conf?

By using zfsboottest tool the script will read all the files in /boot
directory using ZFS boot code and calculate their checksums.
Then, it will walk /boot directory using find(1) though regular file sytem
and also read all the files in /boot directory and calculate their checksums.
If any of the files cannot be looked up, read or checksum is invalid it will
be reported and booting off of this pool is probably not possible.

Some additional checks may be interesting as well. For example if the disks
contain proper pmbr and gptzfsboot code or if all expected files in /boot/
are present.

When upgrading FreeBSD, one should snapshot datasets that contain operating
system, upgrade (install new world and kernel) and use zfsboottest.sh to verify
if it will be possible to boot from new configuration. If all is good one
should upgrade boot blocks, by eg.:

# gpart -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1

If something is wrong, one should rollback datasets and report the problems.

Approved by: re (kib)

git-svn-id: svn://svn.freebsd.org/base/releng/9.0@227710 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/boot/common/disk.c
sys/boot/zfs/zfsimpl.c
sys/cddl/boot/zfs/zfssubr.c
tools/tools/zfsboottest/Makefile
tools/tools/zfsboottest/zfsboottest.c
tools/tools/zfsboottest/zfsboottest.sh [new file with mode: 0755]