mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 19:04:45 +03:00
Compare commits
114 Commits
zfs-2.0.4
...
ef686e96ec
| Author | SHA1 | Date | |
|---|---|---|---|
| ef686e96ec | |||
| 7a41ef240a | |||
| 72d16a9b49 | |||
| 54c358c3f2 | |||
| 560e9fc817 | |||
| d642efe83c | |||
| 51e313f610 | |||
| 327f12c291 | |||
| 5d4f7e7566 | |||
| abd0b59e48 | |||
| 6b9d0eda75 | |||
| 744cdfd93b | |||
| 36d50b60d8 | |||
| 0c4f86be74 | |||
| 88be308b2f | |||
| d6dc79eabc | |||
| 900a444107 | |||
| 1885e5ebab | |||
| 1ad8fcc054 | |||
| 05c96b438a | |||
| ccf6d0a59b | |||
| 61ae6c99f7 | |||
| e9353bc2ef | |||
| 87d93731e7 | |||
| bd197378e7 | |||
| cd2bb9ca44 | |||
| 52d9bc7174 | |||
| 6905f6b2c1 | |||
| cfc82609a2 | |||
| e26776f14c | |||
| e68e938f54 | |||
| ab2110e3e2 | |||
| a909190683 | |||
| 073f3c7826 | |||
| 5072f37419 | |||
| 332cd2e313 | |||
| ac6f332154 | |||
| f14b6f2302 | |||
| bfb2928490 | |||
| ecb1b1a31d | |||
| 412b69dfab | |||
| d014da0032 | |||
| 8f93ab53d4 | |||
| 88891b804b | |||
| 87b5e7fb1d | |||
| 5722dce473 | |||
| 91d5ac85c0 | |||
| fd8ccce07b | |||
| c2a3bcc91d | |||
| d1277e2a13 | |||
| a59bf29606 | |||
| 28fdc5f811 | |||
| a78a93e67e | |||
| 9a68ceba10 | |||
| 3c7ad493a6 | |||
| faad85637b | |||
| 501da8d433 | |||
| 30620ad8e1 | |||
| 1d65d1a597 | |||
| edf3d7aa43 | |||
| 9755cdfd89 | |||
| f36e8118fd | |||
| e69f73c5cf | |||
| 3430eced80 | |||
| 0839934d84 | |||
| f831d1377f | |||
| a559c3d0f4 | |||
| 95e29a7275 | |||
| 85890d54d9 | |||
| 12e25a6ec3 | |||
| 57490d5e13 | |||
| 214196e9f5 | |||
| 932d471bec | |||
| 77cba40b85 | |||
| 18d069a20f | |||
| dfc25ea91c | |||
| 7428adc6b7 | |||
| 30782f2ff5 | |||
| 43efd5625b | |||
| 87a520c4e7 | |||
| d02bcae0c4 | |||
| d9bcadc6ba | |||
| 67819ea28d | |||
| 79430bf34b | |||
| cabc605aa7 | |||
| 0740d41e9b | |||
| 16e8e24f9c | |||
| bc5afff351 | |||
| 825d8e1b0f | |||
| f7797f3f5e | |||
| 2439e95f36 | |||
| de722e55ca | |||
| acb4e7b0e1 | |||
| 5a397fda09 | |||
| 525a7037c7 | |||
| 789f3d0e56 | |||
| 5d946dfa1c | |||
| cd80d6d355 | |||
| 140584bfff | |||
| 8773e29c23 | |||
| bb21c0aa3b | |||
| 455ea5bb1f | |||
| 7126b0e5ed | |||
| 7ca0ef36e1 | |||
| 0d6186cff3 | |||
| 6f349d33a5 | |||
| 226d362b12 | |||
| 497fc5fb06 | |||
| abb485a34a | |||
| 0ccffb2634 | |||
| 26cb87d22d | |||
| 43dbfa3921 | |||
| 395583e38e | |||
| 818bc70c32 |
@@ -6,7 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
checkstyle:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
|
||||
@@ -44,6 +44,12 @@ jobs:
|
||||
sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
|
||||
sudo depmod
|
||||
sudo modprobe zfs
|
||||
# Workaround to provide additional free space for testing.
|
||||
# https://github.com/actions/virtual-environments/issues/2840
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
sudo rm -rf /opt/ghc
|
||||
sudo rm -rf "/usr/local/share/boost"
|
||||
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
||||
- name: Tests
|
||||
run: |
|
||||
/usr/share/zfs/zfs-tests.sh -v -s 3G
|
||||
|
||||
@@ -40,6 +40,12 @@ jobs:
|
||||
sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
|
||||
sudo depmod
|
||||
sudo modprobe zfs
|
||||
# Workaround to provide additional free space for testing.
|
||||
# https://github.com/actions/virtual-environments/issues/2840
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
sudo rm -rf /opt/ghc
|
||||
sudo rm -rf "/usr/local/share/boost"
|
||||
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
||||
- name: Tests
|
||||
run: |
|
||||
/usr/share/zfs/zfs-tests.sh -v -s 3G -r sanity
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
Meta: 1
|
||||
Name: zfs
|
||||
Branch: 1.0
|
||||
Version: 2.0.4
|
||||
Version: 2.0.6
|
||||
Release: 1
|
||||
Release-Tags: relext
|
||||
License: CDDL
|
||||
Author: OpenZFS
|
||||
Linux-Maximum: 5.11
|
||||
Linux-Maximum: 5.14
|
||||
Linux-Minimum: 3.10
|
||||
|
||||
+7
-8
@@ -25,7 +25,6 @@ endif
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
EXTRA_DIST = autogen.sh copy-builtin
|
||||
EXTRA_DIST += cppcheck-suppressions.txt
|
||||
EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am
|
||||
EXTRA_DIST += META AUTHORS COPYRIGHT LICENSE NEWS NOTICE README.md
|
||||
EXTRA_DIST += CODE_OF_CONDUCT.md
|
||||
@@ -162,7 +161,7 @@ checkbashisms:
|
||||
-o -name '90zfs' -prune \
|
||||
-o -type f ! -name 'config*' \
|
||||
! -name 'libtool' \
|
||||
-exec sh -c 'awk "NR==1 && /\#\!.*bin\/sh.*/ {print FILENAME;}" "{}"' \;); \
|
||||
-exec sh -c 'awk "NR==1 && /#!.*bin\/sh.*/ {print FILENAME;}" "{}"' \;); \
|
||||
else \
|
||||
echo "skipping checkbashisms because checkbashisms is not installed"; \
|
||||
fi
|
||||
@@ -204,13 +203,13 @@ vcscheck:
|
||||
PHONY += lint
|
||||
lint: cppcheck paxcheck
|
||||
|
||||
CPPCHECKDIRS = cmd lib module
|
||||
PHONY += cppcheck
|
||||
cppcheck:
|
||||
@if type cppcheck > /dev/null 2>&1; then \
|
||||
cppcheck --quiet --force --error-exitcode=2 --inline-suppr \
|
||||
--suppressions-list=${top_srcdir}/cppcheck-suppressions.txt \
|
||||
-UHAVE_SSE2 -UHAVE_AVX512F -UHAVE_UIO_ZEROCOPY \
|
||||
${top_srcdir}; \
|
||||
cppcheck: $(CPPCHECKDIRS)
|
||||
@if test -n "$(CPPCHECK)"; then \
|
||||
set -e ; for dir in $(CPPCHECKDIRS) ; do \
|
||||
$(MAKE) -C $$dir cppcheck ; \
|
||||
done \
|
||||
else \
|
||||
echo "skipping cppcheck because cppcheck is not installed"; \
|
||||
fi
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
SUBDIRS = zfs zpool zdb zhack zinject zstream zstreamdump ztest
|
||||
SUBDIRS += fsck_zfs vdev_id raidz_test zfs_ids_to_path
|
||||
|
||||
CPPCHECKDIRS = zfs zpool zdb zhack zinject zstream ztest
|
||||
CPPCHECKDIRS += raidz_test zfs_ids_to_path
|
||||
|
||||
if USING_PYTHON
|
||||
SUBDIRS += arcstat arc_summary dbufstat
|
||||
endif
|
||||
|
||||
if BUILD_LINUX
|
||||
SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait
|
||||
CPPCHECKDIRS += mount_zfs zed zgenhostid zvol_id
|
||||
endif
|
||||
|
||||
PHONY = cppcheck
|
||||
cppcheck: $(CPPCHECKDIRS)
|
||||
set -e ; for dir in $(CPPCHECKDIRS) ; do \
|
||||
$(MAKE) -C $$dir cppcheck ; \
|
||||
done
|
||||
|
||||
@@ -18,3 +18,5 @@ mount_zfs_LDADD = \
|
||||
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
|
||||
|
||||
mount_zfs_LDADD += $(LTLIBINTL)
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -18,3 +18,5 @@ raidz_test_LDADD = \
|
||||
$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la
|
||||
|
||||
raidz_test_LDADD += -lm
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -14,3 +14,5 @@ zdb_LDADD = \
|
||||
$(abs_top_builddir)/lib/libzpool/libzpool.la \
|
||||
$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \
|
||||
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
+75
-47
@@ -161,12 +161,6 @@ static int dump_bpobj_cb(void *arg, const blkptr_t *bp, boolean_t free,
|
||||
dmu_tx_t *tx);
|
||||
|
||||
typedef struct sublivelist_verify {
|
||||
/* all ALLOC'd blkptr_t in one sub-livelist */
|
||||
zfs_btree_t sv_all_allocs;
|
||||
|
||||
/* all FREE'd blkptr_t in one sub-livelist */
|
||||
zfs_btree_t sv_all_frees;
|
||||
|
||||
/* FREE's that haven't yet matched to an ALLOC, in one sub-livelist */
|
||||
zfs_btree_t sv_pair;
|
||||
|
||||
@@ -225,29 +219,68 @@ typedef struct sublivelist_verify_block {
|
||||
|
||||
static void zdb_print_blkptr(const blkptr_t *bp, int flags);
|
||||
|
||||
typedef struct sublivelist_verify_block_refcnt {
|
||||
/* block pointer entry in livelist being verified */
|
||||
blkptr_t svbr_blk;
|
||||
|
||||
/*
|
||||
* Refcount gets incremented to 1 when we encounter the first
|
||||
* FREE entry for the svfbr block pointer and a node for it
|
||||
* is created in our ZDB verification/tracking metadata.
|
||||
*
|
||||
* As we encounter more FREE entries we increment this counter
|
||||
* and similarly decrement it whenever we find the respective
|
||||
* ALLOC entries for this block.
|
||||
*
|
||||
* When the refcount gets to 0 it means that all the FREE and
|
||||
* ALLOC entries of this block have paired up and we no longer
|
||||
* need to track it in our verification logic (e.g. the node
|
||||
* containing this struct in our verification data structure
|
||||
* should be freed).
|
||||
*
|
||||
* [refer to sublivelist_verify_blkptr() for the actual code]
|
||||
*/
|
||||
uint32_t svbr_refcnt;
|
||||
} sublivelist_verify_block_refcnt_t;
|
||||
|
||||
static int
|
||||
sublivelist_block_refcnt_compare(const void *larg, const void *rarg)
|
||||
{
|
||||
const sublivelist_verify_block_refcnt_t *l = larg;
|
||||
const sublivelist_verify_block_refcnt_t *r = rarg;
|
||||
return (livelist_compare(&l->svbr_blk, &r->svbr_blk));
|
||||
}
|
||||
|
||||
static int
|
||||
sublivelist_verify_blkptr(void *arg, const blkptr_t *bp, boolean_t free,
|
||||
dmu_tx_t *tx)
|
||||
{
|
||||
ASSERT3P(tx, ==, NULL);
|
||||
struct sublivelist_verify *sv = arg;
|
||||
char blkbuf[BP_SPRINTF_LEN];
|
||||
sublivelist_verify_block_refcnt_t current = {
|
||||
.svbr_blk = *bp,
|
||||
|
||||
/*
|
||||
* Start with 1 in case this is the first free entry.
|
||||
* This field is not used for our B-Tree comparisons
|
||||
* anyway.
|
||||
*/
|
||||
.svbr_refcnt = 1,
|
||||
};
|
||||
|
||||
zfs_btree_index_t where;
|
||||
sublivelist_verify_block_refcnt_t *pair =
|
||||
zfs_btree_find(&sv->sv_pair, ¤t, &where);
|
||||
if (free) {
|
||||
zfs_btree_add(&sv->sv_pair, bp);
|
||||
/* Check if the FREE is a duplicate */
|
||||
if (zfs_btree_find(&sv->sv_all_frees, bp, &where) != NULL) {
|
||||
snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), bp,
|
||||
free);
|
||||
(void) printf("\tERROR: Duplicate FREE: %s\n", blkbuf);
|
||||
if (pair == NULL) {
|
||||
/* first free entry for this block pointer */
|
||||
zfs_btree_add(&sv->sv_pair, ¤t);
|
||||
} else {
|
||||
zfs_btree_add_idx(&sv->sv_all_frees, bp, &where);
|
||||
pair->svbr_refcnt++;
|
||||
}
|
||||
} else {
|
||||
/* Check if the ALLOC has been freed */
|
||||
if (zfs_btree_find(&sv->sv_pair, bp, &where) != NULL) {
|
||||
zfs_btree_remove_idx(&sv->sv_pair, &where);
|
||||
} else {
|
||||
if (pair == NULL) {
|
||||
/* block that is currently marked as allocated */
|
||||
for (int i = 0; i < SPA_DVAS_PER_BP; i++) {
|
||||
if (DVA_IS_EMPTY(&bp->blk_dva[i]))
|
||||
break;
|
||||
@@ -262,16 +295,16 @@ sublivelist_verify_blkptr(void *arg, const blkptr_t *bp, boolean_t free,
|
||||
&svb, &where);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Check if the ALLOC is a duplicate */
|
||||
if (zfs_btree_find(&sv->sv_all_allocs, bp, &where) != NULL) {
|
||||
snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), bp,
|
||||
free);
|
||||
(void) printf("\tERROR: Duplicate ALLOC: %s\n", blkbuf);
|
||||
} else {
|
||||
zfs_btree_add_idx(&sv->sv_all_allocs, bp, &where);
|
||||
/* alloc matches a free entry */
|
||||
pair->svbr_refcnt--;
|
||||
if (pair->svbr_refcnt == 0) {
|
||||
/* all allocs and frees have been matched */
|
||||
zfs_btree_remove_idx(&sv->sv_pair, &where);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -279,32 +312,22 @@ static int
|
||||
sublivelist_verify_func(void *args, dsl_deadlist_entry_t *dle)
|
||||
{
|
||||
int err;
|
||||
char blkbuf[BP_SPRINTF_LEN];
|
||||
struct sublivelist_verify *sv = args;
|
||||
|
||||
zfs_btree_create(&sv->sv_all_allocs, livelist_compare,
|
||||
sizeof (blkptr_t));
|
||||
|
||||
zfs_btree_create(&sv->sv_all_frees, livelist_compare,
|
||||
sizeof (blkptr_t));
|
||||
|
||||
zfs_btree_create(&sv->sv_pair, livelist_compare,
|
||||
sizeof (blkptr_t));
|
||||
zfs_btree_create(&sv->sv_pair, sublivelist_block_refcnt_compare,
|
||||
sizeof (sublivelist_verify_block_refcnt_t));
|
||||
|
||||
err = bpobj_iterate_nofree(&dle->dle_bpobj, sublivelist_verify_blkptr,
|
||||
sv, NULL);
|
||||
|
||||
zfs_btree_clear(&sv->sv_all_allocs);
|
||||
zfs_btree_destroy(&sv->sv_all_allocs);
|
||||
|
||||
zfs_btree_clear(&sv->sv_all_frees);
|
||||
zfs_btree_destroy(&sv->sv_all_frees);
|
||||
|
||||
blkptr_t *e;
|
||||
sublivelist_verify_block_refcnt_t *e;
|
||||
zfs_btree_index_t *cookie = NULL;
|
||||
while ((e = zfs_btree_destroy_nodes(&sv->sv_pair, &cookie)) != NULL) {
|
||||
snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), e, B_TRUE);
|
||||
(void) printf("\tERROR: Unmatched FREE: %s\n", blkbuf);
|
||||
char blkbuf[BP_SPRINTF_LEN];
|
||||
snprintf_blkptr_compact(blkbuf, sizeof (blkbuf),
|
||||
&e->svbr_blk, B_TRUE);
|
||||
(void) printf("\tERROR: %d unmatched FREE(s): %s\n",
|
||||
e->svbr_refcnt, blkbuf);
|
||||
}
|
||||
zfs_btree_destroy(&sv->sv_pair);
|
||||
|
||||
@@ -613,10 +636,14 @@ mv_populate_livelist_allocs(metaslab_verify_t *mv, sublivelist_verify_t *sv)
|
||||
/*
|
||||
* [Livelist Check]
|
||||
* Iterate through all the sublivelists and:
|
||||
* - report leftover frees
|
||||
* - report double ALLOCs/FREEs
|
||||
* - report leftover frees (**)
|
||||
* - record leftover ALLOCs together with their TXG [see Cross Check]
|
||||
*
|
||||
* (**) Note: Double ALLOCs are valid in datasets that have dedup
|
||||
* enabled. Similarly double FREEs are allowed as well but
|
||||
* only if they pair up with a corresponding ALLOC entry once
|
||||
* we our done with our sublivelist iteration.
|
||||
*
|
||||
* [Spacemap Check]
|
||||
* for each metaslab:
|
||||
* - iterate over spacemap and then the metaslab's entries in the
|
||||
@@ -5840,7 +5867,8 @@ zdb_leak_init_prepare_indirect_vdevs(spa_t *spa, zdb_cb_t *zcb)
|
||||
*/
|
||||
VERIFY0(vdev_metaslab_init(vd, 0));
|
||||
|
||||
vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping;
|
||||
vdev_indirect_mapping_t *vim __maybe_unused =
|
||||
vd->vdev_indirect_mapping;
|
||||
uint64_t vim_idx = 0;
|
||||
for (uint64_t m = 0; m < vd->vdev_ms_count; m++) {
|
||||
|
||||
@@ -6933,7 +6961,7 @@ verify_checkpoint_vdev_spacemaps(spa_t *checkpoint, spa_t *current)
|
||||
for (uint64_t c = ckpoint_rvd->vdev_children;
|
||||
c < current_rvd->vdev_children; c++) {
|
||||
vdev_t *current_vd = current_rvd->vdev_child[c];
|
||||
ASSERT3P(current_vd->vdev_checkpoint_sm, ==, NULL);
|
||||
VERIFY3P(current_vd->vdev_checkpoint_sm, ==, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,3 +47,5 @@ zed_LDADD += -lrt $(LIBUDEV_LIBS) $(LIBUUID_LIBS)
|
||||
zed_LDFLAGS = -pthread
|
||||
|
||||
EXTRA_DIST = agents/README.md
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -173,6 +173,7 @@ _zed_exec_fork_child(uint64_t eid, const char *dir, const char *prog,
|
||||
zed_log_msg(LOG_WARNING, "Killing hung \"%s\" pid=%d",
|
||||
prog, pid);
|
||||
(void) kill(pid, SIGKILL);
|
||||
(void) waitpid(pid, &status, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,3 +21,5 @@ zfs_LDADD += $(LTLIBINTL)
|
||||
if BUILD_FREEBSD
|
||||
zfs_LDADD += -lgeom -ljail
|
||||
endif
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -7,3 +7,5 @@ zfs_ids_to_path_SOURCES = \
|
||||
|
||||
zfs_ids_to_path_LDADD = \
|
||||
$(abs_top_builddir)/lib/libzfs/libzfs.la
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -3,3 +3,5 @@ include $(top_srcdir)/config/Rules.am
|
||||
sbin_PROGRAMS = zgenhostid
|
||||
|
||||
zgenhostid_SOURCES = zgenhostid.c
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -12,3 +12,5 @@ zhack_LDADD = \
|
||||
$(abs_top_builddir)/lib/libzpool/libzpool.la \
|
||||
$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \
|
||||
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -11,3 +11,5 @@ zinject_LDADD = \
|
||||
$(abs_top_builddir)/lib/libzfs/libzfs.la \
|
||||
$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \
|
||||
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -34,6 +34,8 @@ zpool_LDADD += -lgeom
|
||||
endif
|
||||
zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS)
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
zpoolconfdir = $(sysconfdir)/zfs/zpool.d
|
||||
zpoolexecdir = $(zfsexecdir)/zpool.d
|
||||
|
||||
|
||||
+186
-123
@@ -2586,8 +2586,8 @@ print_class_vdevs(zpool_handle_t *zhp, status_cbdata_t *cb, nvlist_t *nv,
|
||||
/*
|
||||
* Display the status for the given pool.
|
||||
*/
|
||||
static void
|
||||
show_import(nvlist_t *config)
|
||||
static int
|
||||
show_import(nvlist_t *config, boolean_t report_error)
|
||||
{
|
||||
uint64_t pool_state;
|
||||
vdev_stat_t *vs;
|
||||
@@ -2619,6 +2619,13 @@ show_import(nvlist_t *config)
|
||||
|
||||
reason = zpool_import_status(config, &msgid, &errata);
|
||||
|
||||
/*
|
||||
* If we're importing using a cachefile, then we won't report any
|
||||
* errors unless we are in the scan phase of the import.
|
||||
*/
|
||||
if (reason != ZPOOL_STATUS_OK && !report_error)
|
||||
return (reason);
|
||||
|
||||
(void) printf(gettext(" pool: %s\n"), name);
|
||||
(void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid);
|
||||
(void) printf(gettext(" state: %s"), health);
|
||||
@@ -2933,6 +2940,7 @@ show_import(nvlist_t *config)
|
||||
"be part of this pool, though their\n\texact "
|
||||
"configuration cannot be determined.\n"));
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static boolean_t
|
||||
@@ -3071,6 +3079,121 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static int
|
||||
import_pools(nvlist_t *pools, nvlist_t *props, char *mntopts, int flags,
|
||||
char *orig_name, char *new_name,
|
||||
boolean_t do_destroyed, boolean_t pool_specified, boolean_t do_all,
|
||||
importargs_t *import)
|
||||
{
|
||||
nvlist_t *config = NULL;
|
||||
nvlist_t *found_config = NULL;
|
||||
uint64_t pool_state;
|
||||
|
||||
/*
|
||||
* At this point we have a list of import candidate configs. Even if
|
||||
* we were searching by pool name or guid, we still need to
|
||||
* post-process the list to deal with pool state and possible
|
||||
* duplicate names.
|
||||
*/
|
||||
int err = 0;
|
||||
nvpair_t *elem = NULL;
|
||||
boolean_t first = B_TRUE;
|
||||
while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) {
|
||||
|
||||
verify(nvpair_value_nvlist(elem, &config) == 0);
|
||||
|
||||
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE,
|
||||
&pool_state) == 0);
|
||||
if (!do_destroyed && pool_state == POOL_STATE_DESTROYED)
|
||||
continue;
|
||||
if (do_destroyed && pool_state != POOL_STATE_DESTROYED)
|
||||
continue;
|
||||
|
||||
verify(nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY,
|
||||
import->policy) == 0);
|
||||
|
||||
if (!pool_specified) {
|
||||
if (first)
|
||||
first = B_FALSE;
|
||||
else if (!do_all)
|
||||
(void) printf("\n");
|
||||
|
||||
if (do_all) {
|
||||
err |= do_import(config, NULL, mntopts,
|
||||
props, flags);
|
||||
} else {
|
||||
/*
|
||||
* If we're importing from cachefile, then
|
||||
* we don't want to report errors until we
|
||||
* are in the scan phase of the import. If
|
||||
* we get an error, then we return that error
|
||||
* to invoke the scan phase.
|
||||
*/
|
||||
if (import->cachefile && !import->scan)
|
||||
err = show_import(config, B_FALSE);
|
||||
else
|
||||
(void) show_import(config, B_TRUE);
|
||||
}
|
||||
} else if (import->poolname != NULL) {
|
||||
char *name;
|
||||
|
||||
/*
|
||||
* We are searching for a pool based on name.
|
||||
*/
|
||||
verify(nvlist_lookup_string(config,
|
||||
ZPOOL_CONFIG_POOL_NAME, &name) == 0);
|
||||
|
||||
if (strcmp(name, import->poolname) == 0) {
|
||||
if (found_config != NULL) {
|
||||
(void) fprintf(stderr, gettext(
|
||||
"cannot import '%s': more than "
|
||||
"one matching pool\n"),
|
||||
import->poolname);
|
||||
(void) fprintf(stderr, gettext(
|
||||
"import by numeric ID instead\n"));
|
||||
err = B_TRUE;
|
||||
}
|
||||
found_config = config;
|
||||
}
|
||||
} else {
|
||||
uint64_t guid;
|
||||
|
||||
/*
|
||||
* Search for a pool by guid.
|
||||
*/
|
||||
verify(nvlist_lookup_uint64(config,
|
||||
ZPOOL_CONFIG_POOL_GUID, &guid) == 0);
|
||||
|
||||
if (guid == import->guid)
|
||||
found_config = config;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we were searching for a specific pool, verify that we found a
|
||||
* pool, and then do the import.
|
||||
*/
|
||||
if (pool_specified && err == 0) {
|
||||
if (found_config == NULL) {
|
||||
(void) fprintf(stderr, gettext("cannot import '%s': "
|
||||
"no such pool available\n"), orig_name);
|
||||
err = B_TRUE;
|
||||
} else {
|
||||
err |= do_import(found_config, new_name,
|
||||
mntopts, props, flags);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we were just looking for pools, report an error if none were
|
||||
* found.
|
||||
*/
|
||||
if (!pool_specified && first)
|
||||
(void) fprintf(stderr,
|
||||
gettext("no pools available to import\n"));
|
||||
return (err);
|
||||
}
|
||||
|
||||
typedef struct target_exists_args {
|
||||
const char *poolname;
|
||||
uint64_t poolguid;
|
||||
@@ -3198,51 +3321,54 @@ zpool_do_checkpoint(int argc, char **argv)
|
||||
/*
|
||||
* zpool import [-d dir] [-D]
|
||||
* import [-o mntopts] [-o prop=value] ... [-R root] [-D] [-l]
|
||||
* [-d dir | -c cachefile] [-f] -a
|
||||
* [-d dir | -c cachefile | -s] [-f] -a
|
||||
* import [-o mntopts] [-o prop=value] ... [-R root] [-D] [-l]
|
||||
* [-d dir | -c cachefile] [-f] [-n] [-F] <pool | id> [newpool]
|
||||
* [-d dir | -c cachefile | -s] [-f] [-n] [-F] <pool | id>
|
||||
* [newpool]
|
||||
*
|
||||
* -c Read pool information from a cachefile instead of searching
|
||||
* devices.
|
||||
* -c Read pool information from a cachefile instead of searching
|
||||
* devices. If importing from a cachefile config fails, then
|
||||
* fallback to searching for devices only in the directories that
|
||||
* exist in the cachefile.
|
||||
*
|
||||
* -d Scan in a specific directory, other than /dev/. More than
|
||||
* -d Scan in a specific directory, other than /dev/. More than
|
||||
* one directory can be specified using multiple '-d' options.
|
||||
*
|
||||
* -D Scan for previously destroyed pools or import all or only
|
||||
* specified destroyed pools.
|
||||
* -D Scan for previously destroyed pools or import all or only
|
||||
* specified destroyed pools.
|
||||
*
|
||||
* -R Temporarily import the pool, with all mountpoints relative to
|
||||
* -R Temporarily import the pool, with all mountpoints relative to
|
||||
* the given root. The pool will remain exported when the machine
|
||||
* is rebooted.
|
||||
*
|
||||
* -V Import even in the presence of faulted vdevs. This is an
|
||||
* intentionally undocumented option for testing purposes, and
|
||||
* treats the pool configuration as complete, leaving any bad
|
||||
* -V Import even in the presence of faulted vdevs. This is an
|
||||
* intentionally undocumented option for testing purposes, and
|
||||
* treats the pool configuration as complete, leaving any bad
|
||||
* vdevs in the FAULTED state. In other words, it does verbatim
|
||||
* import.
|
||||
*
|
||||
* -f Force import, even if it appears that the pool is active.
|
||||
* -f Force import, even if it appears that the pool is active.
|
||||
*
|
||||
* -F Attempt rewind if necessary.
|
||||
* -F Attempt rewind if necessary.
|
||||
*
|
||||
* -n See if rewind would work, but don't actually rewind.
|
||||
* -n See if rewind would work, but don't actually rewind.
|
||||
*
|
||||
* -N Import the pool but don't mount datasets.
|
||||
* -N Import the pool but don't mount datasets.
|
||||
*
|
||||
* -T Specify a starting txg to use for import. This option is
|
||||
* intentionally undocumented option for testing purposes.
|
||||
* -T Specify a starting txg to use for import. This option is
|
||||
* intentionally undocumented option for testing purposes.
|
||||
*
|
||||
* -a Import all pools found.
|
||||
* -a Import all pools found.
|
||||
*
|
||||
* -l Load encryption keys while importing.
|
||||
* -l Load encryption keys while importing.
|
||||
*
|
||||
* -o Set property=value and/or temporary mount options (without '=').
|
||||
* -o Set property=value and/or temporary mount options (without '=').
|
||||
*
|
||||
* -s Scan using the default search path, the libblkid cache will
|
||||
* not be consulted.
|
||||
* -s Scan using the default search path, the libblkid cache will
|
||||
* not be consulted.
|
||||
*
|
||||
* --rewind-to-checkpoint
|
||||
* Import the pool and revert back to the checkpoint.
|
||||
* --rewind-to-checkpoint
|
||||
* Import the pool and revert back to the checkpoint.
|
||||
*
|
||||
* The import command scans for pools to import, and import pools based on pool
|
||||
* name and GUID. The pool can also be renamed as part of the import process.
|
||||
@@ -3259,15 +3385,11 @@ zpool_do_import(int argc, char **argv)
|
||||
boolean_t do_all = B_FALSE;
|
||||
boolean_t do_destroyed = B_FALSE;
|
||||
char *mntopts = NULL;
|
||||
nvpair_t *elem;
|
||||
nvlist_t *config;
|
||||
uint64_t searchguid = 0;
|
||||
char *searchname = NULL;
|
||||
char *propval;
|
||||
nvlist_t *found_config;
|
||||
nvlist_t *policy = NULL;
|
||||
nvlist_t *props = NULL;
|
||||
boolean_t first;
|
||||
int flags = ZFS_IMPORT_NORMAL;
|
||||
uint32_t rewind_policy = ZPOOL_NO_REWIND;
|
||||
boolean_t dryrun = B_FALSE;
|
||||
@@ -3275,7 +3397,8 @@ zpool_do_import(int argc, char **argv)
|
||||
boolean_t xtreme_rewind = B_FALSE;
|
||||
boolean_t do_scan = B_FALSE;
|
||||
boolean_t pool_exists = B_FALSE;
|
||||
uint64_t pool_state, txg = -1ULL;
|
||||
boolean_t pool_specified = B_FALSE;
|
||||
uint64_t txg = -1ULL;
|
||||
char *cachefile = NULL;
|
||||
importargs_t idata = { 0 };
|
||||
char *endptr;
|
||||
@@ -3397,6 +3520,11 @@ zpool_do_import(int argc, char **argv)
|
||||
usage(B_FALSE);
|
||||
}
|
||||
|
||||
if (cachefile && do_scan) {
|
||||
(void) fprintf(stderr, gettext("-c is incompatible with -s\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
|
||||
if ((flags & ZFS_IMPORT_LOAD_KEYS) && (flags & ZFS_IMPORT_ONLY)) {
|
||||
(void) fprintf(stderr, gettext("-l is incompatible with -N\n"));
|
||||
usage(B_FALSE);
|
||||
@@ -3477,7 +3605,7 @@ zpool_do_import(int argc, char **argv)
|
||||
searchname = argv[0];
|
||||
searchguid = 0;
|
||||
}
|
||||
found_config = NULL;
|
||||
pool_specified = B_TRUE;
|
||||
|
||||
/*
|
||||
* User specified a name or guid. Ensure it's unique.
|
||||
@@ -3556,98 +3684,33 @@ zpool_do_import(int argc, char **argv)
|
||||
return (1);
|
||||
}
|
||||
|
||||
err = import_pools(pools, props, mntopts, flags, argv[0],
|
||||
argc == 1 ? NULL : argv[1], do_destroyed, pool_specified,
|
||||
do_all, &idata);
|
||||
|
||||
/*
|
||||
* At this point we have a list of import candidate configs. Even if
|
||||
* we were searching by pool name or guid, we still need to
|
||||
* post-process the list to deal with pool state and possible
|
||||
* duplicate names.
|
||||
* If we're using the cachefile and we failed to import, then
|
||||
* fallback to scanning the directory for pools that match
|
||||
* those in the cachefile.
|
||||
*/
|
||||
err = 0;
|
||||
elem = NULL;
|
||||
first = B_TRUE;
|
||||
while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) {
|
||||
if (err != 0 && cachefile != NULL) {
|
||||
(void) printf(gettext("cachefile import failed, retrying\n"));
|
||||
|
||||
verify(nvpair_value_nvlist(elem, &config) == 0);
|
||||
/*
|
||||
* We use the scan flag to gather the directories that exist
|
||||
* in the cachefile. If we need to fallback to searching for
|
||||
* the pool config, we will only search devices in these
|
||||
* directories.
|
||||
*/
|
||||
idata.scan = B_TRUE;
|
||||
nvlist_free(pools);
|
||||
pools = zpool_search_import(g_zfs, &idata, &libzfs_config_ops);
|
||||
|
||||
verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE,
|
||||
&pool_state) == 0);
|
||||
if (!do_destroyed && pool_state == POOL_STATE_DESTROYED)
|
||||
continue;
|
||||
if (do_destroyed && pool_state != POOL_STATE_DESTROYED)
|
||||
continue;
|
||||
|
||||
verify(nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY,
|
||||
policy) == 0);
|
||||
|
||||
if (argc == 0) {
|
||||
if (first)
|
||||
first = B_FALSE;
|
||||
else if (!do_all)
|
||||
(void) printf("\n");
|
||||
|
||||
if (do_all) {
|
||||
err |= do_import(config, NULL, mntopts,
|
||||
props, flags);
|
||||
} else {
|
||||
show_import(config);
|
||||
}
|
||||
} else if (searchname != NULL) {
|
||||
char *name;
|
||||
|
||||
/*
|
||||
* We are searching for a pool based on name.
|
||||
*/
|
||||
verify(nvlist_lookup_string(config,
|
||||
ZPOOL_CONFIG_POOL_NAME, &name) == 0);
|
||||
|
||||
if (strcmp(name, searchname) == 0) {
|
||||
if (found_config != NULL) {
|
||||
(void) fprintf(stderr, gettext(
|
||||
"cannot import '%s': more than "
|
||||
"one matching pool\n"), searchname);
|
||||
(void) fprintf(stderr, gettext(
|
||||
"import by numeric ID instead\n"));
|
||||
err = B_TRUE;
|
||||
}
|
||||
found_config = config;
|
||||
}
|
||||
} else {
|
||||
uint64_t guid;
|
||||
|
||||
/*
|
||||
* Search for a pool by guid.
|
||||
*/
|
||||
verify(nvlist_lookup_uint64(config,
|
||||
ZPOOL_CONFIG_POOL_GUID, &guid) == 0);
|
||||
|
||||
if (guid == searchguid)
|
||||
found_config = config;
|
||||
}
|
||||
err = import_pools(pools, props, mntopts, flags, argv[0],
|
||||
argc == 1 ? NULL : argv[1], do_destroyed, pool_specified,
|
||||
do_all, &idata);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we were searching for a specific pool, verify that we found a
|
||||
* pool, and then do the import.
|
||||
*/
|
||||
if (argc != 0 && err == 0) {
|
||||
if (found_config == NULL) {
|
||||
(void) fprintf(stderr, gettext("cannot import '%s': "
|
||||
"no such pool available\n"), argv[0]);
|
||||
err = B_TRUE;
|
||||
} else {
|
||||
err |= do_import(found_config, argc == 1 ? NULL :
|
||||
argv[1], mntopts, props, flags);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we were just looking for pools, report an error if none were
|
||||
* found.
|
||||
*/
|
||||
if (argc == 0 && first)
|
||||
(void) fprintf(stderr,
|
||||
gettext("no pools available to import\n"));
|
||||
|
||||
error:
|
||||
nvlist_free(props);
|
||||
nvlist_free(pools);
|
||||
@@ -4852,8 +4915,8 @@ get_interval_count(int *argcp, char **argv, float *iv,
|
||||
|
||||
if (*end == '\0' && errno == 0) {
|
||||
if (interval == 0) {
|
||||
(void) fprintf(stderr, gettext("interval "
|
||||
"cannot be zero\n"));
|
||||
(void) fprintf(stderr, gettext(
|
||||
"interval cannot be zero\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
/*
|
||||
@@ -4883,8 +4946,8 @@ get_interval_count(int *argcp, char **argv, float *iv,
|
||||
|
||||
if (*end == '\0' && errno == 0) {
|
||||
if (interval == 0) {
|
||||
(void) fprintf(stderr, gettext("interval "
|
||||
"cannot be zero\n"));
|
||||
(void) fprintf(stderr, gettext(
|
||||
"interval cannot be zero\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
|
||||
@@ -5887,7 +5950,7 @@ print_one_column(zpool_prop_t prop, uint64_t value, const char *str,
|
||||
break;
|
||||
case ZPOOL_PROP_HEALTH:
|
||||
width = 8;
|
||||
snprintf(propval, sizeof (propval), "%-*s", (int)width, str);
|
||||
(void) strlcpy(propval, str, sizeof (propval));
|
||||
break;
|
||||
default:
|
||||
zfs_nicenum_format(value, propval, sizeof (propval), format);
|
||||
|
||||
@@ -13,3 +13,5 @@ zstream_LDADD = \
|
||||
$(abs_top_builddir)/lib/libzfs/libzfs.la \
|
||||
$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \
|
||||
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -21,3 +21,5 @@ ztest_LDADD = \
|
||||
|
||||
ztest_LDADD += -lm
|
||||
ztest_LDFLAGS = -pthread
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
+2
-2
@@ -2163,8 +2163,8 @@ ztest_get_done(zgd_t *zgd, int error)
|
||||
}
|
||||
|
||||
static int
|
||||
ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb,
|
||||
zio_t *zio)
|
||||
ztest_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf,
|
||||
struct lwb *lwb, zio_t *zio)
|
||||
{
|
||||
ztest_ds_t *zd = arg;
|
||||
objset_t *os = zd->zd_os;
|
||||
|
||||
@@ -8,3 +8,5 @@ udev_PROGRAMS = zvol_id
|
||||
|
||||
zvol_id_SOURCES = \
|
||||
zvol_id_main.c
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# Default rules for running cppcheck against the the user space components.
|
||||
#
|
||||
|
||||
PHONY += cppcheck
|
||||
|
||||
CPPCHECKFLAGS = --std=c99 --quiet --max-configs=1 --error-exitcode=2
|
||||
CPPCHECKFLAGS += --inline-suppr -U_KERNEL
|
||||
|
||||
cppcheck:
|
||||
$(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(DEFAULT_INCLUDES) $(SOURCES)
|
||||
@@ -3,6 +3,7 @@
|
||||
# should include these rules and override or extend them as needed.
|
||||
#
|
||||
|
||||
PHONY =
|
||||
DEFAULT_INCLUDES = \
|
||||
-include $(top_builddir)/zfs_config.h \
|
||||
-I$(top_builddir)/include \
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
dnl #
|
||||
dnl # Check if cppcheck is available.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CPPCHECK], [
|
||||
AC_CHECK_PROG([CPPCHECK], [cppcheck], [cppcheck])
|
||||
])
|
||||
@@ -0,0 +1,101 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_count_cpus.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_COUNT_CPUS([ACTION-IF-DETECTED],[ACTION-IF-NOT-DETECTED])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Attempt to count the number of logical processor cores (including
|
||||
# virtual and HT cores) currently available to use on the machine and
|
||||
# place detected value in CPU_COUNT variable.
|
||||
#
|
||||
# On successful detection, ACTION-IF-DETECTED is executed if present. If
|
||||
# the detection fails, then ACTION-IF-NOT-DETECTED is triggered. The
|
||||
# default ACTION-IF-NOT-DETECTED is to set CPU_COUNT to 1.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2014,2016 Karlson2k (Evgeny Grin) <k2k@narod.ru>
|
||||
# Copyright (c) 2012 Brian Aker <brian@tangent.org>
|
||||
# Copyright (c) 2008 Michael Paul Bailey <jinxidoru@byu.net>
|
||||
# Copyright (c) 2008 Christophe Tournayre <turn3r@users.sourceforge.net>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 22
|
||||
|
||||
AC_DEFUN([AX_COUNT_CPUS],[dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_PROG_EGREP])dnl
|
||||
AC_MSG_CHECKING([the number of available CPUs])
|
||||
CPU_COUNT="0"
|
||||
|
||||
# Try generic methods
|
||||
|
||||
# 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and
|
||||
# 'NPROCESSORS_ONLN' are platform-specific
|
||||
command -v getconf >/dev/null 2>&1 && \
|
||||
CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0"
|
||||
AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1]],[[: # empty]],[dnl
|
||||
# 'nproc' is part of GNU Coreutils and is widely available
|
||||
CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0"
|
||||
])dnl
|
||||
|
||||
AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl
|
||||
# Try platform-specific preferred methods
|
||||
AS_CASE([[$host_os]],dnl
|
||||
[[*linux*]],[[CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+,' -c` || CPU_COUNT="0"]],dnl
|
||||
[[*darwin*]],[[CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0"]],dnl
|
||||
[[freebsd*]],[[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0"]],dnl
|
||||
[[netbsd*]], [[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0"]],dnl
|
||||
[[solaris*]],[[command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^@<:@0-9@:>@.*on-line' -c 2>/dev/null` || CPU_COUNT="0"]],dnl
|
||||
[[mingw*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl
|
||||
[[msys*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl
|
||||
[[cygwin*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]]dnl
|
||||
)dnl
|
||||
])dnl
|
||||
|
||||
AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1]],[[: # empty]],[dnl
|
||||
# Try less preferred generic method
|
||||
# 'hw.ncpu' exist on many platforms, but not on GNU/Linux
|
||||
CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0"
|
||||
])dnl
|
||||
|
||||
AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl
|
||||
# Try platform-specific fallback methods
|
||||
# They can be less accurate and slower then preferred methods
|
||||
AS_CASE([[$host_os]],dnl
|
||||
[[*linux*]],[[CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0"]],dnl
|
||||
[[*darwin*]],[[CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0"]],dnl
|
||||
[[freebsd*]],[[CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl
|
||||
[[netbsd*]], [[CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^@<:@0-9@:>@+ .* online ' -c` || \
|
||||
CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl
|
||||
[[solaris*]],[[command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \
|
||||
CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0"]],dnl
|
||||
[[mingw*]],[AS_IF([[CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\@<:@0-9@:>@+$' -c`]],dnl
|
||||
[[: # empty]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]])],dnl
|
||||
[[msys*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]],dnl
|
||||
[[cygwin*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]]dnl
|
||||
)dnl
|
||||
])dnl
|
||||
|
||||
AS_IF([[test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null]],[dnl
|
||||
AC_MSG_RESULT([[$CPU_COUNT]])
|
||||
m4_ifvaln([$1],[$1],)dnl
|
||||
],[dnl
|
||||
m4_ifval([$2],[dnl
|
||||
AS_UNSET([[CPU_COUNT]])
|
||||
AC_MSG_RESULT([[unable to detect]])
|
||||
$2
|
||||
], [dnl
|
||||
CPU_COUNT="1"
|
||||
AC_MSG_RESULT([[unable to detect (assuming 1)]])
|
||||
])dnl
|
||||
])dnl
|
||||
])dnl
|
||||
+45
-3
@@ -162,6 +162,9 @@ dnl #
|
||||
dnl # 3.1 API change,
|
||||
dnl # Check if inode_operations contains the function get_acl
|
||||
dnl #
|
||||
dnl # 5.15 API change,
|
||||
dnl # Added the bool rcu argument to get_acl for rcu path walk.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_get_acl], [
|
||||
#include <linux/fs.h>
|
||||
@@ -174,14 +177,32 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
|
||||
.get_acl = get_acl_fn,
|
||||
};
|
||||
],[])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_get_acl_rcu], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
struct posix_acl *get_acl_fn(struct inode *inode, int type,
|
||||
bool rcu) { return NULL; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.get_acl = get_acl_fn,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
|
||||
AC_MSG_CHECKING([whether iops->get_acl() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([iops->get_acl()])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_get_acl_rcu], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GET_ACL_RCU, 1, [iops->get_acl() takes rcu])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([iops->get_acl()])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -189,7 +210,22 @@ dnl #
|
||||
dnl # 3.14 API change,
|
||||
dnl # Check if inode_operations contains the function set_acl
|
||||
dnl #
|
||||
dnl # 5.12 API change,
|
||||
dnl # set_acl() added a user_namespace* parameter first
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int set_acl_fn(struct user_namespace *userns,
|
||||
struct inode *inode, struct posix_acl *acl,
|
||||
int type) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.set_acl = set_acl_fn,
|
||||
};
|
||||
],[])
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
@@ -205,11 +241,17 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
|
||||
AC_MSG_CHECKING([whether iops->set_acl() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
|
||||
AC_DEFINE(HAVE_SET_ACL_USERNS, 1, [iops->set_acl() takes 4 args])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists, takes 3 args])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
dnl #
|
||||
dnl # 5.12 API change removes BIO_MAX_PAGES in favor of bio_max_segs()
|
||||
dnl # which will handle the logic of setting the upper-bound to a
|
||||
dnl # BIO_MAX_PAGES, internally.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS], [
|
||||
ZFS_LINUX_TEST_SRC([bio_max_segs], [
|
||||
#include <linux/bio.h>
|
||||
],[
|
||||
bio_max_segs(1);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BIO_MAX_SEGS], [
|
||||
AC_MSG_CHECKING([whether bio_max_segs() exists])
|
||||
ZFS_LINUX_TEST_RESULT([bio_max_segs], [
|
||||
AC_MSG_RESULT(yes)
|
||||
|
||||
AC_DEFINE([HAVE_BIO_MAX_SEGS], 1, [bio_max_segs() is implemented])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -48,7 +48,45 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 2.6.32 - 4.x API,
|
||||
dnl # 5.9: added blk_queue_update_readahead(),
|
||||
dnl # 5.15: renamed to disk_update_readahead()
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD], [
|
||||
ZFS_LINUX_TEST_SRC([blk_queue_update_readahead], [
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct request_queue q;
|
||||
blk_queue_update_readahead(&q);
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([disk_update_readahead], [
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct gendisk disk;
|
||||
disk_update_readahead(&disk);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD], [
|
||||
AC_MSG_CHECKING([whether blk_queue_update_readahead() exists])
|
||||
ZFS_LINUX_TEST_RESULT([blk_queue_update_readahead], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_QUEUE_UPDATE_READAHEAD, 1,
|
||||
[blk_queue_update_readahead() exists])
|
||||
],[
|
||||
AC_MSG_CHECKING([whether disk_update_readahead() exists])
|
||||
ZFS_LINUX_TEST_RESULT([disk_update_readahead], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_DISK_UPDATE_READAHEAD, 1,
|
||||
[disk_update_readahead() exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 2.6.32 API,
|
||||
dnl # blk_queue_discard()
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [
|
||||
@@ -280,6 +318,7 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET
|
||||
@@ -292,6 +331,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_PLUG
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_BDI
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_DISCARD
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET
|
||||
|
||||
@@ -52,12 +52,44 @@ AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 5.13 API change
|
||||
dnl # block_device_operations->revalidate_disk() was removed
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [
|
||||
ZFS_LINUX_TEST_SRC([block_device_operations_revalidate_disk], [
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
int blk_revalidate_disk(struct gendisk *disk) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
static const struct block_device_operations
|
||||
bops __attribute__ ((unused)) = {
|
||||
.revalidate_disk = blk_revalidate_disk,
|
||||
};
|
||||
], [], [$NO_UNUSED_BUT_SET_VARIABLE])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [
|
||||
AC_MSG_CHECKING([whether bops->revalidate_disk() exists])
|
||||
ZFS_LINUX_TEST_RESULT([block_device_operations_revalidate_disk], [
|
||||
AC_DEFINE([HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [1],
|
||||
[Define if revalidate_disk() in block_device_operations])
|
||||
AC_MSG_RESULT(yes)
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS], [
|
||||
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
|
||||
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
|
||||
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS], [
|
||||
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
|
||||
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
|
||||
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK
|
||||
])
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
dnl #
|
||||
dnl # 5.12 API
|
||||
dnl #
|
||||
dnl # generic_fillattr in linux/fs.h now requires a struct user_namespace*
|
||||
dnl # as the first arg, to support idmapped mounts.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS], [
|
||||
ZFS_LINUX_TEST_SRC([generic_fillattr_userns], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct user_namespace *userns = NULL;
|
||||
struct inode *in = NULL;
|
||||
struct kstat *k = NULL;
|
||||
generic_fillattr(userns, in, k);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS], [
|
||||
AC_MSG_CHECKING([whether generic_fillattr requres struct user_namespace*])
|
||||
ZFS_LINUX_TEST_RESULT([generic_fillattr_userns], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_GENERIC_FILLATTR_USERNS, 1,
|
||||
[generic_fillattr requires struct user_namespace*])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -1,7 +1,25 @@
|
||||
dnl #
|
||||
dnl # 3.6 API change
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_FLAGS], [
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [
|
||||
dnl #
|
||||
dnl # 5.12 API change that added the struct user_namespace* arg
|
||||
dnl # to the front of this function type's arg list.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([create_userns], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int inode_create(struct user_namespace *userns,
|
||||
struct inode *inode ,struct dentry *dentry,
|
||||
umode_t umode, bool flag) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.create = inode_create,
|
||||
};
|
||||
],[])
|
||||
|
||||
dnl #
|
||||
dnl # 3.6 API change
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([create_flags], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
@@ -16,11 +34,20 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_FLAGS], [
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_CREATE_FLAGS], [
|
||||
AC_MSG_CHECKING([whether iops->create() passes flags])
|
||||
ZFS_LINUX_TEST_RESULT([create_flags], [
|
||||
AC_DEFUN([ZFS_AC_KERNEL_CREATE], [
|
||||
AC_MSG_CHECKING([whether iops->create() takes struct user_namespace*])
|
||||
ZFS_LINUX_TEST_RESULT([create_userns], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOPS_CREATE_USERNS, 1,
|
||||
[iops->create() takes struct user_namespace*])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([iops->create()])
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING([whether iops->create() passes flags])
|
||||
ZFS_LINUX_TEST_RESULT([create_flags], [
|
||||
AC_MSG_RESULT(yes)
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([iops->create()])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -1,8 +1,29 @@
|
||||
dnl #
|
||||
dnl # Linux 4.11 API
|
||||
dnl # See torvalds/linux@a528d35
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
|
||||
dnl #
|
||||
dnl # Linux 5.12 API
|
||||
dnl # The getattr I/O operations handler type was extended to require
|
||||
dnl # a struct user_namespace* as its first arg, to support idmapped
|
||||
dnl # mounts.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_getattr_userns], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int test_getattr(
|
||||
struct user_namespace *userns,
|
||||
const struct path *p, struct kstat *k,
|
||||
u32 request_mask, unsigned int query_flags)
|
||||
{ return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.getattr = test_getattr,
|
||||
};
|
||||
],[])
|
||||
|
||||
dnl #
|
||||
dnl # Linux 4.11 API
|
||||
dnl # See torvalds/linux@a528d35
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_getattr_path], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
@@ -33,21 +54,39 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_INODE_GETATTR], [
|
||||
AC_MSG_CHECKING([whether iops->getattr() takes a path])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [
|
||||
dnl #
|
||||
dnl # Kernel 5.12 test
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether iops->getattr() takes user_namespace])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_getattr_userns], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1,
|
||||
[iops->getattr() takes a path])
|
||||
AC_DEFINE(HAVE_USERNS_IOPS_GETATTR, 1,
|
||||
[iops->getattr() takes struct user_namespace*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [
|
||||
dnl #
|
||||
dnl # Kernel 4.11 test
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether iops->getattr() takes a path])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1,
|
||||
[iops->getattr() takes a vfsmount])
|
||||
AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1,
|
||||
[iops->getattr() takes a path])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
dnl #
|
||||
dnl # Kernel < 4.11 test
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1,
|
||||
[iops->getattr() takes a vfsmount])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -11,13 +11,32 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE], [
|
||||
struct inode *ip = NULL;
|
||||
(void) inode_owner_or_capable(ip);
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([inode_owner_or_capable_idmapped], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct inode *ip = NULL;
|
||||
(void) inode_owner_or_capable(&init_user_ns, ip);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [
|
||||
AC_MSG_CHECKING([whether inode_owner_or_capable() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_owner_or_capable], [
|
||||
AC_MSG_RESULT(yes)
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([capability])
|
||||
AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
|
||||
[inode_owner_or_capable() exists])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING(
|
||||
[whether inode_owner_or_capable() takes user_ns])
|
||||
ZFS_LINUX_TEST_RESULT([inode_owner_or_capable_idmapped], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED, 1,
|
||||
[inode_owner_or_capable() takes user_ns])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([capability])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -42,6 +42,13 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [
|
||||
struct block_device_operations o;
|
||||
o.submit_bio = NULL;
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([blk_alloc_disk], [
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
struct gendisk *disk __attribute__ ((unused));
|
||||
disk = blk_alloc_disk(NUMA_NO_NODE);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [
|
||||
@@ -56,6 +63,19 @@ AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [
|
||||
|
||||
AC_DEFINE(HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS, 1,
|
||||
[submit_bio is member of struct block_device_operations])
|
||||
|
||||
dnl #
|
||||
dnl # Linux 5.14 API Change:
|
||||
dnl # blk_alloc_queue() + alloc_disk() combo replaced by
|
||||
dnl # a single call to blk_alloc_disk().
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether blk_alloc_disk() exists])
|
||||
ZFS_LINUX_TEST_RESULT([blk_alloc_disk], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_BLK_ALLOC_DISK], 1, [blk_alloc_disk() exists])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
dnl #
|
||||
dnl # 3.3 API change
|
||||
dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a
|
||||
dnl # umode_t type rather than an int. The expectation is that any backport
|
||||
dnl # would also change all three prototypes. However, if it turns out that
|
||||
dnl # some distribution doesn't backport the whole thing this could be
|
||||
dnl # broken apart into three separate checks.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int mkdir(struct inode *inode, struct dentry *dentry,
|
||||
umode_t umode) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.mkdir = mkdir,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [
|
||||
AC_MSG_CHECKING([whether iops->create()/mkdir()/mknod() take umode_t])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_MKDIR_UMODE_T, 1,
|
||||
[iops->create()/mkdir()/mknod() take umode_t])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([mkdir()])
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,65 @@
|
||||
dnl #
|
||||
dnl # Supported mkdir() interfaces checked newest to oldest.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [
|
||||
dnl #
|
||||
dnl # 5.12 API change
|
||||
dnl # The struct user_namespace arg was added as the first argument to
|
||||
dnl # mkdir()
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([mkdir_user_namespace], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int mkdir(struct user_namespace *userns,
|
||||
struct inode *inode, struct dentry *dentry,
|
||||
umode_t umode) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.mkdir = mkdir,
|
||||
};
|
||||
],[])
|
||||
|
||||
dnl #
|
||||
dnl # 3.3 API change
|
||||
dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a
|
||||
dnl # umode_t type rather than an int. The expectation is that any backport
|
||||
dnl # would also change all three prototypes. However, if it turns out that
|
||||
dnl # some distribution doesn't backport the whole thing this could be
|
||||
dnl # broken apart into three separate checks.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int mkdir(struct inode *inode, struct dentry *dentry,
|
||||
umode_t umode) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.mkdir = mkdir,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_MKDIR], [
|
||||
dnl #
|
||||
dnl # 5.12 API change
|
||||
dnl # The struct user_namespace arg was added as the first argument to
|
||||
dnl # mkdir() of the iops structure.
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether iops->mkdir() takes struct user_namespace*])
|
||||
ZFS_LINUX_TEST_RESULT([mkdir_user_namespace], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1,
|
||||
[iops->mkdir() takes struct user_namespace*])
|
||||
],[
|
||||
AC_MSG_CHECKING([whether iops->mkdir() takes umode_t])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_MKDIR_UMODE_T, 1,
|
||||
[iops->mkdir() takes umode_t])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([mkdir()])
|
||||
])
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,30 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_MKNOD], [
|
||||
dnl #
|
||||
dnl # 5.12 API change that added the struct user_namespace* arg
|
||||
dnl # to the front of this function type's arg list.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([mknod_userns], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int tmp_mknod(struct user_namespace *userns,
|
||||
struct inode *inode ,struct dentry *dentry,
|
||||
umode_t u, dev_t d) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.mknod = tmp_mknod,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_MKNOD], [
|
||||
AC_MSG_CHECKING([whether iops->mknod() takes struct user_namespace*])
|
||||
ZFS_LINUX_TEST_RESULT([mknod_userns], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOPS_MKNOD_USERNS, 1,
|
||||
[iops->mknod() takes struct user_namespace*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
+38
-12
@@ -1,10 +1,10 @@
|
||||
dnl #
|
||||
dnl # 4.9 API change,
|
||||
dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants
|
||||
dnl # flags.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_rename], [
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [
|
||||
dnl #
|
||||
dnl # 4.9 API change,
|
||||
dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants
|
||||
dnl # flags.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_rename_flags], [
|
||||
#include <linux/fs.h>
|
||||
int rename_fn(struct inode *sip, struct dentry *sdp,
|
||||
struct inode *tip, struct dentry *tdp,
|
||||
@@ -15,15 +15,41 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS], [
|
||||
.rename = rename_fn,
|
||||
};
|
||||
],[])
|
||||
|
||||
dnl #
|
||||
dnl # 5.12 API change,
|
||||
dnl #
|
||||
dnl # Linux 5.12 introduced passing struct user_namespace* as the first argument
|
||||
dnl # of the rename() and other inode_operations members.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_rename_userns], [
|
||||
#include <linux/fs.h>
|
||||
int rename_fn(struct user_namespace *user_ns, struct inode *sip,
|
||||
struct dentry *sdp, struct inode *tip, struct dentry *tdp,
|
||||
unsigned int flags) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.rename = rename_fn,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_RENAME_WANTS_FLAGS], [
|
||||
AC_MSG_CHECKING([whether iops->rename() wants flags])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_rename], [
|
||||
AC_DEFUN([ZFS_AC_KERNEL_RENAME], [
|
||||
AC_MSG_CHECKING([whether iops->rename() takes struct user_namespace*])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_rename_userns], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1,
|
||||
[iops->rename() wants flags])
|
||||
AC_DEFINE(HAVE_IOPS_RENAME_USERNS, 1,
|
||||
[iops->rename() takes struct user_namespace*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_rename_flags], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1,
|
||||
[iops->rename() wants flags])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -1,27 +1,52 @@
|
||||
dnl #
|
||||
dnl # 4.9 API change
|
||||
dnl # The inode_change_ok() function has been renamed setattr_prepare()
|
||||
dnl # and updated to take a dentry rather than an inode.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SETATTR_PREPARE], [
|
||||
dnl #
|
||||
dnl # 4.9 API change
|
||||
dnl # The inode_change_ok() function has been renamed setattr_prepare()
|
||||
dnl # and updated to take a dentry rather than an inode.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([setattr_prepare], [
|
||||
#include <linux/fs.h>
|
||||
], [
|
||||
struct dentry *dentry = NULL;
|
||||
struct iattr *attr = NULL;
|
||||
int error __attribute__ ((unused)) =
|
||||
setattr_prepare(dentry, attr);
|
||||
setattr_prepare(dentry, attr);
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 5.12 API change
|
||||
dnl # The setattr_prepare() function has been changed to accept a new argument
|
||||
dnl # for struct user_namespace*
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([setattr_prepare_userns], [
|
||||
#include <linux/fs.h>
|
||||
], [
|
||||
struct dentry *dentry = NULL;
|
||||
struct iattr *attr = NULL;
|
||||
struct user_namespace *userns = NULL;
|
||||
int error __attribute__ ((unused)) =
|
||||
setattr_prepare(userns, dentry, attr);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SETATTR_PREPARE], [
|
||||
AC_MSG_CHECKING([whether setattr_prepare() is available])
|
||||
ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare],
|
||||
AC_MSG_CHECKING([whether setattr_prepare() is available and accepts struct user_namespace*])
|
||||
ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare_userns],
|
||||
[setattr_prepare], [fs/attr.c], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SETATTR_PREPARE, 1,
|
||||
[setattr_prepare() is available])
|
||||
AC_DEFINE(HAVE_SETATTR_PREPARE_USERNS, 1,
|
||||
[setattr_prepare() accepts user_namespace])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING([whether setattr_prepare() is available, doesn't accept user_namespace])
|
||||
ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare],
|
||||
[setattr_prepare], [fs/attr.c], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SETATTR_PREPARE_NO_USERNS, 1,
|
||||
[setattr_prepare() is available, doesn't accept user_namespace])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
dnl #
|
||||
dnl # 4.20 API change
|
||||
dnl # Added kernel_siginfo_t
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SIGINFO], [
|
||||
ZFS_LINUX_TEST_SRC([siginfo], [
|
||||
#include <linux/signal_types.h>
|
||||
],[
|
||||
kernel_siginfo_t info __attribute__ ((unused));
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SIGINFO], [
|
||||
AC_MSG_CHECKING([whether kernel_siginfo_t tyepedef exists])
|
||||
ZFS_LINUX_TEST_RESULT([siginfo], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SIGINFO, 1, [kernel_siginfo_t exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,21 @@
|
||||
dnl #
|
||||
dnl # 4.4 API change
|
||||
dnl # Added kernel_signal_stop
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SIGNAL_STOP], [
|
||||
ZFS_LINUX_TEST_SRC([signal_stop], [
|
||||
#include <linux/sched/signal.h>
|
||||
],[
|
||||
kernel_signal_stop();
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SIGNAL_STOP], [
|
||||
AC_MSG_CHECKING([whether signal_stop() exists])
|
||||
ZFS_LINUX_TEST_RESULT([signal_stop], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SIGNAL_STOP, 1, [signal_stop() exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,21 @@
|
||||
dnl #
|
||||
dnl # 4.17 API change
|
||||
dnl # Added set_special_state() function
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_SPECIAL_STATE], [
|
||||
ZFS_LINUX_TEST_SRC([set_special_state], [
|
||||
#include <linux/sched.h>
|
||||
],[
|
||||
set_special_state(TASK_STOPPED);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SET_SPECIAL_STATE], [
|
||||
AC_MSG_CHECKING([whether set_special_state() exists])
|
||||
ZFS_LINUX_TEST_RESULT([set_special_state], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SET_SPECIAL_STATE, 1, [set_special_state() exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,32 @@
|
||||
dnl #
|
||||
dnl # Linux 5.15 gets rid of -isystem and external <stdarg.h> inclusion
|
||||
dnl # and ships its own <linux/stdarg.h>. Check if this header file does
|
||||
dnl # exist and provide all necessary definitions for variable argument
|
||||
dnl # functions. Adjust the inclusion of <stdarg.h> according to the
|
||||
dnl # results.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG], [
|
||||
ZFS_LINUX_TEST_SRC([has_standalone_linux_stdarg], [
|
||||
#include <linux/stdarg.h>
|
||||
|
||||
#if !defined(va_start) || !defined(va_end) || \
|
||||
!defined(va_arg) || !defined(va_copy)
|
||||
#error "<linux/stdarg.h> is invalid"
|
||||
#endif
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG], [
|
||||
dnl #
|
||||
dnl # Linux 5.15 ships its own stdarg.h and doesn't allow to
|
||||
dnl # include compiler headers.
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether standalone <linux/stdarg.h> exists])
|
||||
ZFS_LINUX_TEST_RESULT([has_standalone_linux_stdarg], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_STANDALONE_LINUX_STDARG, 1,
|
||||
[standalone <linux/stdarg.h> exists])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,30 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SYMLINK], [
|
||||
dnl #
|
||||
dnl # 5.12 API change that added the struct user_namespace* arg
|
||||
dnl # to the front of this function type's arg list.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([symlink_userns], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int tmp_symlink(struct user_namespace *userns,
|
||||
struct inode *inode ,struct dentry *dentry,
|
||||
const char *path) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.symlink = tmp_symlink,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SYMLINK], [
|
||||
AC_MSG_CHECKING([whether iops->symlink() takes struct user_namespace*])
|
||||
ZFS_LINUX_TEST_RESULT([symlink_userns], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOPS_SYMLINK_USERNS, 1,
|
||||
[iops->symlink() takes struct user_namespace*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -3,23 +3,43 @@ dnl # 3.11 API change
|
||||
dnl # Add support for i_op->tmpfile
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_TMPFILE], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
|
||||
dnl #
|
||||
dnl # 5.11 API change
|
||||
dnl # add support for userns parameter to tmpfile
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_userns], [
|
||||
#include <linux/fs.h>
|
||||
int tmpfile(struct inode *inode, struct dentry *dentry,
|
||||
int tmpfile(struct user_namespace *userns,
|
||||
struct inode *inode, struct dentry *dentry,
|
||||
umode_t mode) { return 0; }
|
||||
static struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.tmpfile = tmpfile,
|
||||
};
|
||||
],[])
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
|
||||
#include <linux/fs.h>
|
||||
int tmpfile(struct inode *inode, struct dentry *dentry,
|
||||
umode_t mode) { return 0; }
|
||||
static struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.tmpfile = tmpfile,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_TMPFILE], [
|
||||
AC_MSG_CHECKING([whether i_op->tmpfile() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_userns], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
|
||||
AC_DEFINE(HAVE_TMPFILE_USERNS, 1, [i_op->tmpfile() has userns])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
dnl #
|
||||
dnl # Linux 5.14 adds a change to require set_page_dirty to be manually
|
||||
dnl # wired up in struct address_space_operations. Determine if this needs
|
||||
dnl # to be done. This patch set also introduced __set_page_dirty_nobuffers
|
||||
dnl # declaration in linux/pagemap.h, so these tests look for the presence
|
||||
dnl # of that function to tell the compiler to assign set_page_dirty in
|
||||
dnl # module/os/linux/zfs/zpl_file.c
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS], [
|
||||
ZFS_LINUX_TEST_SRC([vfs_has_set_page_dirty_nobuffers], [
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/fs.h>
|
||||
|
||||
static const struct address_space_operations
|
||||
aops __attribute__ ((unused)) = {
|
||||
.set_page_dirty = __set_page_dirty_nobuffers,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS], [
|
||||
dnl #
|
||||
dnl # Linux 5.14 change requires set_page_dirty() to be assigned
|
||||
dnl # in address_space_operations()
|
||||
dnl #
|
||||
AC_MSG_CHECKING([__set_page_dirty_nobuffers exists])
|
||||
ZFS_LINUX_TEST_RESULT([vfs_has_set_page_dirty_nobuffers], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS, 1,
|
||||
[__set_page_dirty_nobuffers exists])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
@@ -152,6 +152,21 @@ dnl #
|
||||
dnl # Supported xattr handler set() interfaces checked newest to oldest.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_set_userns], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
int set(const struct xattr_handler *handler,
|
||||
struct user_namespace *mnt_userns,
|
||||
struct dentry *dentry, struct inode *inode,
|
||||
const char *name, const void *buffer,
|
||||
size_t size, int flags)
|
||||
{ return 0; }
|
||||
static const struct xattr_handler
|
||||
xops __attribute__ ((unused)) = {
|
||||
.set = set,
|
||||
};
|
||||
],[])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
@@ -194,45 +209,58 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
|
||||
dnl #
|
||||
dnl # 4.7 API change,
|
||||
dnl # The xattr_handler->set() callback was changed to take both
|
||||
dnl # dentry and inode.
|
||||
dnl # 5.12 API change,
|
||||
dnl # The xattr_handler->set() callback was changed to 8 arguments, and
|
||||
dnl # struct user_namespace* was inserted as arg #2
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode])
|
||||
ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [
|
||||
AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and user_namespace])
|
||||
ZFS_LINUX_TEST_RESULT([xattr_handler_set_userns], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
|
||||
[xattr_handler->set() wants both dentry and inode])
|
||||
AC_DEFINE(HAVE_XATTR_SET_USERNS, 1,
|
||||
[xattr_handler->set() takes user_namespace])
|
||||
],[
|
||||
dnl #
|
||||
dnl # 4.4 API change,
|
||||
dnl # The xattr_handler->set() callback was changed to take a
|
||||
dnl # xattr_handler, and handler_flags argument was removed and
|
||||
dnl # should be accessed by handler->flags.
|
||||
dnl # 4.7 API change,
|
||||
dnl # The xattr_handler->set() callback was changed to take both
|
||||
dnl # dentry and inode.
|
||||
dnl #
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(
|
||||
[whether xattr_handler->set() wants xattr_handler])
|
||||
ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [
|
||||
AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode])
|
||||
ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
|
||||
[xattr_handler->set() wants xattr_handler])
|
||||
AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
|
||||
[xattr_handler->set() wants both dentry and inode])
|
||||
],[
|
||||
dnl #
|
||||
dnl # 2.6.33 API change,
|
||||
dnl # The xattr_handler->set() callback was changed
|
||||
dnl # to take a dentry instead of an inode, and a
|
||||
dnl # handler_flags argument was added.
|
||||
dnl # 4.4 API change,
|
||||
dnl # The xattr_handler->set() callback was changed to take a
|
||||
dnl # xattr_handler, and handler_flags argument was removed and
|
||||
dnl # should be accessed by handler->flags.
|
||||
dnl #
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(
|
||||
[whether xattr_handler->set() wants dentry])
|
||||
ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [
|
||||
[whether xattr_handler->set() wants xattr_handler])
|
||||
ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
|
||||
[xattr_handler->set() wants dentry])
|
||||
AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
|
||||
[xattr_handler->set() wants xattr_handler])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([xattr set()])
|
||||
dnl #
|
||||
dnl # 2.6.33 API change,
|
||||
dnl # The xattr_handler->set() callback was changed
|
||||
dnl # to take a dentry instead of an inode, and a
|
||||
dnl # handler_flags argument was added.
|
||||
dnl #
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(
|
||||
[whether xattr_handler->set() wants dentry])
|
||||
ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
|
||||
[xattr_handler->set() wants dentry])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([xattr set()])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
+24
-6
@@ -79,9 +79,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_EVICT_INODE
|
||||
ZFS_AC_KERNEL_SRC_DIRTY_INODE
|
||||
ZFS_AC_KERNEL_SRC_SHRINKER
|
||||
ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T
|
||||
ZFS_AC_KERNEL_SRC_MKDIR
|
||||
ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS
|
||||
ZFS_AC_KERNEL_SRC_CREATE_FLAGS
|
||||
ZFS_AC_KERNEL_SRC_CREATE
|
||||
ZFS_AC_KERNEL_SRC_GET_LINK
|
||||
ZFS_AC_KERNEL_SRC_PUT_LINK
|
||||
ZFS_AC_KERNEL_SRC_TMPFILE
|
||||
@@ -115,7 +115,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_KUIDGID_T
|
||||
ZFS_AC_KERNEL_SRC_KUID_HELPERS
|
||||
ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST
|
||||
ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS
|
||||
ZFS_AC_KERNEL_SRC_RENAME
|
||||
ZFS_AC_KERNEL_SRC_CURRENT_TIME
|
||||
ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES
|
||||
ZFS_AC_KERNEL_SRC_IN_COMPAT_SYSCALL
|
||||
@@ -124,6 +124,15 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_TOTALHIGH_PAGES
|
||||
ZFS_AC_KERNEL_SRC_KSTRTOUL
|
||||
ZFS_AC_KERNEL_SRC_PERCPU
|
||||
ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS
|
||||
ZFS_AC_KERNEL_SRC_MKNOD
|
||||
ZFS_AC_KERNEL_SRC_SYMLINK
|
||||
ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS
|
||||
ZFS_AC_KERNEL_SRC_SIGNAL_STOP
|
||||
ZFS_AC_KERNEL_SRC_SIGINFO
|
||||
ZFS_AC_KERNEL_SRC_SET_SPECIAL_STATE
|
||||
ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS
|
||||
ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG
|
||||
|
||||
AC_MSG_CHECKING([for available kernel interfaces])
|
||||
ZFS_LINUX_TEST_COMPILE_ALL([kabi])
|
||||
@@ -176,9 +185,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_EVICT_INODE
|
||||
ZFS_AC_KERNEL_DIRTY_INODE
|
||||
ZFS_AC_KERNEL_SHRINKER
|
||||
ZFS_AC_KERNEL_MKDIR_UMODE_T
|
||||
ZFS_AC_KERNEL_MKDIR
|
||||
ZFS_AC_KERNEL_LOOKUP_FLAGS
|
||||
ZFS_AC_KERNEL_CREATE_FLAGS
|
||||
ZFS_AC_KERNEL_CREATE
|
||||
ZFS_AC_KERNEL_GET_LINK
|
||||
ZFS_AC_KERNEL_PUT_LINK
|
||||
ZFS_AC_KERNEL_TMPFILE
|
||||
@@ -212,7 +221,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_KUIDGID_T
|
||||
ZFS_AC_KERNEL_KUID_HELPERS
|
||||
ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
|
||||
ZFS_AC_KERNEL_RENAME_WANTS_FLAGS
|
||||
ZFS_AC_KERNEL_RENAME
|
||||
ZFS_AC_KERNEL_CURRENT_TIME
|
||||
ZFS_AC_KERNEL_USERNS_CAPABILITIES
|
||||
ZFS_AC_KERNEL_IN_COMPAT_SYSCALL
|
||||
@@ -221,6 +230,15 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_TOTALHIGH_PAGES
|
||||
ZFS_AC_KERNEL_KSTRTOUL
|
||||
ZFS_AC_KERNEL_PERCPU
|
||||
ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS
|
||||
ZFS_AC_KERNEL_MKNOD
|
||||
ZFS_AC_KERNEL_SYMLINK
|
||||
ZFS_AC_KERNEL_BIO_MAX_SEGS
|
||||
ZFS_AC_KERNEL_SIGNAL_STOP
|
||||
ZFS_AC_KERNEL_SIGINFO
|
||||
ZFS_AC_KERNEL_SET_SPECIAL_STATE
|
||||
ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS
|
||||
ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG
|
||||
])
|
||||
|
||||
dnl #
|
||||
|
||||
+6
-4
@@ -153,6 +153,9 @@ AC_DEFUN([ZFS_AC_DEBUG_KMEM_TRACKING], [
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
|
||||
AX_COUNT_CPUS([])
|
||||
AC_SUBST(CPU_COUNT)
|
||||
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_UNUSED_BUT_SET_VARIABLE
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_BOOL_COMPARE
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN
|
||||
@@ -167,6 +170,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
|
||||
ZFS_AC_CONFIG_ALWAYS_PYTHON
|
||||
ZFS_AC_CONFIG_ALWAYS_PYZFS
|
||||
ZFS_AC_CONFIG_ALWAYS_SED
|
||||
ZFS_AC_CONFIG_ALWAYS_CPPCHECK
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_CONFIG], [
|
||||
@@ -191,12 +195,10 @@ AC_DEFUN([ZFS_AC_CONFIG], [
|
||||
|
||||
ZFS_AC_CONFIG_ALWAYS
|
||||
|
||||
|
||||
AM_COND_IF([BUILD_LINUX], [
|
||||
AC_ARG_VAR([TEST_JOBS],
|
||||
[simultaneous jobs during configure (defaults to $(nproc))])
|
||||
AC_ARG_VAR([TEST_JOBS], [simultaneous jobs during configure])
|
||||
if test "x$ac_cv_env_TEST_JOBS_set" != "xset"; then
|
||||
TEST_JOBS=$(nproc)
|
||||
TEST_JOBS=$CPU_COUNT
|
||||
fi
|
||||
AC_SUBST(TEST_JOBS)
|
||||
])
|
||||
|
||||
@@ -237,6 +237,7 @@ AC_CONFIG_FILES([
|
||||
tests/zfs-tests/tests/Makefile
|
||||
tests/zfs-tests/tests/functional/Makefile
|
||||
tests/zfs-tests/tests/functional/acl/Makefile
|
||||
tests/zfs-tests/tests/functional/acl/off/Makefile
|
||||
tests/zfs-tests/tests/functional/acl/posix/Makefile
|
||||
tests/zfs-tests/tests/functional/acl/posix-sa/Makefile
|
||||
tests/zfs-tests/tests/functional/alloc_class/Makefile
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
preprocessorErrorDirective:./module/zfs/vdev_raidz_math_avx512f.c:243
|
||||
preprocessorErrorDirective:./module/zfs/vdev_raidz_math_sse2.c:266
|
||||
uninitvar:module/os/freebsd/zfs/vdev_geom.c
|
||||
uninitvar:module/os/freebsd/zfs/zfs_vfsops.c
|
||||
uninitvar:module/os/freebsd/spl/spl_zone.c
|
||||
uninitvar:lib/libzutil/os/freebsd/zutil_import_os.c
|
||||
*:module/zstd/lib/zstd.c
|
||||
*:module/zstd/lib/zstd.h
|
||||
@@ -4,6 +4,7 @@ KERNEL_H = \
|
||||
atomic.h \
|
||||
byteorder.h \
|
||||
callb.h \
|
||||
ccompat.h \
|
||||
ccompile.h \
|
||||
cmn_err.h \
|
||||
condvar.h \
|
||||
@@ -18,9 +19,11 @@ KERNEL_H = \
|
||||
fcntl.h \
|
||||
file.h \
|
||||
freebsd_rwlock.h \
|
||||
idmap.h \
|
||||
inttypes.h \
|
||||
isa_defs.h \
|
||||
kmem_cache.h \
|
||||
kidmap.h \
|
||||
kmem.h \
|
||||
kstat.h \
|
||||
list_impl.h \
|
||||
|
||||
@@ -68,65 +68,65 @@ void spl_dumpstack(void);
|
||||
#define PANIC(fmt, a...) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a)
|
||||
|
||||
#define VERIFY(cond) \
|
||||
(void) (unlikely(!(cond)) && \
|
||||
#define VERIFY(cond) \
|
||||
(void) (unlikely(!(cond)) && \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"%s", "VERIFY(" #cond ") failed\n"))
|
||||
|
||||
#define VERIFY3B(LEFT, OP, RIGHT) do { \
|
||||
boolean_t _verify3_left = (boolean_t)(LEFT); \
|
||||
boolean_t _verify3_right = (boolean_t)(RIGHT); \
|
||||
if (!(_verify3_left OP _verify3_right)) \
|
||||
#define VERIFY3B(LEFT, OP, RIGHT) do { \
|
||||
const boolean_t _verify3_left = (boolean_t)(LEFT); \
|
||||
const boolean_t _verify3_right = (boolean_t)(RIGHT);\
|
||||
if (unlikely(!(_verify3_left OP _verify3_right))) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
|
||||
"failed (%d " #OP " %d)\n", \
|
||||
(boolean_t) (_verify3_left), \
|
||||
(boolean_t) (_verify3_right)); \
|
||||
"failed (%d " #OP " %d)\n", \
|
||||
(boolean_t) (_verify3_left), \
|
||||
(boolean_t) (_verify3_right)); \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY3S(LEFT, OP, RIGHT) do { \
|
||||
int64_t _verify3_left = (int64_t)(LEFT); \
|
||||
int64_t _verify3_right = (int64_t)(RIGHT); \
|
||||
if (!(_verify3_left OP _verify3_right)) \
|
||||
#define VERIFY3S(LEFT, OP, RIGHT) do { \
|
||||
const int64_t _verify3_left = (int64_t)(LEFT); \
|
||||
const int64_t _verify3_right = (int64_t)(RIGHT); \
|
||||
if (unlikely(!(_verify3_left OP _verify3_right))) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
|
||||
"failed (%lld " #OP " %lld)\n", \
|
||||
(long long) (_verify3_left), \
|
||||
(long long) (_verify3_right)); \
|
||||
"failed (%lld " #OP " %lld)\n", \
|
||||
(long long) (_verify3_left), \
|
||||
(long long) (_verify3_right)); \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY3U(LEFT, OP, RIGHT) do { \
|
||||
uint64_t _verify3_left = (uint64_t)(LEFT); \
|
||||
uint64_t _verify3_right = (uint64_t)(RIGHT); \
|
||||
if (!(_verify3_left OP _verify3_right)) \
|
||||
#define VERIFY3U(LEFT, OP, RIGHT) do { \
|
||||
const uint64_t _verify3_left = (uint64_t)(LEFT); \
|
||||
const uint64_t _verify3_right = (uint64_t)(RIGHT); \
|
||||
if (unlikely(!(_verify3_left OP _verify3_right))) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
|
||||
"failed (%llu " #OP " %llu)\n", \
|
||||
(unsigned long long) (_verify3_left), \
|
||||
(unsigned long long) (_verify3_right)); \
|
||||
"failed (%llu " #OP " %llu)\n", \
|
||||
(unsigned long long) (_verify3_left), \
|
||||
(unsigned long long) (_verify3_right)); \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY3P(LEFT, OP, RIGHT) do { \
|
||||
uintptr_t _verify3_left = (uintptr_t)(LEFT); \
|
||||
uintptr_t _verify3_right = (uintptr_t)(RIGHT); \
|
||||
if (!(_verify3_left OP _verify3_right)) \
|
||||
#define VERIFY3P(LEFT, OP, RIGHT) do { \
|
||||
const uintptr_t _verify3_left = (uintptr_t)(LEFT); \
|
||||
const uintptr_t _verify3_right = (uintptr_t)(RIGHT);\
|
||||
if (unlikely(!(_verify3_left OP _verify3_right))) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
|
||||
"failed (%px " #OP " %px)\n", \
|
||||
(void *) (_verify3_left), \
|
||||
(void *) (_verify3_right)); \
|
||||
"failed (%px " #OP " %px)\n", \
|
||||
(void *) (_verify3_left), \
|
||||
(void *) (_verify3_right)); \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY0(RIGHT) do { \
|
||||
int64_t _verify3_left = (int64_t)(0); \
|
||||
int64_t _verify3_right = (int64_t)(RIGHT); \
|
||||
if (!(_verify3_left == _verify3_right)) \
|
||||
#define VERIFY0(RIGHT) do { \
|
||||
const int64_t _verify3_left = (int64_t)(0); \
|
||||
const int64_t _verify3_right = (int64_t)(RIGHT); \
|
||||
if (unlikely(!(_verify3_left == _verify3_right))) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(0 == " #RIGHT ") " \
|
||||
"failed (0 == %lld)\n", \
|
||||
(long long) (_verify3_right)); \
|
||||
"VERIFY3(0 == " #RIGHT ") " \
|
||||
"failed (0 == %lld)\n", \
|
||||
(long long) (_verify3_right)); \
|
||||
} while (0)
|
||||
#define CTASSERT_GLOBAL(x) CTASSERT(x)
|
||||
#define CTASSERT_GLOBAL(x) CTASSERT(x)
|
||||
|
||||
/*
|
||||
* Debugging disabled (--disable-debug)
|
||||
@@ -154,11 +154,11 @@ void spl_dumpstack(void);
|
||||
#define ASSERT0 VERIFY0
|
||||
#define ASSERT VERIFY
|
||||
#define IMPLY(A, B) \
|
||||
((void)(((!(A)) || (B)) || \
|
||||
((void)(likely((!(A)) || (B)) || \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"(" #A ") implies (" #B ")")))
|
||||
#define EQUIV(A, B) \
|
||||
((void)((!!(A) == !!(B)) || \
|
||||
((void)(likely(!!(A) == !!(B)) || \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"(" #A ") is equivalent to (" #B ")")))
|
||||
/* END CSTYLED */
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#define _OPENSOLARIS_SYS_MISC_H_
|
||||
|
||||
#include <sys/limits.h>
|
||||
#include <sys/filio.h>
|
||||
|
||||
#define MAXUID UID_MAX
|
||||
|
||||
@@ -40,8 +41,8 @@
|
||||
#define _FIOGDIO (INT_MIN+1)
|
||||
#define _FIOSDIO (INT_MIN+2)
|
||||
|
||||
#define _FIO_SEEK_DATA FIOSEEKDATA
|
||||
#define _FIO_SEEK_HOLE FIOSEEKHOLE
|
||||
#define F_SEEK_DATA FIOSEEKDATA
|
||||
#define F_SEEK_HOLE FIOSEEKHOLE
|
||||
|
||||
struct opensolaris_utsname {
|
||||
char *sysname;
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
#ifndef _SYS_FS_ZFS_VFSOPS_H
|
||||
#define _SYS_FS_ZFS_VFSOPS_H
|
||||
|
||||
#if __FreeBSD_version >= 1300125
|
||||
#define TEARDOWN_RMS
|
||||
#endif
|
||||
|
||||
#if __FreeBSD_version >= 1300109
|
||||
#define TEARDOWN_INACTIVE_RMS
|
||||
#endif
|
||||
@@ -46,10 +50,16 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef TEARDOWN_INACTIVE_RMS
|
||||
#ifdef TEARDOWN_RMS
|
||||
typedef struct rmslock zfs_teardown_lock_t;
|
||||
#else
|
||||
#define zfs_teardown_lock_t krwlock_t
|
||||
#define zfs_teardown_lock_t rrmlock_t
|
||||
#endif
|
||||
|
||||
#ifdef TEARDOWN_INACTIVE_RMS
|
||||
typedef struct rmslock zfs_teardown_inactive_lock_t;
|
||||
#else
|
||||
#define zfs_teardown_inactive_lock_t krwlock_t
|
||||
#endif
|
||||
|
||||
typedef struct zfsvfs zfsvfs_t;
|
||||
@@ -80,8 +90,8 @@ struct zfsvfs {
|
||||
int z_norm; /* normalization flags */
|
||||
boolean_t z_atime; /* enable atimes mount option */
|
||||
boolean_t z_unmounted; /* unmounted */
|
||||
rrmlock_t z_teardown_lock;
|
||||
zfs_teardown_lock_t z_teardown_inactive_lock;
|
||||
zfs_teardown_lock_t z_teardown_lock;
|
||||
zfs_teardown_inactive_lock_t z_teardown_inactive_lock;
|
||||
list_t z_all_znodes; /* all vnodes in the fs */
|
||||
uint64_t z_nr_znodes; /* number of znodes in the fs */
|
||||
kmutex_t z_znodes_lock; /* lock for z_all_znodes */
|
||||
@@ -112,53 +122,121 @@ struct zfsvfs {
|
||||
struct task z_unlinked_drain_task;
|
||||
};
|
||||
|
||||
#ifdef TEARDOWN_RMS
|
||||
#define ZFS_TEARDOWN_INIT(zfsvfs) \
|
||||
rms_init(&(zfsvfs)->z_teardown_lock, "zfs teardown")
|
||||
|
||||
#define ZFS_TEARDOWN_DESTROY(zfsvfs) \
|
||||
rms_destroy(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \
|
||||
rms_try_rlock(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_ENTER_READ(zfsvfs, tag) \
|
||||
rms_rlock(&(zfsvfs)->z_teardown_lock);
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \
|
||||
rms_runlock(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \
|
||||
rms_wlock(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \
|
||||
rms_wunlock(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT(zfsvfs, tag) \
|
||||
rms_unlock(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_READ_HELD(zfsvfs) \
|
||||
rms_rowned(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_WRITE_HELD(zfsvfs) \
|
||||
rms_wowned(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_HELD(zfsvfs) \
|
||||
rms_owned_any(&(zfsvfs)->z_teardown_lock)
|
||||
#else
|
||||
#define ZFS_TEARDOWN_INIT(zfsvfs) \
|
||||
rrm_init(&(zfsvfs)->z_teardown_lock, B_FALSE)
|
||||
|
||||
#define ZFS_TEARDOWN_DESTROY(zfsvfs) \
|
||||
rrm_destroy(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \
|
||||
rw_tryenter(&(zfsvfs)->z_teardown_lock, RW_READER)
|
||||
|
||||
#define ZFS_TEARDOWN_ENTER_READ(zfsvfs, tag) \
|
||||
rrm_enter_read(&(zfsvfs)->z_teardown_lock, tag);
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \
|
||||
rrm_enter(&(zfsvfs)->z_teardown_lock, RW_WRITER, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT(zfsvfs, tag) \
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_READ_HELD(zfsvfs) \
|
||||
RRM_READ_HELD(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_WRITE_HELD(zfsvfs) \
|
||||
RRM_WRITE_HELD(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_HELD(zfsvfs) \
|
||||
RRM_LOCK_HELD(&(zfsvfs)->z_teardown_lock)
|
||||
#endif
|
||||
|
||||
#ifdef TEARDOWN_INACTIVE_RMS
|
||||
#define ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \
|
||||
rms_init(&(zfsvfs)->z_teardown_inactive_lock, "zfs teardown inactive")
|
||||
|
||||
#define ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs) \
|
||||
rms_destroy(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs) \
|
||||
rms_try_rlock(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs) \
|
||||
rms_rlock(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs) \
|
||||
rms_runlock(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs) \
|
||||
rms_wlock(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs) \
|
||||
rms_wunlock(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs) \
|
||||
rms_wowned(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
#else
|
||||
#define ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \
|
||||
rw_init(&(zfsvfs)->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL)
|
||||
|
||||
#define ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs) \
|
||||
rw_destroy(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs) \
|
||||
rw_tryenter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER)
|
||||
|
||||
#define ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs) \
|
||||
rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER)
|
||||
|
||||
#define ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs) \
|
||||
rw_exit(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs) \
|
||||
rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_WRITER)
|
||||
|
||||
#define ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs) \
|
||||
rw_exit(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs) \
|
||||
RW_WRITE_HELD(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -122,19 +122,19 @@ extern minor_t zfsdev_minor_alloc(void);
|
||||
/* Called on entry to each ZFS vnode and vfs operation */
|
||||
#define ZFS_ENTER(zfsvfs) \
|
||||
{ \
|
||||
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
|
||||
if ((zfsvfs)->z_unmounted) { \
|
||||
ZFS_EXIT(zfsvfs); \
|
||||
ZFS_TEARDOWN_ENTER_READ((zfsvfs), FTAG); \
|
||||
if (__predict_false((zfsvfs)->z_unmounted)) { \
|
||||
ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \
|
||||
return (EIO); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Must be called before exiting the vop */
|
||||
#define ZFS_EXIT(zfsvfs) rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG)
|
||||
#define ZFS_EXIT(zfsvfs) ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG)
|
||||
|
||||
/* Verifies the znode is valid */
|
||||
#define ZFS_VERIFY_ZP(zp) \
|
||||
if ((zp)->z_sa_hdl == NULL) { \
|
||||
if (__predict_false((zp)->z_sa_hdl == NULL)) { \
|
||||
ZFS_EXIT((zp)->z_zfsvfs); \
|
||||
return (EIO); \
|
||||
} \
|
||||
@@ -173,7 +173,6 @@ extern void zfs_tstamp_update_setup_ext(struct znode *,
|
||||
uint_t, uint64_t [2], uint64_t [2], boolean_t have_tx);
|
||||
extern void zfs_znode_free(struct znode *);
|
||||
|
||||
extern zil_get_data_t zfs_get_data;
|
||||
extern zil_replay_func_t *zfs_replay_vector[TX_MAX_TYPE];
|
||||
extern int zfsfstype;
|
||||
|
||||
|
||||
@@ -92,11 +92,14 @@ blk_queue_set_write_cache(struct request_queue *q, bool wc, bool fua)
|
||||
static inline void
|
||||
blk_queue_set_read_ahead(struct request_queue *q, unsigned long ra_pages)
|
||||
{
|
||||
#if !defined(HAVE_BLK_QUEUE_UPDATE_READAHEAD) && \
|
||||
!defined(HAVE_DISK_UPDATE_READAHEAD)
|
||||
#ifdef HAVE_BLK_QUEUE_BDI_DYNAMIC
|
||||
q->backing_dev_info->ra_pages = ra_pages;
|
||||
#else
|
||||
q->backing_dev_info.ra_pages = ra_pages;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_BIO_BVEC_ITER
|
||||
@@ -277,18 +280,22 @@ bio_set_bi_error(struct bio *bio, int error)
|
||||
static inline int
|
||||
zfs_check_media_change(struct block_device *bdev)
|
||||
{
|
||||
#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK
|
||||
struct gendisk *gd = bdev->bd_disk;
|
||||
const struct block_device_operations *bdo = gd->fops;
|
||||
#endif
|
||||
|
||||
if (!bdev_check_media_change(bdev))
|
||||
return (0);
|
||||
|
||||
#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK
|
||||
/*
|
||||
* Force revalidation, to mimic the old behavior of
|
||||
* check_disk_change()
|
||||
*/
|
||||
if (bdo->revalidate_disk)
|
||||
bdo->revalidate_disk(gd);
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -343,7 +343,8 @@ static inline void zfs_gid_write(struct inode *ip, gid_t gid)
|
||||
/*
|
||||
* 4.9 API change
|
||||
*/
|
||||
#ifndef HAVE_SETATTR_PREPARE
|
||||
#if !(defined(HAVE_SETATTR_PREPARE_NO_USERNS) || \
|
||||
defined(HAVE_SETATTR_PREPARE_USERNS))
|
||||
static inline int
|
||||
setattr_prepare(struct dentry *dentry, struct iattr *ia)
|
||||
{
|
||||
@@ -389,6 +390,15 @@ func(const struct path *path, struct kstat *stat, u32 request_mask, \
|
||||
{ \
|
||||
return (func##_impl(path, stat, request_mask, query_flags)); \
|
||||
}
|
||||
#elif defined(HAVE_USERNS_IOPS_GETATTR)
|
||||
#define ZPL_GETATTR_WRAPPER(func) \
|
||||
static int \
|
||||
func(struct user_namespace *user_ns, const struct path *path, \
|
||||
struct kstat *stat, u32 request_mask, unsigned int query_flags) \
|
||||
{ \
|
||||
return (func##_impl(user_ns, path, stat, request_mask, \
|
||||
query_flags)); \
|
||||
}
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
@@ -436,4 +446,16 @@ zpl_is_32bit_api(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* 5.12 API change
|
||||
* To support id-mapped mounts, generic_fillattr() was modified to
|
||||
* accept a new struct user_namespace* as its first arg.
|
||||
*/
|
||||
#ifdef HAVE_GENERIC_FILLATTR_USERNS
|
||||
#define zpl_generic_fillattr(user_ns, ip, sp) \
|
||||
generic_fillattr(user_ns, ip, sp)
|
||||
#else
|
||||
#define zpl_generic_fillattr(user_ns, ip, sp) generic_fillattr(ip, sp)
|
||||
#endif
|
||||
|
||||
#endif /* _ZFS_VFS_H */
|
||||
|
||||
@@ -119,12 +119,27 @@ fn(struct dentry *dentry, const char *name, void *buffer, size_t size, \
|
||||
#error "Unsupported kernel"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 5.12 API change,
|
||||
* The xattr_handler->set() callback was changed to take the
|
||||
* struct user_namespace* as the first arg, to support idmapped
|
||||
* mounts.
|
||||
*/
|
||||
#if defined(HAVE_XATTR_SET_USERNS)
|
||||
#define ZPL_XATTR_SET_WRAPPER(fn) \
|
||||
static int \
|
||||
fn(const struct xattr_handler *handler, struct user_namespace *user_ns, \
|
||||
struct dentry *dentry, struct inode *inode, const char *name, \
|
||||
const void *buffer, size_t size, int flags) \
|
||||
{ \
|
||||
return (__ ## fn(inode, name, buffer, size, flags)); \
|
||||
}
|
||||
/*
|
||||
* 4.7 API change,
|
||||
* The xattr_handler->set() callback was changed to take a both dentry and
|
||||
* inode, because the dentry might not be attached to an inode yet.
|
||||
*/
|
||||
#if defined(HAVE_XATTR_SET_DENTRY_INODE)
|
||||
#elif defined(HAVE_XATTR_SET_DENTRY_INODE)
|
||||
#define ZPL_XATTR_SET_WRAPPER(fn) \
|
||||
static int \
|
||||
fn(const struct xattr_handler *handler, struct dentry *dentry, \
|
||||
|
||||
@@ -24,7 +24,11 @@
|
||||
#ifndef _SPL_CMN_ERR_H
|
||||
#define _SPL_CMN_ERR_H
|
||||
|
||||
#if defined(_KERNEL) && defined(HAVE_STANDALONE_LINUX_STDARG)
|
||||
#include <linux/stdarg.h>
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#define CE_CONT 0 /* continuation */
|
||||
#define CE_NOTE 1 /* notice */
|
||||
|
||||
@@ -62,63 +62,63 @@ void spl_dumpstack(void);
|
||||
#define PANIC(fmt, a...) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a)
|
||||
|
||||
#define VERIFY(cond) \
|
||||
(void) (unlikely(!(cond)) && \
|
||||
#define VERIFY(cond) \
|
||||
(void) (unlikely(!(cond)) && \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"%s", "VERIFY(" #cond ") failed\n"))
|
||||
|
||||
#define VERIFY3B(LEFT, OP, RIGHT) do { \
|
||||
boolean_t _verify3_left = (boolean_t)(LEFT); \
|
||||
boolean_t _verify3_right = (boolean_t)(RIGHT); \
|
||||
if (!(_verify3_left OP _verify3_right)) \
|
||||
#define VERIFY3B(LEFT, OP, RIGHT) do { \
|
||||
const boolean_t _verify3_left = (boolean_t)(LEFT); \
|
||||
const boolean_t _verify3_right = (boolean_t)(RIGHT);\
|
||||
if (unlikely(!(_verify3_left OP _verify3_right))) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
|
||||
"failed (%d " #OP " %d)\n", \
|
||||
(boolean_t) (_verify3_left), \
|
||||
(boolean_t) (_verify3_right)); \
|
||||
"failed (%d " #OP " %d)\n", \
|
||||
(boolean_t) (_verify3_left), \
|
||||
(boolean_t) (_verify3_right)); \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY3S(LEFT, OP, RIGHT) do { \
|
||||
int64_t _verify3_left = (int64_t)(LEFT); \
|
||||
int64_t _verify3_right = (int64_t)(RIGHT); \
|
||||
if (!(_verify3_left OP _verify3_right)) \
|
||||
#define VERIFY3S(LEFT, OP, RIGHT) do { \
|
||||
const int64_t _verify3_left = (int64_t)(LEFT); \
|
||||
const int64_t _verify3_right = (int64_t)(RIGHT); \
|
||||
if (unlikely(!(_verify3_left OP _verify3_right))) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
|
||||
"failed (%lld " #OP " %lld)\n", \
|
||||
(long long) (_verify3_left), \
|
||||
(long long) (_verify3_right)); \
|
||||
"failed (%lld " #OP " %lld)\n", \
|
||||
(long long) (_verify3_left), \
|
||||
(long long) (_verify3_right)); \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY3U(LEFT, OP, RIGHT) do { \
|
||||
uint64_t _verify3_left = (uint64_t)(LEFT); \
|
||||
uint64_t _verify3_right = (uint64_t)(RIGHT); \
|
||||
if (!(_verify3_left OP _verify3_right)) \
|
||||
#define VERIFY3U(LEFT, OP, RIGHT) do { \
|
||||
const uint64_t _verify3_left = (uint64_t)(LEFT); \
|
||||
const uint64_t _verify3_right = (uint64_t)(RIGHT); \
|
||||
if (unlikely(!(_verify3_left OP _verify3_right))) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
|
||||
"failed (%llu " #OP " %llu)\n", \
|
||||
(unsigned long long) (_verify3_left), \
|
||||
(unsigned long long) (_verify3_right)); \
|
||||
"failed (%llu " #OP " %llu)\n", \
|
||||
(unsigned long long) (_verify3_left), \
|
||||
(unsigned long long) (_verify3_right)); \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY3P(LEFT, OP, RIGHT) do { \
|
||||
uintptr_t _verify3_left = (uintptr_t)(LEFT); \
|
||||
uintptr_t _verify3_right = (uintptr_t)(RIGHT); \
|
||||
if (!(_verify3_left OP _verify3_right)) \
|
||||
#define VERIFY3P(LEFT, OP, RIGHT) do { \
|
||||
const uintptr_t _verify3_left = (uintptr_t)(LEFT); \
|
||||
const uintptr_t _verify3_right = (uintptr_t)(RIGHT);\
|
||||
if (unlikely(!(_verify3_left OP _verify3_right))) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
|
||||
"failed (%px " #OP " %px)\n", \
|
||||
(void *) (_verify3_left), \
|
||||
(void *) (_verify3_right)); \
|
||||
"failed (%px " #OP " %px)\n", \
|
||||
(void *) (_verify3_left), \
|
||||
(void *) (_verify3_right)); \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY0(RIGHT) do { \
|
||||
int64_t _verify3_left = (int64_t)(0); \
|
||||
int64_t _verify3_right = (int64_t)(RIGHT); \
|
||||
if (!(_verify3_left == _verify3_right)) \
|
||||
#define VERIFY0(RIGHT) do { \
|
||||
const int64_t _verify3_left = (int64_t)(0); \
|
||||
const int64_t _verify3_right = (int64_t)(RIGHT); \
|
||||
if (unlikely(!(_verify3_left == _verify3_right))) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(0 == " #RIGHT ") " \
|
||||
"failed (0 == %lld)\n", \
|
||||
(long long) (_verify3_right)); \
|
||||
"VERIFY3(0 == " #RIGHT ") " \
|
||||
"failed (0 == %lld)\n", \
|
||||
(long long) (_verify3_right)); \
|
||||
} while (0)
|
||||
|
||||
#define CTASSERT_GLOBAL(x) _CTASSERT(x, __LINE__)
|
||||
@@ -154,11 +154,11 @@ void spl_dumpstack(void);
|
||||
#define ASSERT0 VERIFY0
|
||||
#define ASSERT VERIFY
|
||||
#define IMPLY(A, B) \
|
||||
((void)(((!(A)) || (B)) || \
|
||||
((void)(likely((!(A)) || (B)) || \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"(" #A ") implies (" #B ")")))
|
||||
#define EQUIV(A, B) \
|
||||
((void)((!!(A) == !!(B)) || \
|
||||
((void)(likely(!!(A) == !!(B)) || \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"(" #A ") is equivalent to (" #B ")")))
|
||||
/* END CSTYLED */
|
||||
|
||||
@@ -33,22 +33,6 @@
|
||||
#define FORREAL 0 /* Usual side-effects */
|
||||
#define JUSTLOOKING 1 /* Don't stop the process */
|
||||
|
||||
/*
|
||||
* The "why" argument indicates the allowable side-effects of the call:
|
||||
*
|
||||
* FORREAL: Extract the next pending signal from p_sig into p_cursig;
|
||||
* stop the process if a stop has been requested or if a traced signal
|
||||
* is pending.
|
||||
*
|
||||
* JUSTLOOKING: Don't stop the process, just indicate whether or not
|
||||
* a signal might be pending (FORREAL is needed to tell for sure).
|
||||
*/
|
||||
static __inline__ int
|
||||
issig(int why)
|
||||
{
|
||||
ASSERT(why == FORREAL || why == JUSTLOOKING);
|
||||
|
||||
return (signal_pending(current));
|
||||
}
|
||||
extern int issig(int why);
|
||||
|
||||
#endif /* SPL_SIGNAL_H */
|
||||
|
||||
@@ -70,4 +70,17 @@ extern struct task_struct *spl_kthread_create(int (*func)(void *),
|
||||
|
||||
extern proc_t p0;
|
||||
|
||||
#ifdef HAVE_SIGINFO
|
||||
typedef kernel_siginfo_t spl_kernel_siginfo_t;
|
||||
#else
|
||||
typedef siginfo_t spl_kernel_siginfo_t;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SET_SPECIAL_STATE
|
||||
#define spl_set_special_state(x) set_special_state((x))
|
||||
#else
|
||||
#define spl_set_special_state(x) __set_current_state((x))
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _SPL_THREAD_H */
|
||||
|
||||
@@ -52,6 +52,12 @@
|
||||
|
||||
#define F_FREESP 11 /* Free file space */
|
||||
|
||||
|
||||
#if defined(SEEK_HOLE) && defined(SEEK_DATA)
|
||||
#define F_SEEK_DATA SEEK_DATA
|
||||
#define F_SEEK_HOLE SEEK_HOLE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The vnode AT_ flags are mapped to the Linux ATTR_* flags.
|
||||
* This allows them to be used safely with an iattr structure.
|
||||
|
||||
@@ -138,6 +138,39 @@ struct zfsvfs {
|
||||
taskqid_t z_drain_task; /* task id for the unlink drain task */
|
||||
};
|
||||
|
||||
#define ZFS_TEARDOWN_INIT(zfsvfs) \
|
||||
rrm_init(&(zfsvfs)->z_teardown_lock, B_FALSE)
|
||||
|
||||
#define ZFS_TEARDOWN_DESTROY(zfsvfs) \
|
||||
rrm_destroy(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \
|
||||
rw_tryenter(&(zfsvfs)->z_teardown_lock, RW_READER)
|
||||
|
||||
#define ZFS_TEARDOWN_ENTER_READ(zfsvfs, tag) \
|
||||
rrm_enter_read(&(zfsvfs)->z_teardown_lock, tag);
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \
|
||||
rrm_enter(&(zfsvfs)->z_teardown_lock, RW_WRITER, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT(zfsvfs, tag) \
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_READ_HELD(zfsvfs) \
|
||||
RRM_READ_HELD(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_WRITE_HELD(zfsvfs) \
|
||||
RRM_WRITE_HELD(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_HELD(zfsvfs) \
|
||||
RRM_LOCK_HELD(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZSB_XATTR 0x0001 /* Enable user xattrs */
|
||||
|
||||
/*
|
||||
|
||||
@@ -40,10 +40,8 @@ extern "C" {
|
||||
|
||||
extern int zfs_open(struct inode *ip, int mode, int flag, cred_t *cr);
|
||||
extern int zfs_close(struct inode *ip, int flag, cred_t *cr);
|
||||
extern int zfs_holey(struct inode *ip, int cmd, loff_t *off);
|
||||
extern int zfs_write_simple(znode_t *zp, const void *data, size_t len,
|
||||
loff_t pos, size_t *resid);
|
||||
extern int zfs_access(struct inode *ip, int mode, int flag, cred_t *cr);
|
||||
extern int zfs_lookup(znode_t *dzp, char *nm, znode_t **zpp, int flags,
|
||||
cred_t *cr, int *direntflags, pathname_t *realpnp);
|
||||
extern int zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl,
|
||||
@@ -56,7 +54,8 @@ extern int zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap,
|
||||
extern int zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd,
|
||||
cred_t *cr, int flags);
|
||||
extern int zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr);
|
||||
extern int zfs_getattr_fast(struct inode *ip, struct kstat *sp);
|
||||
extern int zfs_getattr_fast(struct user_namespace *, struct inode *ip,
|
||||
struct kstat *sp);
|
||||
extern int zfs_setattr(znode_t *zp, vattr_t *vap, int flag, cred_t *cr);
|
||||
extern int zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp,
|
||||
char *tnm, cred_t *cr, int flags);
|
||||
|
||||
@@ -73,15 +73,21 @@ extern "C" {
|
||||
#define zn_has_cached_data(zp) ((zp)->z_is_mapped)
|
||||
#define zn_rlimit_fsize(zp, uio, td) (0)
|
||||
|
||||
#define zhold(zp) igrab(ZTOI((zp)))
|
||||
/*
|
||||
* zhold() wraps igrab() on Linux, and igrab() may fail when the
|
||||
* inode is in the process of being deleted. As zhold() must only be
|
||||
* called when a ref already exists - so the inode cannot be
|
||||
* mid-deletion - we VERIFY() this.
|
||||
*/
|
||||
#define zhold(zp) VERIFY3P(igrab(ZTOI((zp))), !=, NULL)
|
||||
#define zrele(zp) iput(ZTOI((zp)))
|
||||
|
||||
/* Called on entry to each ZFS inode and vfs operation. */
|
||||
#define ZFS_ENTER_ERROR(zfsvfs, error) \
|
||||
do { \
|
||||
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
|
||||
if ((zfsvfs)->z_unmounted) { \
|
||||
ZFS_EXIT(zfsvfs); \
|
||||
ZFS_TEARDOWN_ENTER_READ(zfsvfs, FTAG); \
|
||||
if (unlikely((zfsvfs)->z_unmounted)) { \
|
||||
ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \
|
||||
return (error); \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -92,7 +98,7 @@ do { \
|
||||
#define ZFS_EXIT(zfsvfs) \
|
||||
do { \
|
||||
zfs_exit_fs(zfsvfs); \
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG); \
|
||||
ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \
|
||||
} while (0)
|
||||
|
||||
#define ZPL_EXIT(zfsvfs) \
|
||||
@@ -103,7 +109,7 @@ do { \
|
||||
/* Verifies the znode is valid. */
|
||||
#define ZFS_VERIFY_ZP_ERROR(zp, error) \
|
||||
do { \
|
||||
if ((zp)->z_sa_hdl == NULL) { \
|
||||
if (unlikely((zp)->z_sa_hdl == NULL)) { \
|
||||
ZFS_EXIT(ZTOZSB(zp)); \
|
||||
return (error); \
|
||||
} \
|
||||
@@ -167,7 +173,6 @@ extern caddr_t zfs_map_page(page_t *, enum seg_rw);
|
||||
extern void zfs_unmap_page(page_t *, caddr_t);
|
||||
#endif /* HAVE_UIO_RW */
|
||||
|
||||
extern zil_get_data_t zfs_get_data;
|
||||
extern zil_replay_func_t *zfs_replay_vector[TX_MAX_TYPE];
|
||||
extern int zfsfstype;
|
||||
|
||||
|
||||
@@ -63,9 +63,18 @@ extern int zpl_xattr_security_init(struct inode *ip, struct inode *dip,
|
||||
const struct qstr *qstr);
|
||||
#if defined(CONFIG_FS_POSIX_ACL)
|
||||
#if defined(HAVE_SET_ACL)
|
||||
#if defined(HAVE_SET_ACL_USERNS)
|
||||
extern int zpl_set_acl(struct user_namespace *userns, struct inode *ip,
|
||||
struct posix_acl *acl, int type);
|
||||
#else
|
||||
extern int zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type);
|
||||
#endif /* HAVE_SET_ACL_USERNS */
|
||||
#endif /* HAVE_SET_ACL */
|
||||
#if defined(HAVE_GET_ACL_RCU)
|
||||
extern struct posix_acl *zpl_get_acl(struct inode *ip, int type, bool rcu);
|
||||
#elif defined(HAVE_GET_ACL)
|
||||
extern struct posix_acl *zpl_get_acl(struct inode *ip, int type);
|
||||
#endif
|
||||
extern int zpl_init_acl(struct inode *ip, struct inode *dir);
|
||||
extern int zpl_chmod_acl(struct inode *ip);
|
||||
#else
|
||||
@@ -171,4 +180,22 @@ zpl_dir_emit_dots(struct file *file, zpl_dir_context_t *ctx)
|
||||
timespec_trunc(ts, (ip)->i_sb->s_time_gran)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INODE_OWNER_OR_CAPABLE)
|
||||
#define zpl_inode_owner_or_capable(ns, ip) inode_owner_or_capable(ip)
|
||||
#elif defined(HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED)
|
||||
#define zpl_inode_owner_or_capable(ns, ip) inode_owner_or_capable(ns, ip)
|
||||
#else
|
||||
#error "Unsupported kernel"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SETATTR_PREPARE_USERNS
|
||||
#define zpl_setattr_prepare(ns, dentry, ia) setattr_prepare(ns, dentry, ia)
|
||||
#else
|
||||
/*
|
||||
* Use kernel-provided version, or our own from
|
||||
* linux/vfs_compat.h
|
||||
*/
|
||||
#define zpl_setattr_prepare(ns, dentry, ia) setattr_prepare(dentry, ia)
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ZPL_H */
|
||||
|
||||
@@ -41,10 +41,11 @@ typedef void (dsl_sigfunc_t)(void *, dmu_tx_t *);
|
||||
|
||||
typedef enum zfs_space_check {
|
||||
/*
|
||||
* Normal space check: if there is less than 3.2% free space,
|
||||
* the operation will fail. Operations which are logically
|
||||
* creating things should use this (e.g. "zfs create", "zfs snapshot").
|
||||
* User writes (via the ZPL / ZVOL) also fail at this point.
|
||||
* Normal space check: if there is less than 3.2% free space (bounded
|
||||
* by spa_max_slop), the operation will fail. Operations which are
|
||||
* logically creating things should use this (e.g. "zfs create", "zfs
|
||||
* snapshot"). User writes (via the ZPL / ZVOL) also fail at this
|
||||
* point.
|
||||
*/
|
||||
ZFS_SPACE_CHECK_NORMAL,
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/nvpair.h>
|
||||
#include <sys/zfs_file.h>
|
||||
|
||||
/*
|
||||
* Shared user/kernel definitions for class length, error channel name,
|
||||
@@ -96,8 +97,8 @@ extern void fm_nvprint(nvlist_t *);
|
||||
extern void zfs_zevent_post_cb(nvlist_t *nvl, nvlist_t *detector);
|
||||
extern int zfs_zevent_post(nvlist_t *, nvlist_t *, zevent_cb_t *);
|
||||
extern void zfs_zevent_drain_all(int *);
|
||||
extern int zfs_zevent_fd_hold(int, minor_t *, zfs_zevent_t **);
|
||||
extern void zfs_zevent_fd_rele(int);
|
||||
extern zfs_file_t *zfs_zevent_fd_hold(int, minor_t *, zfs_zevent_t **);
|
||||
extern void zfs_zevent_fd_rele(zfs_file_t *);
|
||||
extern int zfs_zevent_next(zfs_zevent_t *, nvlist_t **, uint64_t *, uint64_t *);
|
||||
extern int zfs_zevent_wait(zfs_zevent_t *);
|
||||
extern int zfs_zevent_seek(zfs_zevent_t *, uint64_t);
|
||||
|
||||
@@ -441,10 +441,11 @@ struct vdev {
|
||||
kmutex_t vdev_probe_lock; /* protects vdev_probe_zio */
|
||||
|
||||
/*
|
||||
* We rate limit ZIO delay and ZIO checksum events, since they
|
||||
* We rate limit ZIO delay, deadman, and checksum events, since they
|
||||
* can flood ZED with tons of events when a drive is acting up.
|
||||
*/
|
||||
zfs_ratelimit_t vdev_delay_rl;
|
||||
zfs_ratelimit_t vdev_deadman_rl;
|
||||
zfs_ratelimit_t vdev_checksum_rl;
|
||||
};
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#ifndef _SYS_ZFS_FILE_H
|
||||
#define _SYS_ZFS_FILE_H
|
||||
|
||||
#include <sys/zfs_context.h>
|
||||
|
||||
#ifndef _KERNEL
|
||||
typedef struct zfs_file {
|
||||
int f_fd;
|
||||
@@ -55,8 +57,8 @@ int zfs_file_fallocate(zfs_file_t *fp, int mode, loff_t offset, loff_t len);
|
||||
loff_t zfs_file_off(zfs_file_t *fp);
|
||||
int zfs_file_unlink(const char *);
|
||||
|
||||
int zfs_file_get(int fd, zfs_file_t **fp);
|
||||
void zfs_file_put(int fd);
|
||||
zfs_file_t *zfs_file_get(int fd);
|
||||
void zfs_file_put(zfs_file_t *fp);
|
||||
void *zfs_file_private(zfs_file_t *fp);
|
||||
|
||||
#endif /* _SYS_ZFS_FILE_H */
|
||||
|
||||
@@ -525,7 +525,6 @@ typedef struct zfs_useracct {
|
||||
} zfs_useracct_t;
|
||||
|
||||
#define ZFSDEV_MAX_MINOR (1 << 16)
|
||||
#define ZFS_MIN_MINOR (ZFSDEV_MAX_MINOR + 1)
|
||||
|
||||
#define ZPOOL_EXPORT_AFTER_SPLIT 0x1
|
||||
|
||||
@@ -567,7 +566,7 @@ typedef struct zfsdev_state {
|
||||
} zfsdev_state_t;
|
||||
|
||||
extern void *zfsdev_get_state(minor_t minor, enum zfsdev_state_type which);
|
||||
extern int zfsdev_getminor(int fd, minor_t *minorp);
|
||||
extern int zfsdev_getminor(zfs_file_t *fp, minor_t *minorp);
|
||||
extern minor_t zfsdev_minor_alloc(void);
|
||||
|
||||
extern uint_t zfs_fsyncer_key;
|
||||
|
||||
@@ -51,8 +51,8 @@ extern void zfs_onexit_destroy(zfs_onexit_t *zo);
|
||||
|
||||
#endif
|
||||
|
||||
extern int zfs_onexit_fd_hold(int fd, minor_t *minorp);
|
||||
extern void zfs_onexit_fd_rele(int fd);
|
||||
extern zfs_file_t *zfs_onexit_fd_hold(int fd, minor_t *minorp);
|
||||
extern void zfs_onexit_fd_rele(zfs_file_t *);
|
||||
extern int zfs_onexit_add_cb(minor_t minor, void (*func)(void *), void *data,
|
||||
uint64_t *action_handle);
|
||||
|
||||
|
||||
+18
-2
@@ -29,11 +29,27 @@
|
||||
extern int zfs_fsync(znode_t *, int, cred_t *);
|
||||
extern int zfs_read(znode_t *, uio_t *, int, cred_t *);
|
||||
extern int zfs_write(znode_t *, uio_t *, int, cred_t *);
|
||||
extern int zfs_getsecattr(znode_t *zp, vsecattr_t *vsecp, int flag, cred_t *cr);
|
||||
extern int zfs_setsecattr(znode_t *zp, vsecattr_t *vsecp, int flag, cred_t *cr);
|
||||
extern int zfs_holey(znode_t *, ulong_t, loff_t *);
|
||||
extern int zfs_access(znode_t *, int, int, cred_t *);
|
||||
|
||||
extern int zfs_getsecattr(znode_t *, vsecattr_t *, int, cred_t *);
|
||||
extern int zfs_setsecattr(znode_t *, vsecattr_t *, int, cred_t *);
|
||||
|
||||
extern int mappedread(znode_t *, int, uio_t *);
|
||||
extern int mappedread_sf(znode_t *, int, uio_t *);
|
||||
extern void update_pages(znode_t *, int64_t, int, objset_t *);
|
||||
|
||||
/*
|
||||
* Platform code that asynchronously drops zp's inode / vnode_t.
|
||||
*
|
||||
* Asynchronous dropping ensures that the caller will never drop the
|
||||
* last reference on an inode / vnode_t in the current context.
|
||||
* Doing so while holding open a tx could result in a deadlock if
|
||||
* the platform calls into filesystem again in the implementation
|
||||
* of inode / vnode_t dropping (e.g. call from iput_final()).
|
||||
*/
|
||||
extern void zfs_zrele_async(znode_t *zp);
|
||||
|
||||
extern zil_get_data_t zfs_get_data;
|
||||
|
||||
#endif
|
||||
|
||||
+2
-1
@@ -399,6 +399,7 @@ typedef struct itx {
|
||||
void *itx_callback_data; /* User data for the callback */
|
||||
size_t itx_size; /* allocated itx structure size */
|
||||
uint64_t itx_oid; /* object id */
|
||||
uint64_t itx_gen; /* gen number for zfs_get_data */
|
||||
lr_t itx_lr; /* common part of log record */
|
||||
/* followed by type-specific part of lr_xx_t and its immediate data */
|
||||
} itx_t;
|
||||
@@ -467,7 +468,7 @@ typedef int zil_parse_blk_func_t(zilog_t *zilog, const blkptr_t *bp, void *arg,
|
||||
typedef int zil_parse_lr_func_t(zilog_t *zilog, const lr_t *lr, void *arg,
|
||||
uint64_t txg);
|
||||
typedef int zil_replay_func_t(void *arg1, void *arg2, boolean_t byteswap);
|
||||
typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf,
|
||||
typedef int zil_get_data_t(void *arg, uint64_t arg2, lr_write_t *lr, char *dbuf,
|
||||
struct lwb *lwb, zio_t *zio);
|
||||
|
||||
extern int zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,
|
||||
|
||||
@@ -85,8 +85,8 @@ void zvol_log_truncate(zvol_state_t *zv, dmu_tx_t *tx, uint64_t off,
|
||||
uint64_t len, boolean_t sync);
|
||||
void zvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, uint64_t offset,
|
||||
uint64_t size, int sync);
|
||||
int zvol_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb,
|
||||
zio_t *zio);
|
||||
int zvol_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf,
|
||||
struct lwb *lwb, zio_t *zio);
|
||||
int zvol_init_impl(void);
|
||||
void zvol_fini_impl(void);
|
||||
void zvol_wait_close(zvol_state_t *zv);
|
||||
|
||||
+9
-1
@@ -1,9 +1,12 @@
|
||||
# NB: GNU Automake Manual, Chapter 8.3.5: Libtool Convenience Libraries
|
||||
# These nine libraries are intermediary build components.
|
||||
SUBDIRS = libavl libicp libshare libspl libtpool libzstd
|
||||
CPPCHECKDIRS = libavl libicp libnvpair libshare libspl libtpool libunicode
|
||||
CPPCHECKDIRS += libuutil libzfs libzfs_core libzfsbootenv libzpool libzutil
|
||||
|
||||
if BUILD_LINUX
|
||||
SUBDIRS += libefi
|
||||
CPPCHECKDIRS += libefi
|
||||
endif
|
||||
|
||||
# libnvpair is installed as part of the final build product
|
||||
@@ -23,7 +26,7 @@ DISTLIBS += libnvpair
|
||||
# is only linked against by ztest and zdb and no stable ABI is provided.
|
||||
ABILIBS = libnvpair libuutil libzfs_core libzfs libzfsbootenv
|
||||
|
||||
PHONY = checkabi storeabi
|
||||
PHONY = checkabi storeabi cppcheck
|
||||
checkabi: $(ABILIBS)
|
||||
set -e ; for dir in $(ABILIBS) ; do \
|
||||
$(MAKE) -C $$dir checkabi ; \
|
||||
@@ -33,3 +36,8 @@ storeabi: $(ABILIBS)
|
||||
set -e ; for dir in $(ABILIBS) ; do \
|
||||
$(MAKE) -C $$dir storeabi ; \
|
||||
done
|
||||
|
||||
cppcheck: $(CPPCHECKDIRS)
|
||||
set -e ; for dir in $(CPPCHECKDIRS) ; do \
|
||||
$(MAKE) -C $$dir cppcheck ; \
|
||||
done
|
||||
|
||||
@@ -12,3 +12,5 @@ KERNEL_C = \
|
||||
|
||||
nodist_libavl_la_SOURCES = \
|
||||
$(KERNEL_C)
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -10,3 +10,5 @@ USER_C = \
|
||||
libefi_la_SOURCES = $(USER_C)
|
||||
|
||||
libefi_la_LIBADD = $(LIBUUID_LIBS) $(ZLIB_LIBS)
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -71,3 +71,5 @@ KERNEL_ASM = $(ASM_SOURCES_AS)
|
||||
nodist_libicp_la_SOURCES = \
|
||||
$(KERNEL_C) \
|
||||
$(KERNEL_ASM)
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
include $(top_srcdir)/config/Rules.am
|
||||
PHONY =
|
||||
|
||||
VPATH = \
|
||||
$(top_srcdir)/module/nvpair \
|
||||
@@ -42,5 +41,7 @@ endif
|
||||
|
||||
libnvpair_la_LDFLAGS += -version-info 3:0:0
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
# Library ABI
|
||||
EXTRA_DIST = libnvpair.abi libnvpair.suppr
|
||||
|
||||
@@ -23,3 +23,5 @@ USER_C += \
|
||||
endif
|
||||
|
||||
libshare_la_SOURCES = $(USER_C)
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -65,17 +65,22 @@ static int nfs_lock_fd = -1;
|
||||
static int
|
||||
nfs_exports_lock(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
nfs_lock_fd = open(ZFS_EXPORTS_LOCK,
|
||||
O_RDWR | O_CREAT, 0600);
|
||||
if (nfs_lock_fd == -1) {
|
||||
err = errno;
|
||||
fprintf(stderr, "failed to lock %s: %s\n",
|
||||
ZFS_EXPORTS_LOCK, strerror(errno));
|
||||
return (errno);
|
||||
ZFS_EXPORTS_LOCK, strerror(err));
|
||||
return (err);
|
||||
}
|
||||
if (flock(nfs_lock_fd, LOCK_EX) != 0) {
|
||||
err = errno;
|
||||
fprintf(stderr, "failed to lock %s: %s\n",
|
||||
ZFS_EXPORTS_LOCK, strerror(errno));
|
||||
return (errno);
|
||||
ZFS_EXPORTS_LOCK, strerror(err));
|
||||
(void) close(nfs_lock_fd);
|
||||
return (err);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
@@ -356,14 +361,10 @@ nfs_disable_share(sa_share_impl_t impl_share)
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: This function returns a static buffer and thus is not thread-safe.
|
||||
*/
|
||||
static boolean_t
|
||||
nfs_is_shared(sa_share_impl_t impl_share)
|
||||
{
|
||||
static char line[MAXLINESIZE];
|
||||
char *s, last;
|
||||
char *s, last, line[MAXLINESIZE];
|
||||
size_t len;
|
||||
char *mntpoint = impl_share->sa_mountpoint;
|
||||
size_t mntlen = strlen(mntpoint);
|
||||
|
||||
@@ -65,17 +65,22 @@ static int nfs_lock_fd = -1;
|
||||
static int
|
||||
nfs_exports_lock(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
nfs_lock_fd = open(ZFS_EXPORTS_LOCK,
|
||||
O_RDWR | O_CREAT, 0600);
|
||||
if (nfs_lock_fd == -1) {
|
||||
err = errno;
|
||||
fprintf(stderr, "failed to lock %s: %s\n",
|
||||
ZFS_EXPORTS_LOCK, strerror(errno));
|
||||
return (errno);
|
||||
ZFS_EXPORTS_LOCK, strerror(err));
|
||||
return (err);
|
||||
}
|
||||
if (flock(nfs_lock_fd, LOCK_EX) != 0) {
|
||||
err = errno;
|
||||
fprintf(stderr, "failed to lock %s: %s\n",
|
||||
ZFS_EXPORTS_LOCK, strerror(errno));
|
||||
return (errno);
|
||||
ZFS_EXPORTS_LOCK, strerror(err));
|
||||
(void) close(nfs_lock_fd);
|
||||
return (err);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -55,3 +55,12 @@ libspl_la_LIBADD = \
|
||||
libspl_assert.la
|
||||
|
||||
libspl_la_LIBADD += $(LIBCLOCK_GETTIME)
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
# Override the default SOURCES which includes TARGET_CPU_ATOMIC_SOURCE
|
||||
# in order to always evaluate the generic asm-generic/atomic.c source.
|
||||
CPPCHECKSRC = $(USER_C) asm-generic/atomic.c
|
||||
cppcheck:
|
||||
$(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) --force \
|
||||
$(DEFAULT_INCLUDES) $(CPPCHECKSRC)
|
||||
|
||||
@@ -7,3 +7,5 @@ USER_C = \
|
||||
thread_pool_impl.h
|
||||
|
||||
libtpool_la_SOURCES = $(USER_C)
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -13,3 +13,5 @@ KERNEL_C = \
|
||||
|
||||
nodist_libunicode_la_SOURCES = \
|
||||
$(KERNEL_C)
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
include $(top_srcdir)/config/Rules.am
|
||||
PHONY =
|
||||
|
||||
lib_LTLIBRARIES = libuutil.la
|
||||
|
||||
@@ -32,5 +31,7 @@ endif
|
||||
|
||||
libuutil_la_LDFLAGS += -version-info 3:0:0
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
# Library ABI
|
||||
EXTRA_DIST = libuutil.abi libuutil.suppr
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
include $(top_srcdir)/config/Rules.am
|
||||
PHONY =
|
||||
|
||||
VPATH = \
|
||||
$(top_srcdir)/module/icp \
|
||||
@@ -90,6 +89,8 @@ endif
|
||||
|
||||
libzfs_la_LDFLAGS += -version-info 4:0:0
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
# Library ABI
|
||||
EXTRA_DIST = libzfs.abi libzfs.suppr
|
||||
|
||||
|
||||
@@ -518,7 +518,7 @@ get_key_material(libzfs_handle_t *hdl, boolean_t do_verify, boolean_t newkey,
|
||||
switch (keyloc) {
|
||||
case ZFS_KEYLOCATION_PROMPT:
|
||||
if (isatty(fileno(stdin))) {
|
||||
can_retry = B_TRUE;
|
||||
can_retry = keyformat != ZFS_KEYFORMAT_RAW;
|
||||
ret = get_key_interactive(hdl, fsname, keyformat,
|
||||
do_verify, newkey, &km, &kmlen);
|
||||
} else {
|
||||
@@ -960,7 +960,7 @@ zfs_crypto_create(libzfs_handle_t *hdl, char *parent_name, nvlist_t *props,
|
||||
}
|
||||
|
||||
ret = populate_create_encryption_params_nvlists(hdl, NULL,
|
||||
B_FALSE, keyformat, keylocation, props, &wkeydata,
|
||||
B_TRUE, keyformat, keylocation, props, &wkeydata,
|
||||
&wkeylen);
|
||||
if (ret != 0)
|
||||
goto out;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
* Copyright 2017-2018 RackTop Systems.
|
||||
* Copyright (c) 2019 Datto Inc.
|
||||
* Copyright (c) 2019, loli10K <ezomori.nozomu@gmail.com>
|
||||
* Copyright (c) 2021 Matt Fiddaman
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
@@ -812,7 +813,7 @@ libzfs_mnttab_update(libzfs_handle_t *hdl)
|
||||
struct mnttab entry;
|
||||
|
||||
/* Reopen MNTTAB to prevent reading stale data from open file */
|
||||
if (freopen(MNTTAB, "r", hdl->libzfs_mnttab) == NULL)
|
||||
if (freopen(MNTTAB, "re", hdl->libzfs_mnttab) == NULL)
|
||||
return (ENOENT);
|
||||
|
||||
while (getmntent(hdl->libzfs_mnttab, &entry) == 0) {
|
||||
@@ -883,7 +884,7 @@ libzfs_mnttab_find(libzfs_handle_t *hdl, const char *fsname,
|
||||
libzfs_mnttab_fini(hdl);
|
||||
|
||||
/* Reopen MNTTAB to prevent reading stale data from open file */
|
||||
if (freopen(MNTTAB, "r", hdl->libzfs_mnttab) == NULL)
|
||||
if (freopen(MNTTAB, "re", hdl->libzfs_mnttab) == NULL)
|
||||
return (ENOENT);
|
||||
|
||||
srch.mnt_special = (char *)fsname;
|
||||
@@ -1954,6 +1955,7 @@ zfs_prop_inherit(zfs_handle_t *zhp, const char *propname, boolean_t received)
|
||||
if (zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_INHERIT_PROP, &zc) != 0)
|
||||
return (zfs_standard_error(hdl, errno, errbuf));
|
||||
|
||||
(void) get_stats(zhp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -2387,7 +2389,7 @@ get_clones_string(zfs_handle_t *zhp, char *propbuf, size_t proplen)
|
||||
nvpair_t *pair;
|
||||
|
||||
value = zfs_get_clones_nvl(zhp);
|
||||
if (value == NULL)
|
||||
if (value == NULL || nvlist_empty(value))
|
||||
return (-1);
|
||||
|
||||
propbuf[0] = '\0';
|
||||
|
||||
@@ -385,6 +385,9 @@ zfs_mount_at(zfs_handle_t *zhp, const char *options, int flags,
|
||||
struct stat buf;
|
||||
char mntopts[MNT_LINE_MAX];
|
||||
char overlay[ZFS_MAXPROPLEN];
|
||||
char prop_encroot[MAXNAMELEN];
|
||||
boolean_t is_encroot;
|
||||
zfs_handle_t *encroot_hp = zhp;
|
||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||
uint64_t keystatus;
|
||||
int remount = 0, rc;
|
||||
@@ -443,7 +446,27 @@ zfs_mount_at(zfs_handle_t *zhp, const char *options, int flags,
|
||||
*/
|
||||
if (keystatus == ZFS_KEYSTATUS_UNAVAILABLE) {
|
||||
if (flags & MS_CRYPT) {
|
||||
rc = zfs_crypto_load_key(zhp, B_FALSE, NULL);
|
||||
rc = zfs_crypto_get_encryption_root(zhp,
|
||||
&is_encroot, prop_encroot);
|
||||
if (rc) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"Failed to get encryption root for "
|
||||
"'%s'."), zfs_get_name(zhp));
|
||||
return (rc);
|
||||
}
|
||||
|
||||
if (!is_encroot) {
|
||||
encroot_hp = zfs_open(hdl, prop_encroot,
|
||||
ZFS_TYPE_DATASET);
|
||||
if (encroot_hp == NULL)
|
||||
return (hdl->libzfs_error);
|
||||
}
|
||||
|
||||
rc = zfs_crypto_load_key(encroot_hp,
|
||||
B_FALSE, NULL);
|
||||
|
||||
if (!is_encroot)
|
||||
zfs_close(encroot_hp);
|
||||
if (rc)
|
||||
return (rc);
|
||||
} else {
|
||||
@@ -1496,7 +1519,7 @@ zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force)
|
||||
namelen = strlen(zhp->zpool_name);
|
||||
|
||||
/* Reopen MNTTAB to prevent reading stale data from open file */
|
||||
if (freopen(MNTTAB, "r", hdl->libzfs_mnttab) == NULL)
|
||||
if (freopen(MNTTAB, "re", hdl->libzfs_mnttab) == NULL)
|
||||
return (ENOENT);
|
||||
|
||||
used = alloc = 0;
|
||||
|
||||
@@ -3956,24 +3956,6 @@ zfs_setup_cmdline_props(libzfs_handle_t *hdl, zfs_type_t type,
|
||||
if (prop == ZFS_PROP_ORIGIN)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* we're trying to override or exclude a property that does not
|
||||
* make sense for this type of dataset, but we don't want to
|
||||
* fail if the receive is recursive: this comes in handy when
|
||||
* the send stream contains, for instance, a child ZVOL and
|
||||
* we're trying to receive it with "-o atime=on"
|
||||
*/
|
||||
if (!zfs_prop_valid_for_type(prop, type, B_FALSE) &&
|
||||
!zfs_prop_user(name)) {
|
||||
if (recursive)
|
||||
continue;
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"property '%s' does not apply to datasets of this "
|
||||
"type"), name);
|
||||
ret = zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* raw streams can't override encryption properties */
|
||||
if ((zfs_prop_encryption_key_param(prop) ||
|
||||
prop == ZFS_PROP_ENCRYPTION) && raw) {
|
||||
@@ -4002,6 +3984,16 @@ zfs_setup_cmdline_props(libzfs_handle_t *hdl, zfs_type_t type,
|
||||
* a property: this is done by forcing an explicit
|
||||
* inherit on the destination so the effective value is
|
||||
* not the one we received from the send stream.
|
||||
*/
|
||||
if (!zfs_prop_valid_for_type(prop, type, B_FALSE) &&
|
||||
!zfs_prop_user(name)) {
|
||||
(void) fprintf(stderr, dgettext(TEXT_DOMAIN,
|
||||
"Warning: %s: property '%s' does not "
|
||||
"apply to datasets of this type\n"),
|
||||
fsname, name);
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* We do this only if the property is not already
|
||||
* locally-set, in which case its value will take
|
||||
* priority over the received anyway.
|
||||
@@ -4029,6 +4021,24 @@ zfs_setup_cmdline_props(libzfs_handle_t *hdl, zfs_type_t type,
|
||||
fnvlist_add_nvpair(*oxprops, nvp);
|
||||
break;
|
||||
case DATA_TYPE_STRING: /* -o property=value */
|
||||
/*
|
||||
* we're trying to override a property that does not
|
||||
* make sense for this type of dataset, but we don't
|
||||
* want to fail if the receive is recursive: this comes
|
||||
* in handy when the send stream contains, for
|
||||
* instance, a child ZVOL and we're trying to receive
|
||||
* it with "-o atime=on"
|
||||
*/
|
||||
if (!zfs_prop_valid_for_type(prop, type, B_FALSE) &&
|
||||
!zfs_prop_user(name)) {
|
||||
if (recursive)
|
||||
continue;
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"property '%s' does not apply to datasets "
|
||||
"of this type"), name);
|
||||
ret = zfs_error(hdl, EZFS_BADPROP, errbuf);
|
||||
goto error;
|
||||
}
|
||||
fnvlist_add_nvpair(oprops, nvp);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -1024,15 +1024,15 @@ libzfs_init(void)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR|O_EXCL)) < 0) {
|
||||
if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR|O_EXCL|O_CLOEXEC)) < 0) {
|
||||
free(hdl);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SETMNTENT
|
||||
if ((hdl->libzfs_mnttab = setmntent(MNTTAB, "r")) == NULL) {
|
||||
if ((hdl->libzfs_mnttab = setmntent(MNTTAB, "re")) == NULL) {
|
||||
#else
|
||||
if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) {
|
||||
if ((hdl->libzfs_mnttab = fopen(MNTTAB, "re")) == NULL) {
|
||||
#endif
|
||||
(void) close(hdl->libzfs_fd);
|
||||
free(hdl);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
include $(top_srcdir)/config/Rules.am
|
||||
PHONY =
|
||||
|
||||
pkgconfig_DATA = libzfs_core.pc
|
||||
|
||||
@@ -30,5 +29,7 @@ endif
|
||||
|
||||
libzfs_core_la_LDFLAGS += -version-info 3:0:0
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
# Library ABI
|
||||
EXTRA_DIST = libzfs_core.abi libzfs_core.suppr
|
||||
|
||||
@@ -137,7 +137,7 @@ libzfs_core_init(void)
|
||||
{
|
||||
(void) pthread_mutex_lock(&g_lock);
|
||||
if (g_refcount == 0) {
|
||||
g_fd = open(ZFS_DEV, O_RDWR);
|
||||
g_fd = open(ZFS_DEV, O_RDWR|O_CLOEXEC);
|
||||
if (g_fd < 0) {
|
||||
(void) pthread_mutex_unlock(&g_lock);
|
||||
return (errno);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
include $(top_srcdir)/config/Rules.am
|
||||
PHONY =
|
||||
|
||||
pkgconfig_DATA = libzfsbootenv.pc
|
||||
|
||||
@@ -34,5 +33,7 @@ endif
|
||||
|
||||
libzfsbootenv_la_LDFLAGS += -version-info 1:0:0
|
||||
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
|
||||
# Library ABI
|
||||
EXTRA_DIST = libzfsbootenv.abi libzfsbootenv.suppr
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user