| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
The shift used to calculate uberblock location depends both
on minimum size (UBERBLOCK_SHIFT) and MAX_UBERBLOCK_SHIFT.
Since makefs defaults to use ashift 12, it incidentally
does get the correct size, but ashift 9 does not work with
current code.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D51860
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The dataset mountpoints get link count and size calculated by
content of dataset root directory, but this will break libzfs
dir_is_empty_stat() test.
For fix, we need to check if the directory is mountpoint for
dataset, and calculate the link count and size accordingly.
Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D51593
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
zfs/fs.c:
zfs/objset.c:
zfs/vdev.c:
zfs/zap.c:
Add include sys/param.h
dsl_dir_alloc() needs to set parent = NULL to silence warning
about 'parent' may be used uninitialized. Warning is given because
we break the loop when nextdir == NULL and parent was not previously set.
(it should not happen, but compiler does not know that).
zap_add() and zap_fat_write_array_chunk() takes uint8_t *, use type
cast.
zap_fat_write_array_chunk() should check sz for 0 to avoid
use of uninitialized pointer.
unchecked function returns.
Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D51592
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
makefs currently does not implement compression for ZFS datasets, as
doing so seems somewhat fraught with compatibility issues. As a result,
the root dataset has compression disabled, and all others inherit from
that.
However, it may be useful to enable compression for new files once the
generated pool is actually imported. Thus, implement a per-data
compression option. By default, compression is inherited from the
parent dataset and disabled on the root dataset.
Add a regression test.
PR: 288241
MFC after: 1 month
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the unlikely event of a hash collision, the collision differentiator
is used to create a unique lookup key for ZAP entries. While the fat
ZAP implementation in makefs implemented this, the micro ZAP
implementation did not, so it's possible to end up with collisions in
directory entries. These are caught deterministically by OpenZFS, but
the result is a panic.
Implement a simple differentiator by simply assigning a unique value to
each ZAP entry. This scheme works since the 16-bit space of
differentiators is larger than the maximum number of entries in a micro
ZAP. (While the on-disk encoding provides 32 bits of space for the
differentiator, the in-memory representation of micro ZAP entries is
smaller.)
PR: 287482
MFC after: 1 week
|
| |
|
|
|
|
|
|
|
|
| |
Previously, anything other than a regular file, directory or symlink
would cause makefs to exit with an assertion failure. Make it a bit
more resilient to user error: print a warning and skip the file. Add a
regression test wherein we create an image from a devfs mount.
PR: 283583
MFC after: 2 weeks
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
By default, OpenZFS will perform metadata verification of the most
recent TXGs, but this can be very slow since all data in a pool
generated by makefs was logically written in a single transaction.
Avoid triggering this verification by default, but add an option to
restore the previous behaviour and enable it in regression test cases.
Reported by: cperciva
Tested by: cperciva (previous version)
MFC after: 2 weeks
|
| |
|
|
|
|
|
|
| |
We haven't seen bug reports relating to this feature for a while, so
stop printing a warning.
Reviewed by: cperciva
MFC after: 2 weeks
|
| |
|
|
|
|
|
|
| |
Some ZAPs are used to represent sets, in which keys and values are the
same. Add a helper function for this case. No functional change
intended.
MFC after: 1 week
|
| |
|
|
|
|
|
|
| |
This flag was leftover from testing and should have been removed.
PR: 274938
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
| |
Fixes: 96092bf9108c ("makefs/zfs: Fill out dd_used_breakdown fields in DSL directories")
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
|
| |
This is required for the "used", "usedds" and "usedchild" dataset
properties to be displayed.
PR: 274613
Reported by: Mike Tancsa <mike@sentex.net>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When copying a file's contents into the pool, a loop copies blocks of
the maximum size (128KB), allocating space from the vdev for each block.
The space allocator rounds up to the nearest block size, but for files
larger than the maximum size, this can result in the last block having a
smaller logical size than the rest of the blocks belonging to that
dnode. This violates some ZFS invariants when appending to that file.
Modify fs_populate_file() to use the same block size for the final
block.
Reported by: cperciva
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
|
| |
When populating files, makefs needs to copy their contents into
userspace in order to compute a checksum, so copy_file_range(2) is out
of the question. Though, it could possibly be used when building other
types of filesystems.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
| |
It is supposed to contain the number of objects allocated from the set,
excluding the meta dnode.
Reported by: mav
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
|
| | |
|
| |
|
|
|
|
|
|
|
| |
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a type=dir entry exists and all contents are directories, files
added with contents=, or symlinks with link= attributes then it doesn't
need to exist. Just let openat fail in that case. It's conceivable
this will make debugging some cases weird, but it's sufficent to handle
the way we add /root/.ssh in CheriBSD VM images.
This is a recommit of 794154149f95d0cbc11aade166f9da919747e397 with
bugfixes.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38029
|
| |
|
|
|
|
| |
I pushed prematurely and this version is broken.
This reverts commit 794154149f95d0cbc11aade166f9da919747e397.
|
| |
|
|
|
|
|
|
|
|
|
| |
If a type=dir entry exists and all contents are directories, files
added with contents=, or symlinks with link= attributes then it doesn't
need to exist. Just let openat fail in that case. It's conceivable
this will make debugging some cases weird, but it's sufficent to handle
the way we add /root/.ssh in CheriBSD VM images.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38029
|
| |
|
|
|
|
|
|
| |
When a link target is specified use it rather than attempting to read
a potentially non-existant file.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38028
|
| |
|
|
|
|
|
| |
When a source path is provided use it rather than constructing one.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38027
|
| |
|
|
|
| |
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D37470
|
| |
|
|
|
| |
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D37469
|
| |
|
|
|
|
|
|
| |
Commit d7eec79b7021 overlooked the fact that
nvlist_find(DATA_TYPE_STRING) does not provide a nul-terminated string.
Fix the leak a different way.
Fixes: d7eec79b7021 ("makefs: Plug a memory leak")
|
| |
|
|
|
|
|
| |
"prefixlen" will always be smaller than 32 but adding a cast is
harmless.
Reported by: Coverity
|
| |
|
|
|
|
|
|
| |
nvlist_find_string() would return a copy of the found value, but callers
assumed they would have to make their own copy. It's simpler to change
nvlist_find_string() than it is to change callers, so do that.
Reported by: Coverity
|
| |
|
|
| |
No functional change intended.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This adds missing includes, uses the standard dirent.h rather than the
BSD-specific sys/dirent.h subset (which works on macOS but not Linux)
and works around Linux's lack of st_birthtim.
This allows usr.sbin/makefs to be added to LOCAL_XTOOL_DIRS again on
macOS and Linux so that disk images can be cross-built.
Reviewed by: markj
Fixes: 240afd8c1fcc ("makefs: Add ZFS support")
Differential Revision: https://reviews.freebsd.org/D36135
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently the code copies a struct timespec's raw bits as a pair of
uint64_t. On 64-bit systems this has the same representation, but on
32-bit issues there are two issues:
1. tv_sec is a time_t which is 32-bit on i386 specifically
2. tv_nsec is a long not a 64-bit integer
On i386, this means the assertion should fire as the size doesn't match.
On other 32-bit systems there are 4 bytes of padding after tv_nsec,
which in practice are probably 0, as this data is ultimately coming from
the kernel, so it's deterministic (though the padding bytes are not
required to be preserved by the compiler, so are strictly unspecified).
However, on 32-bit big-endian systems, the padding bytes are in the
wrong half to be harmless, resulting in the nanoseconds being multiplied
by 2^32.
Fix this all by marshalling via a real uint64_t pair like is done by the
real ZFS_TIME_ENCODE.
Reviewed by: markj
Fixes: 240afd8c1fcc ("makefs: Add ZFS support")
Differential Revision: https://reviews.freebsd.org/D36131
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The fsnode tree traversal routines used in ZFS mode assume that all
children of a (directory) fsnode can be accessed using a directory fd
for the parent and the child name. This is true when populating the
image using an mtree manifest or from a single staging directory, but
doesn't work when multiple staging directories are specified.
Change the traversal routines to use absolute path lookups when an mtree
manifest is not in use. This isn't ideal, but it's the simplest way to
fix the problem.
Reported by: imp
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Space used by the MOS is summed after all on-disk data structures are
finalized, so the MOS DSL directory represents a special case when
counting bytes used for each directory. The DSL layer failed to update
the MOS DSL directory's parent, the root directory, accordingly, so the
root directory reported less space used than was used in reality. Be
careful to update the root directory after the MOS is finalized.
PR: 265849
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
| |
For some dnode types, particularly ZAPs, we want the buffer to have
uint64_t alignment.
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
| |
Check the canmount property before building the mountpoint string.
Reported by: Coverity
Fixes: 240afd8c1fcc ("makefs: Add ZFS support")
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
| |
nvstring_get() returns a copy of the string, not a pointer into the
nvlist's internal buffer.
Reported by: Coverity
Fixes: 240afd8c1fcc ("makefs: Add ZFS support")
Sponsored by: The FreeBSD Foundation
|
|
|
This allows one to take a staged directory tree and create a file
consisting of a ZFS pool with one or more datasets that contain the
contents of the directory tree. This is useful for creating virtual
machine images without using the kernel to create a pool; "zpool create"
requires root privileges and currently is not permitted in jails.
makefs -t zfs also provides reproducible images by using a fixed seed
for pseudo-random number generation, used for generating GUIDs and hash
salts. makefs -t zfs requires relatively little by way of machine
resources.
The "zpool_reguid" rc.conf setting can be used to ask a FreeBSD guest to
generate a unique pool GUID upon first boot.
A small number of pool and dataset properties are supported. The pool
is backed by a single disk vdev. Data is always checksummed using
Fletcher-4, no redundant copies are made, and no compression is used.
The manual page documents supported pool and filesystem properties.
The implementation uses a few pieces of ZFS support from with the boot
loader, especially definitions for various on-disk structures, but is
otherwise standalone and in particular doesn't depend on OpenZFS.
This feature should be treated as experimental for now, i.e., important
data shouldn't be trusted to a makefs-created pool, and the command-line
interface is subject to change.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35248
|