We are building new bootonce mechanism (previously zfs bootnext) and it is
based on this OpenZFS change. Since this patch is nicely self contained,
I am commiting it as is, and we can stack our changes.
Original patch description follows:
Modern bootloaders leverage data stored in the root filesystem to
enable some of their powerful features. GRUB specifically has a grubenv
file which can store large amounts of configuration data that can be
read and written at boot time and during normal operation. This allows
sysadmins to configure useful features like automated failover after
failed boot attempts. Unfortunately, due to the Copy-on-Write nature
of ZFS, the standard behavior of these tools cannot handle writing to
ZFS files safely at boot time. We need an alternative way to store
data that allows the bootloader to make changes to the data.
This work is very similar to work that was done on Illumos to enable
similar functionality in the FreeBSD bootloader. This patch is different
in that the data being stored is a raw grubenv file; this file can store
arbitrary variables and values, and the scripting provided by grub is
powerful enough that special structures are not required to implement
advanced behavior.
We repurpose the second padding area in each label to store the grubenv
file, protected by an embedded checksum. We add two ioctls to get and
set this data, and libzfs_core and libzfs functions to access them more
easily. There are no direct command line interfaces to these functions;
these will be added directly to the bootloader utilities.
Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes#10009
Obtained from: OpenZFS
Sponsored by: Netflix, Klara Inc.
As we do check the incomint nvlist, we either need to list all possible
keys or use wildcard.
PR: 248462
Reported by: larafercue@gmail.com
Sponsored by: Netflix, Klara Inc.
- Add a better introduction to the DESCRIPTION section
- Add a description for MANPATH and POSIXLY_CORRECT
- Asorted improvements for the usage of some macros
PR: 43823
Submitted by: Lyndon Nerenberg <lyndon at orthanc dot ab dot ca>
Reviewed by: 0mp, bcr
Approved by: 0mp, bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25912
This reduces struct namecache by sizeof(void *).
Negative side is that we have to find the previous element (if any) when
removing an entry, but since we normally don't expect collisions it should be
fine.
Note this adds cache_get_hash calls which can be eliminated.
It used to be sizeof of the given struct to accomodate for 32 bit mips
doing 64 bit loads, but the same can be achieved with requireing just
64 bit alignment.
While here reorder struct namecache so that most commonly used fields
are closer.
Upper level protocols defer checksums calculation in hope we have
checksums offloading in a network card. CSUM_DELAY_DATA flag is used
to determine that checksum calculation was deferred. And IP output
routine checks for this flag before pass mbuf to lower layer. Forwarded
packets have not this flag.
NAT64 uses checksums adjustment when it translates IP headers.
In most cases NAT64 is used for forwarded packets, but in case when it
handles locally originated packets we need to finish checksum calculation
that was deferred to correctly adjust it.
Add check for presence of CSUM_DELAY_DATA flag and finish checksum
calculation before adjustment.
Reported and tested by: Evgeniy Khramtsov <evgeniy at khramtsov org>
MFC after: 1 week
This removes flag setting/unsetting carried over from regular lookup.
Flags still get for compatibility when falling back.
Note .. and . handling can get partially folded together.
This allows making half-constructed entries visible to the lockless lookup,
which now can check for either "not yet fully constructed" and "no longer valid"
state.
This will be used for .. lookup.
cache_purge locklessly checks whether the vnode at hand has any namecache
entries. This can race with a concurrent purge which managed to remove
the last entry, but may not be done touching the vnode.
Make sure we observe the relevant vnode lock as not taken before proceeding
with vgone.
Paired with the fact that doomed vnodes cannnot receive entries this restores
the invariant that there are no namecache-related writing users past cache_purge
in vgone.
Reported by: pho
* Downgrade some CAM debug messages from _INFO to _DEBUG level;
* Add KASSERT for the case when we suspect incorrect CAM SIM initialization (using cam_sim_alloc() instead of cam_sim_alloc_dev());
* Use waiting version of xpt_alloc_ccb(), we are not in hurry;
* With the waiting version we cannot get NULL return, so remove the NULL check;
* In some csses, the name of mmcprobe_done has been written as mmc_probedone();
* Send AC_LOST_DEVICE if we, well, lost the device;
* Misc style(9) fixes.
Reviewed by: manu
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D25843
There were two separate issues here:
1.) #if/#else wasn't taken into account at all for maxsyscall figures, but
2.) We didn't validate contiguous syscall numbers anyways...
This kind of inconsistency is bad as we don't currently ensure explicit
indexing of, e.g., the sysent array if one syscall is unimplemented/missing.
This could be fixed and might be more robust, but it's also good to have the
"documentation" that comes from being explicit as to what the missing
syscalls are.
The new version looks much like the awk version; stash off the current
'last highest syscall seen' if we hit an #if, restore to that if we hit an
#else, and make sure that we're explicitly always defining the next syscall.
The logic at the tail end of process_syscall_def that moves maxsyscall has
been 'cleaned up' a little since we're now ensuring that it's monotonically
increasing earlier in the function. At the moment I think it's unlikely we'd
see range-definitions that are not UNIMPL, but there's no reason to
specifically handle that case for bumping maxsyscall there.
This change was provoked by reading the commit message for r363832 and
realizing that this validation hadn't been included in the initial rewrite
to lua.
Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D25945
Refactor to create devinfo_free_dev(). Call it to plug a memory leak
on two error paths in devinfo_init_devices().
Reported by: Coverity
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
We cannot sleep during cam proto_announce and sbuf sleeps so use
a static length buffer like nvme(4)
Reviewed by: kibab
Differential Revision: https://reviews.freebsd.org/D25949