mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 19:04:45 +03:00
Compare commits
193 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fb6d532066 | |||
| 3ad8826585 | |||
| 00a3821020 | |||
| 85c6fd4058 | |||
| 34c8d4d4fd | |||
| 07ce4ad6bf | |||
| 2f21b169af | |||
| e54eef24c6 | |||
| 4a0d86afc3 | |||
| 57da499afd | |||
| f392c4073a | |||
| d1ee3d611d | |||
| dfece78a42 | |||
| 0bc841fb59 | |||
| 6b33ae072c | |||
| 53a55390fb | |||
| bc42a2fb54 | |||
| dffe59c415 | |||
| 11574a7934 | |||
| 35252ae0fd | |||
| 38f6f3ada1 | |||
| 3271604242 | |||
| 0db66111d3 | |||
| 71d407cc39 | |||
| a9dc1166b6 | |||
| 5f465d1515 | |||
| 72bf91dfdb | |||
| e5f191d760 | |||
| da1cbd869b | |||
| 4b849db210 | |||
| e68922faaa | |||
| b8bf99cca9 | |||
| 73ab3bd088 | |||
| bb1dd98bcc | |||
| 94a830adf6 | |||
| 8e5298f0ad | |||
| b4481996bd | |||
| 478c5b4f3f | |||
| f8f3cac084 | |||
| 12a031a3f5 | |||
| 9e41d5d05c | |||
| ae75a78ba3 | |||
| e1bc32f710 | |||
| 74da5eb468 | |||
| d96360b7f2 | |||
| d99134be83 | |||
| a339bd791a | |||
| 1ca531971f | |||
| 77b0c6f040 | |||
| eb62221ff0 | |||
| a3169da877 | |||
| a93c30a2f2 | |||
| ae0d644269 | |||
| c8a3c74556 | |||
| a449d8bab0 | |||
| a4f82db53d | |||
| 92fc218205 | |||
| adf428cbef | |||
| cb28c0b770 | |||
| c74a17a498 | |||
| 9b7f7f02e9 | |||
| cb115edfc6 | |||
| 0ee7a08627 | |||
| 5ee79af41f | |||
| feb0fa6b38 | |||
| 7c0618bdb7 | |||
| 3ff9e4f8ac | |||
| 211868b5d0 | |||
| e45ca514e8 | |||
| f52d9b6f42 | |||
| 837e426c1f | |||
| 426d07d64c | |||
| 692f78045e | |||
| 245850b66c | |||
| 1abf68b7ae | |||
| 846a4cc089 | |||
| e01e3a4e12 | |||
| 6e79bcd356 | |||
| ef2156c66e | |||
| f28cd347c4 | |||
| c12b5829e1 | |||
| 425f7895dd | |||
| d91778e31f | |||
| cb549c7425 | |||
| f9a2d94c95 | |||
| 6af79c92dd | |||
| c5bbd80cb9 | |||
| 86783d7d92 | |||
| dbbc2f9688 | |||
| 1322f07ade | |||
| 79f8e629ff | |||
| 5f125e9012 | |||
| d7fb413f0f | |||
| f0aca5f7bb | |||
| 04305bbd18 | |||
| 35d43ba8ea | |||
| 3ad6c1692f | |||
| 9e5a297de6 | |||
| 8a315a30ab | |||
| b01a8cc2c0 | |||
| a727848e05 | |||
| b2ede77bf9 | |||
| c1b9dc735f | |||
| e271cd7a65 | |||
| 7d26967d4e | |||
| 93a99c6daa | |||
| 671b1af1bc | |||
| a836cc6ddd | |||
| 435407eb5c | |||
| 07a2ba541d | |||
| f786232b2a | |||
| 45c4b3e680 | |||
| 092021ba39 | |||
| aef1324d59 | |||
| d1e05c6856 | |||
| 30dcddaec7 | |||
| c094b9a928 | |||
| 4e24df0e81 | |||
| 848c4b2300 | |||
| c6f6958fc0 | |||
| e1b3ab5f51 | |||
| e2a96aa4eb | |||
| 6ec3abcb59 | |||
| e97637d484 | |||
| e2176f12a9 | |||
| c2f0aaeb3c | |||
| b17e472983 | |||
| 133faca275 | |||
| 7c555fee9d | |||
| ecaf3ea3f2 | |||
| 9b17d5a37d | |||
| 75ec145710 | |||
| 33075e465f | |||
| cdbe1d65c4 | |||
| fa28e26e42 | |||
| 9fe3da9364 | |||
| a68dfdb88c | |||
| 4a5950a129 | |||
| c7db374ac6 | |||
| e25f9131d6 | |||
| 4e49d8ed27 | |||
| a969b1b22c | |||
| 18edf7a3ba | |||
| 33003ecc93 | |||
| 07cc8ae46a | |||
| e202d3b867 | |||
| 3d9f37026d | |||
| fc2c0256c5 | |||
| a69765ea5b | |||
| a164143dfd | |||
| c63b47e4da | |||
| 0e30635f9c | |||
| 777c98ee52 | |||
| 164d184ed9 | |||
| 3da577280a | |||
| 433b9a89c4 | |||
| 374f86b5c9 | |||
| 59f1875639 | |||
| aa7258ced0 | |||
| dedd8243fc | |||
| 43d63ab2d4 | |||
| bd9a9a4e1a | |||
| 5219a2691e | |||
| 48f376b0c5 | |||
| 345f8beb58 | |||
| a5c469c5f3 | |||
| 4b3133e671 | |||
| 4f6e0ca117 | |||
| 1d2aea7711 | |||
| 0a4e41d0fa | |||
| 050be02c02 | |||
| 576d34cb11 | |||
| 6281b5c488 | |||
| 231a37c4c0 | |||
| 9d2e5c14b2 | |||
| b644a45bd4 | |||
| fd0893cf1f | |||
| c8d36e2192 | |||
| edaa250bb3 | |||
| 04a6ae0585 | |||
| eb68e3cd56 | |||
| 2098a00318 | |||
| 82e3117095 | |||
| fce0f7aff4 | |||
| df18a44396 | |||
| 41fb4e071c | |||
| 7043742828 | |||
| aa256549d1 | |||
| 083239575a | |||
| 57159a519b | |||
| 8473829d1f | |||
| e45a981f6d | |||
| 5161e5d8a4 |
@@ -0,0 +1,57 @@
|
||||
acl
|
||||
alien
|
||||
attr
|
||||
autoconf
|
||||
bc
|
||||
build-essential
|
||||
curl
|
||||
dbench
|
||||
debhelper-compat
|
||||
dh-python
|
||||
dkms
|
||||
fakeroot
|
||||
fio
|
||||
gdb
|
||||
gdebi
|
||||
git
|
||||
ksh
|
||||
lcov
|
||||
libacl1-dev
|
||||
libaio-dev
|
||||
libattr1-dev
|
||||
libblkid-dev
|
||||
libcurl4-openssl-dev
|
||||
libdevmapper-dev
|
||||
libelf-dev
|
||||
libffi-dev
|
||||
libmount-dev
|
||||
libpam0g-dev
|
||||
libselinux1-dev
|
||||
libssl-dev
|
||||
libtool
|
||||
libudev-dev
|
||||
linux-headers-generic
|
||||
lsscsi
|
||||
mdadm
|
||||
nfs-kernel-server
|
||||
pamtester
|
||||
parted
|
||||
po-debconf
|
||||
python3
|
||||
python3-all-dev
|
||||
python3-cffi
|
||||
python3-dev
|
||||
python3-packaging
|
||||
python3-pip
|
||||
python3-setuptools
|
||||
python3-sphinx
|
||||
rng-tools-debian
|
||||
rsync
|
||||
samba
|
||||
sysstat
|
||||
uuid-dev
|
||||
watchdog
|
||||
wget
|
||||
xfslibs-dev
|
||||
xz-utils
|
||||
zlib1g-dev
|
||||
@@ -0,0 +1,2 @@
|
||||
pax-utils
|
||||
shellcheck
|
||||
@@ -6,20 +6,27 @@ on:
|
||||
|
||||
jobs:
|
||||
checkstyle:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install --yes -qq build-essential autoconf libtool gawk alien fakeroot linux-headers-$(uname -r)
|
||||
sudo apt-get install --yes -qq zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev python-dev python-setuptools python-cffi python3 python3-dev python3-setuptools python3-cffi
|
||||
# packages for tests
|
||||
sudo apt-get install --yes -qq parted lsscsi ksh attr acl nfs-kernel-server fio
|
||||
sudo apt-get install --yes -qq mandoc cppcheck pax-utils devscripts
|
||||
sudo -E pip --quiet install flake8
|
||||
# https://github.com/orgs/community/discussions/47863
|
||||
sudo apt-mark hold grub-efi-amd64-signed
|
||||
sudo apt-get update --fix-missing
|
||||
sudo apt-get upgrade
|
||||
sudo xargs --arg-file=${{ github.workspace }}/.github/workflows/build-dependencies.txt apt-get install -qq
|
||||
sudo xargs --arg-file=${{ github.workspace }}/.github/workflows/checkstyle-dependencies.txt apt-get install -qq
|
||||
sudo python3 -m pip install --quiet flake8
|
||||
sudo apt-get clean
|
||||
|
||||
# confirm that the tools are installed
|
||||
# the build system doesn't fail when they are not
|
||||
flake8 --version
|
||||
scanelf --version
|
||||
shellcheck --version
|
||||
- name: Prepare
|
||||
run: |
|
||||
sh ./autogen.sh
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
# remove 4GiB of images
|
||||
sudo systemd-run docker system prune --force --all --volumes
|
||||
|
||||
# remove unused software
|
||||
sudo systemd-run --wait rm -rf \
|
||||
"$AGENT_TOOLSDIRECTORY" \
|
||||
/opt/* \
|
||||
/usr/local/* \
|
||||
/usr/share/az* \
|
||||
/usr/share/dotnet \
|
||||
/usr/share/gradle* \
|
||||
/usr/share/miniconda \
|
||||
/usr/share/swift \
|
||||
/var/lib/gems \
|
||||
/var/lib/mysql \
|
||||
/var/lib/snapd
|
||||
|
||||
# trim the cleaned space
|
||||
sudo fstrim /
|
||||
@@ -9,7 +9,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [20.04]
|
||||
os: [20.04, 22.04]
|
||||
runs-on: ubuntu-${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@@ -17,17 +17,12 @@ jobs:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install --yes -qq build-essential autoconf libtool gdb lcov \
|
||||
git alien fakeroot wget curl bc fio acl \
|
||||
sysstat mdadm lsscsi parted gdebi attr dbench watchdog ksh \
|
||||
nfs-kernel-server samba rng-tools xz-utils \
|
||||
zlib1g-dev uuid-dev libblkid-dev libselinux-dev \
|
||||
xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \
|
||||
libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \
|
||||
libpam0g-dev pamtester python-dev python-setuptools python-cffi \
|
||||
python3 python3-dev python3-setuptools python3-cffi python3-packaging \
|
||||
libcurl4-openssl-dev
|
||||
# https://github.com/orgs/community/discussions/47863
|
||||
sudo apt-mark hold grub-efi-amd64-signed
|
||||
sudo apt-get update --fix-missing
|
||||
sudo apt-get upgrade
|
||||
sudo xargs --arg-file=${{ github.workspace }}/.github/workflows/build-dependencies.txt apt-get install -qq
|
||||
sudo apt-get clean
|
||||
- name: Autogen.sh
|
||||
run: |
|
||||
sh autogen.sh
|
||||
@@ -56,12 +51,13 @@ jobs:
|
||||
sudo udevadm control --reload-rules
|
||||
fi
|
||||
fi
|
||||
# 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: Clear the kernel ring buffer
|
||||
run: |
|
||||
sudo dmesg -c >/var/tmp/dmesg-prerun
|
||||
- name: Reclaim and report disk space
|
||||
run: |
|
||||
${{ github.workspace }}/.github/workflows/scripts/reclaim_disk_space.sh
|
||||
df -h /
|
||||
- name: Tests
|
||||
run: |
|
||||
/usr/share/zfs/zfs-tests.sh -vR -s 3G
|
||||
@@ -71,7 +67,7 @@ jobs:
|
||||
run: |
|
||||
RESULTS_PATH=$(readlink -f /var/tmp/test_results/current)
|
||||
sudo dmesg > $RESULTS_PATH/dmesg
|
||||
sudo cp /var/log/syslog $RESULTS_PATH/
|
||||
sudo cp /var/log/syslog /var/tmp/dmesg-prerun $RESULTS_PATH/
|
||||
sudo chmod +r $RESULTS_PATH/*
|
||||
# Replace ':' in dir names, actions/upload-artifact doesn't support it
|
||||
for f in $(find /var/tmp/test_results -name '*:*'); do mv "$f" "${f//:/__}"; done
|
||||
@@ -79,5 +75,7 @@ jobs:
|
||||
if: failure()
|
||||
with:
|
||||
name: Test logs Ubuntu-${{ matrix.os }}
|
||||
path: /var/tmp/test_results/20*/
|
||||
path: |
|
||||
/var/tmp/test_results/*
|
||||
!/var/tmp/test_results/current
|
||||
if-no-files-found: ignore
|
||||
|
||||
@@ -6,24 +6,19 @@ on:
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install --yes -qq build-essential autoconf libtool gdb lcov \
|
||||
git alien fakeroot wget curl bc fio acl \
|
||||
sysstat mdadm lsscsi parted gdebi attr dbench watchdog ksh \
|
||||
nfs-kernel-server samba rng-tools xz-utils \
|
||||
zlib1g-dev uuid-dev libblkid-dev libselinux-dev \
|
||||
xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \
|
||||
libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \
|
||||
libpam0g-dev pamtester python-dev python-setuptools python-cffi \
|
||||
python3 python3-dev python3-setuptools python3-cffi python3-packaging \
|
||||
libcurl4-openssl-dev
|
||||
# https://github.com/orgs/community/discussions/47863
|
||||
sudo apt-mark hold grub-efi-amd64-signed
|
||||
sudo apt-get update --fix-missing
|
||||
sudo apt-get upgrade
|
||||
sudo xargs --arg-file=${{ github.workspace }}/.github/workflows/build-dependencies.txt apt-get install -qq
|
||||
sudo apt-get clean
|
||||
- name: Autogen.sh
|
||||
run: |
|
||||
sh autogen.sh
|
||||
@@ -52,12 +47,13 @@ jobs:
|
||||
sudo udevadm control --reload-rules
|
||||
fi
|
||||
fi
|
||||
# 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: Clear the kernel ring buffer
|
||||
run: |
|
||||
sudo dmesg -c >/var/tmp/dmesg-prerun
|
||||
- name: Reclaim and report disk space
|
||||
run: |
|
||||
${{ github.workspace }}/.github/workflows/scripts/reclaim_disk_space.sh
|
||||
df -h /
|
||||
- name: Tests
|
||||
run: |
|
||||
/usr/share/zfs/zfs-tests.sh -vR -s 3G -r sanity
|
||||
@@ -67,13 +63,15 @@ jobs:
|
||||
run: |
|
||||
RESULTS_PATH=$(readlink -f /var/tmp/test_results/current)
|
||||
sudo dmesg > $RESULTS_PATH/dmesg
|
||||
sudo cp /var/log/syslog $RESULTS_PATH/
|
||||
sudo cp /var/log/syslog /var/tmp/dmesg-prerun $RESULTS_PATH/
|
||||
sudo chmod +r $RESULTS_PATH/*
|
||||
# Replace ':' in dir names, actions/upload-artifact doesn't support it
|
||||
for f in $(find /var/tmp/test_results -name '*:*'); do mv "$f" "${f//:/__}"; done
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
with:
|
||||
name: Test logs
|
||||
path: /var/tmp/test_results/20*/
|
||||
name: Test logs Ubuntu-${{ matrix.os }}
|
||||
path: |
|
||||
/var/tmp/test_results/*
|
||||
!/var/tmp/test_results/current
|
||||
if-no-files-found: ignore
|
||||
|
||||
+10
-12
@@ -6,7 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
TEST_DIR: /var/tmp/zloop
|
||||
steps:
|
||||
@@ -15,15 +15,12 @@ jobs:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install --yes -qq build-essential autoconf libtool gdb \
|
||||
git alien fakeroot \
|
||||
zlib1g-dev uuid-dev libblkid-dev libselinux-dev \
|
||||
xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \
|
||||
libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \
|
||||
libpam0g-dev \
|
||||
python-dev python-setuptools python-cffi python-packaging \
|
||||
python3 python3-dev python3-setuptools python3-cffi python3-packaging
|
||||
# https://github.com/orgs/community/discussions/47863
|
||||
sudo apt-mark hold grub-efi-amd64-signed
|
||||
sudo apt-get update --fix-missing
|
||||
sudo apt-get upgrade
|
||||
sudo xargs --arg-file=${{ github.workspace }}/.github/workflows/build-dependencies.txt apt-get install -qq
|
||||
sudo apt-get clean
|
||||
- name: Autogen.sh
|
||||
run: |
|
||||
sh autogen.sh
|
||||
@@ -44,8 +41,9 @@ jobs:
|
||||
- name: Tests
|
||||
run: |
|
||||
sudo mkdir -p $TEST_DIR
|
||||
# run for 20 minutes to have a total runner time of 30 minutes
|
||||
sudo /usr/share/zfs/zloop.sh -t 1200 -l -m1 -- -T 120 -P 60
|
||||
# run for 10 minutes or at most 2 iterations for a maximum runner
|
||||
# time of 20 minutes.
|
||||
sudo /usr/share/zfs/zloop.sh -t 600 -I 2 -l -m1 -- -T 120 -P 60
|
||||
- name: Prepare artifacts
|
||||
if: failure()
|
||||
run: |
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
Meta: 1
|
||||
Name: zfs
|
||||
Branch: 1.0
|
||||
Version: 2.1.9
|
||||
Version: 2.1.15
|
||||
Release: 1
|
||||
Release-Tags: relext
|
||||
License: CDDL
|
||||
Author: OpenZFS
|
||||
Linux-Maximum: 6.1
|
||||
Linux-Maximum: 6.7
|
||||
Linux-Minimum: 3.10
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
bin_SCRIPTS = arc_summary
|
||||
|
||||
CLEANFILES = arc_summary
|
||||
EXTRA_DIST = arc_summary2 arc_summary3
|
||||
|
||||
if USING_PYTHON_2
|
||||
SCRIPT = arc_summary2
|
||||
else
|
||||
EXTRA_DIST = arc_summary3
|
||||
SCRIPT = arc_summary3
|
||||
endif
|
||||
|
||||
arc_summary: $(SCRIPT)
|
||||
cp $< $@
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -191,21 +191,13 @@ elif sys.platform.startswith('linux'):
|
||||
# there, so we fall back on modinfo
|
||||
command = ["/sbin/modinfo", request, "-0"]
|
||||
|
||||
# The recommended way to do this is with subprocess.run(). However,
|
||||
# some installed versions of Python are < 3.5, so we offer them
|
||||
# the option of doing it the old way (for now)
|
||||
info = ''
|
||||
|
||||
try:
|
||||
|
||||
if 'run' in dir(subprocess):
|
||||
info = subprocess.run(command, stdout=subprocess.PIPE,
|
||||
universal_newlines=True)
|
||||
raw_output = info.stdout.split('\0')
|
||||
else:
|
||||
info = subprocess.check_output(command,
|
||||
universal_newlines=True)
|
||||
raw_output = info.split('\0')
|
||||
info = subprocess.run(command, stdout=subprocess.PIPE,
|
||||
check=True, universal_newlines=True)
|
||||
raw_output = info.stdout.split('\0')
|
||||
|
||||
except subprocess.CalledProcessError:
|
||||
print("Error: Descriptions not available",
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
# @hdr is the array of fields that needs to be printed, so we
|
||||
# just iterate over this array and print the values using our pretty printer.
|
||||
#
|
||||
# This script must remain compatible with Python 2.6+ and Python 3.4+.
|
||||
# This script must remain compatible with Python 3.6+.
|
||||
#
|
||||
|
||||
import sys
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# Copyright (C) 2013 Lawrence Livermore National Security, LLC.
|
||||
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
||||
#
|
||||
# This script must remain compatible with Python 2.6+ and Python 3.4+.
|
||||
# This script must remain compatible with and Python 3.6+.
|
||||
#
|
||||
|
||||
import sys
|
||||
|
||||
+11
-2
@@ -3102,13 +3102,22 @@ dump_znode_sa_xattr(sa_handle_t *hdl)
|
||||
(void) printf("\tSA xattrs: %d bytes, %d entries\n\n",
|
||||
sa_xattr_size, sa_xattr_entries);
|
||||
while ((elem = nvlist_next_nvpair(sa_xattr, elem)) != NULL) {
|
||||
boolean_t can_print = !dump_opt['P'];
|
||||
uchar_t *value;
|
||||
uint_t cnt, idx;
|
||||
|
||||
(void) printf("\t\t%s = ", nvpair_name(elem));
|
||||
nvpair_value_byte_array(elem, &value, &cnt);
|
||||
|
||||
for (idx = 0; idx < cnt; ++idx) {
|
||||
if (isprint(value[idx]))
|
||||
if (!isprint(value[idx])) {
|
||||
can_print = B_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (idx = 0; idx < cnt; ++idx) {
|
||||
if (can_print)
|
||||
(void) putchar(value[idx]);
|
||||
else
|
||||
(void) printf("\\%3.3o", value[idx]);
|
||||
@@ -4806,7 +4815,7 @@ dump_label(const char *dev)
|
||||
if (nvlist_size(config, &size, NV_ENCODE_XDR) != 0)
|
||||
size = buflen;
|
||||
|
||||
/* If the device is a cache device clear the header. */
|
||||
/* If the device is a cache device read the header. */
|
||||
if (!read_l2arc_header) {
|
||||
if (nvlist_lookup_uint64(config,
|
||||
ZPOOL_CONFIG_POOL_STATE, &l2cache) == 0 &&
|
||||
|
||||
+40
-16
@@ -80,6 +80,7 @@ zfs_agent_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *arg)
|
||||
char *path = NULL;
|
||||
uint_t c, children;
|
||||
nvlist_t **child;
|
||||
uint64_t vdev_guid;
|
||||
|
||||
/*
|
||||
* First iterate over any children.
|
||||
@@ -100,7 +101,7 @@ zfs_agent_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *arg)
|
||||
&child, &children) == 0) {
|
||||
for (c = 0; c < children; c++) {
|
||||
if (zfs_agent_iter_vdev(zhp, child[c], gsp)) {
|
||||
gsp->gs_vdev_type = DEVICE_TYPE_L2ARC;
|
||||
gsp->gs_vdev_type = DEVICE_TYPE_SPARE;
|
||||
return (B_TRUE);
|
||||
}
|
||||
}
|
||||
@@ -109,7 +110,7 @@ zfs_agent_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *arg)
|
||||
&child, &children) == 0) {
|
||||
for (c = 0; c < children; c++) {
|
||||
if (zfs_agent_iter_vdev(zhp, child[c], gsp)) {
|
||||
gsp->gs_vdev_type = DEVICE_TYPE_SPARE;
|
||||
gsp->gs_vdev_type = DEVICE_TYPE_L2ARC;
|
||||
return (B_TRUE);
|
||||
}
|
||||
}
|
||||
@@ -126,6 +127,21 @@ zfs_agent_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *arg)
|
||||
&gsp->gs_vdev_expandtime);
|
||||
return (B_TRUE);
|
||||
}
|
||||
/*
|
||||
* Otherwise, on a vdev guid match, grab the devid and expansion
|
||||
* time. The devid might be missing on removal since its not part
|
||||
* of blkid cache and L2ARC VDEV does not contain pool guid in its
|
||||
* blkid, so this is a special case for L2ARC VDEV.
|
||||
*/
|
||||
else if (gsp->gs_vdev_guid != 0 && gsp->gs_devid == NULL &&
|
||||
nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_GUID, &vdev_guid) == 0 &&
|
||||
gsp->gs_vdev_guid == vdev_guid) {
|
||||
(void) nvlist_lookup_string(nvl, ZPOOL_CONFIG_DEVID,
|
||||
&gsp->gs_devid);
|
||||
(void) nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_EXPANSION_TIME,
|
||||
&gsp->gs_vdev_expandtime);
|
||||
return (B_TRUE);
|
||||
}
|
||||
|
||||
return (B_FALSE);
|
||||
}
|
||||
@@ -148,13 +164,13 @@ zfs_agent_iter_pool(zpool_handle_t *zhp, void *arg)
|
||||
/*
|
||||
* if a match was found then grab the pool guid
|
||||
*/
|
||||
if (gsp->gs_vdev_guid) {
|
||||
if (gsp->gs_vdev_guid && gsp->gs_devid) {
|
||||
(void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID,
|
||||
&gsp->gs_pool_guid);
|
||||
}
|
||||
|
||||
zpool_close(zhp);
|
||||
return (gsp->gs_vdev_guid != 0);
|
||||
return (gsp->gs_devid != NULL && gsp->gs_vdev_guid != 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -195,11 +211,13 @@ zfs_agent_post_event(const char *class, const char *subclass, nvlist_t *nvl)
|
||||
uint64_t pool_guid = 0, vdev_guid = 0;
|
||||
guid_search_t search = { 0 };
|
||||
device_type_t devtype = DEVICE_TYPE_PRIMARY;
|
||||
char *devid = NULL;
|
||||
|
||||
class = "resource.fs.zfs.removed";
|
||||
subclass = "";
|
||||
|
||||
(void) nvlist_add_string(payload, FM_CLASS, class);
|
||||
(void) nvlist_lookup_string(nvl, DEV_IDENTIFIER, &devid);
|
||||
(void) nvlist_lookup_uint64(nvl, ZFS_EV_POOL_GUID, &pool_guid);
|
||||
(void) nvlist_lookup_uint64(nvl, ZFS_EV_VDEV_GUID, &vdev_guid);
|
||||
|
||||
@@ -209,20 +227,24 @@ zfs_agent_post_event(const char *class, const char *subclass, nvlist_t *nvl)
|
||||
(void) nvlist_add_int64_array(payload, FM_EREPORT_TIME, tod, 2);
|
||||
|
||||
/*
|
||||
* If devid is missing but vdev_guid is available, find devid
|
||||
* and pool_guid from vdev_guid.
|
||||
* For multipath, spare and l2arc devices ZFS_EV_VDEV_GUID or
|
||||
* ZFS_EV_POOL_GUID may be missing so find them.
|
||||
*/
|
||||
if (pool_guid == 0 || vdev_guid == 0) {
|
||||
if ((nvlist_lookup_string(nvl, DEV_IDENTIFIER,
|
||||
&search.gs_devid) == 0) &&
|
||||
(zpool_iter(g_zfs_hdl, zfs_agent_iter_pool, &search)
|
||||
== 1)) {
|
||||
if (pool_guid == 0)
|
||||
pool_guid = search.gs_pool_guid;
|
||||
if (vdev_guid == 0)
|
||||
vdev_guid = search.gs_vdev_guid;
|
||||
devtype = search.gs_vdev_type;
|
||||
}
|
||||
if (devid == NULL || pool_guid == 0 || vdev_guid == 0) {
|
||||
if (devid == NULL)
|
||||
search.gs_vdev_guid = vdev_guid;
|
||||
else
|
||||
search.gs_devid = devid;
|
||||
zpool_iter(g_zfs_hdl, zfs_agent_iter_pool, &search);
|
||||
if (devid == NULL)
|
||||
devid = search.gs_devid;
|
||||
if (pool_guid == 0)
|
||||
pool_guid = search.gs_pool_guid;
|
||||
if (vdev_guid == 0)
|
||||
vdev_guid = search.gs_vdev_guid;
|
||||
devtype = search.gs_vdev_type;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -235,7 +257,9 @@ zfs_agent_post_event(const char *class, const char *subclass, nvlist_t *nvl)
|
||||
search.gs_vdev_expandtime + 10 > tv.tv_sec) {
|
||||
zed_log_msg(LOG_INFO, "agent post event: ignoring '%s' "
|
||||
"for recently expanded device '%s'", EC_DEV_REMOVE,
|
||||
search.gs_devid);
|
||||
devid);
|
||||
fnvlist_free(payload);
|
||||
free(event);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +141,17 @@ zfs_unavail_pool(zpool_handle_t *zhp, void *data)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write an array of strings to the zed log
|
||||
*/
|
||||
static void lines_to_zed_log_msg(char **lines, int lines_cnt)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < lines_cnt; i++) {
|
||||
zed_log_msg(LOG_INFO, "%s", lines[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Two stage replace on Linux
|
||||
* since we get disk notifications
|
||||
@@ -185,14 +196,18 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
||||
uint64_t wholedisk = 0ULL;
|
||||
uint64_t offline = 0ULL, faulted = 0ULL;
|
||||
uint64_t guid = 0ULL;
|
||||
uint64_t is_spare = 0;
|
||||
char *physpath = NULL, *new_devid = NULL, *enc_sysfs_path = NULL;
|
||||
char rawpath[PATH_MAX], fullpath[PATH_MAX];
|
||||
char devpath[PATH_MAX];
|
||||
int ret;
|
||||
int online_flag = ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE;
|
||||
boolean_t is_sd = B_FALSE;
|
||||
boolean_t is_mpath_wholedisk = B_FALSE;
|
||||
uint_t c;
|
||||
vdev_stat_t *vs;
|
||||
char **lines = NULL;
|
||||
int lines_cnt = 0;
|
||||
|
||||
if (nvlist_lookup_string(vdev, ZPOOL_CONFIG_PATH, &path) != 0)
|
||||
return;
|
||||
@@ -207,13 +222,18 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
||||
}
|
||||
|
||||
(void) nvlist_lookup_string(vdev, ZPOOL_CONFIG_PHYS_PATH, &physpath);
|
||||
|
||||
update_vdev_config_dev_sysfs_path(vdev, path,
|
||||
ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH);
|
||||
(void) nvlist_lookup_string(vdev, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH,
|
||||
&enc_sysfs_path);
|
||||
|
||||
(void) nvlist_lookup_uint64(vdev, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk);
|
||||
(void) nvlist_lookup_uint64(vdev, ZPOOL_CONFIG_OFFLINE, &offline);
|
||||
(void) nvlist_lookup_uint64(vdev, ZPOOL_CONFIG_FAULTED, &faulted);
|
||||
|
||||
(void) nvlist_lookup_uint64(vdev, ZPOOL_CONFIG_GUID, &guid);
|
||||
(void) nvlist_lookup_uint64(vdev, ZPOOL_CONFIG_IS_SPARE, &is_spare);
|
||||
|
||||
/*
|
||||
* Special case:
|
||||
@@ -304,11 +324,13 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
||||
}
|
||||
}
|
||||
|
||||
if (is_spare)
|
||||
online_flag |= ZFS_ONLINE_SPARE;
|
||||
|
||||
/*
|
||||
* Attempt to online the device.
|
||||
*/
|
||||
if (zpool_vdev_online(zhp, fullpath,
|
||||
ZFS_ONLINE_CHECKREMOVE | ZFS_ONLINE_UNSPARE, &newstate) == 0 &&
|
||||
if (zpool_vdev_online(zhp, fullpath, online_flag, &newstate) == 0 &&
|
||||
(newstate == VDEV_STATE_HEALTHY ||
|
||||
newstate == VDEV_STATE_DEGRADED)) {
|
||||
zed_log_msg(LOG_INFO,
|
||||
@@ -372,6 +394,22 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
||||
|
||||
if (is_mpath_wholedisk) {
|
||||
/* Don't label device mapper or multipath disks. */
|
||||
zed_log_msg(LOG_INFO,
|
||||
" it's a multipath wholedisk, don't label");
|
||||
if (zpool_prepare_disk(zhp, vdev, "autoreplace", &lines,
|
||||
&lines_cnt) != 0) {
|
||||
zed_log_msg(LOG_INFO,
|
||||
" zpool_prepare_disk: could not "
|
||||
"prepare '%s' (%s)", fullpath,
|
||||
libzfs_error_description(g_zfshdl));
|
||||
if (lines_cnt > 0) {
|
||||
zed_log_msg(LOG_INFO,
|
||||
" zfs_prepare_disk output:");
|
||||
lines_to_zed_log_msg(lines, lines_cnt);
|
||||
}
|
||||
libzfs_free_str_array(lines, lines_cnt);
|
||||
return;
|
||||
}
|
||||
} else if (!labeled) {
|
||||
/*
|
||||
* we're auto-replacing a raw disk, so label it first
|
||||
@@ -394,10 +432,18 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
||||
* If this is a request to label a whole disk, then attempt to
|
||||
* write out the label.
|
||||
*/
|
||||
if (zpool_label_disk(g_zfshdl, zhp, leafname) != 0) {
|
||||
zed_log_msg(LOG_INFO, " zpool_label_disk: could not "
|
||||
if (zpool_prepare_and_label_disk(g_zfshdl, zhp, leafname,
|
||||
vdev, "autoreplace", &lines, &lines_cnt) != 0) {
|
||||
zed_log_msg(LOG_INFO,
|
||||
" zpool_prepare_and_label_disk: could not "
|
||||
"label '%s' (%s)", leafname,
|
||||
libzfs_error_description(g_zfshdl));
|
||||
if (lines_cnt > 0) {
|
||||
zed_log_msg(LOG_INFO,
|
||||
" zfs_prepare_disk output:");
|
||||
lines_to_zed_log_msg(lines, lines_cnt);
|
||||
}
|
||||
libzfs_free_str_array(lines, lines_cnt);
|
||||
|
||||
(void) zpool_vdev_online(zhp, fullpath,
|
||||
ZFS_ONLINE_FORCEFAULT, &newstate);
|
||||
@@ -452,6 +498,8 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
||||
DEV_BYID_PATH, new_devid);
|
||||
}
|
||||
|
||||
libzfs_free_str_array(lines, lines_cnt);
|
||||
|
||||
/*
|
||||
* Construct the root vdev to pass to zpool_vdev_attach(). While adding
|
||||
* the entire vdev structure is harmless, we construct a reduced set of
|
||||
@@ -527,6 +575,7 @@ typedef struct dev_data {
|
||||
uint64_t dd_vdev_guid;
|
||||
uint64_t dd_new_vdev_guid;
|
||||
const char *dd_new_devid;
|
||||
uint64_t dd_num_spares;
|
||||
} dev_data_t;
|
||||
|
||||
static void
|
||||
@@ -537,6 +586,7 @@ zfs_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *data)
|
||||
uint_t c, children;
|
||||
nvlist_t **child;
|
||||
uint64_t guid = 0;
|
||||
uint64_t isspare = 0;
|
||||
|
||||
/*
|
||||
* First iterate over any children.
|
||||
@@ -562,7 +612,7 @@ zfs_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *data)
|
||||
}
|
||||
|
||||
/* once a vdev was matched and processed there is nothing left to do */
|
||||
if (dp->dd_found)
|
||||
if (dp->dd_found && dp->dd_num_spares == 0)
|
||||
return;
|
||||
(void) nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_GUID, &guid);
|
||||
|
||||
@@ -590,8 +640,6 @@ zfs_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *data)
|
||||
*/
|
||||
if (nvlist_lookup_string(nvl, dp->dd_prop, &path) != 0 ||
|
||||
strcmp(dp->dd_compare, path) != 0) {
|
||||
zed_log_msg(LOG_INFO, " %s: no match (%s != vdev %s)",
|
||||
__func__, dp->dd_compare, path);
|
||||
return;
|
||||
}
|
||||
if (dp->dd_new_vdev_guid != 0 && dp->dd_new_vdev_guid != guid) {
|
||||
@@ -612,6 +660,10 @@ zfs_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
if (dp->dd_found == B_TRUE && nvlist_lookup_uint64(nvl,
|
||||
ZPOOL_CONFIG_IS_SPARE, &isspare) == 0 && isspare)
|
||||
dp->dd_num_spares++;
|
||||
|
||||
(dp->dd_func)(zhp, nvl, dp->dd_islabeled);
|
||||
}
|
||||
|
||||
@@ -672,7 +724,9 @@ zfs_iter_pool(zpool_handle_t *zhp, void *data)
|
||||
}
|
||||
|
||||
zpool_close(zhp);
|
||||
return (dp->dd_found); /* cease iteration after a match */
|
||||
|
||||
/* cease iteration after a match */
|
||||
return (dp->dd_found && dp->dd_num_spares == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+112
-10
@@ -75,6 +75,8 @@ typedef struct find_cbdata {
|
||||
uint64_t cb_guid;
|
||||
zpool_handle_t *cb_zhp;
|
||||
nvlist_t *cb_vdev;
|
||||
uint64_t cb_vdev_guid;
|
||||
uint64_t cb_num_spares;
|
||||
} find_cbdata_t;
|
||||
|
||||
static int
|
||||
@@ -140,6 +142,64 @@ find_vdev(libzfs_handle_t *zhdl, nvlist_t *nv, uint64_t search_guid)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
remove_spares(zpool_handle_t *zhp, void *data)
|
||||
{
|
||||
nvlist_t *config, *nvroot;
|
||||
nvlist_t **spares;
|
||||
uint_t nspares;
|
||||
char *devname;
|
||||
find_cbdata_t *cbp = data;
|
||||
uint64_t spareguid = 0;
|
||||
vdev_stat_t *vs;
|
||||
unsigned int c;
|
||||
|
||||
config = zpool_get_config(zhp, NULL);
|
||||
if (nvlist_lookup_nvlist(config,
|
||||
ZPOOL_CONFIG_VDEV_TREE, &nvroot) != 0) {
|
||||
zpool_close(zhp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_SPARES,
|
||||
&spares, &nspares) != 0) {
|
||||
zpool_close(zhp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < nspares; i++) {
|
||||
if (nvlist_lookup_uint64(spares[i], ZPOOL_CONFIG_GUID,
|
||||
&spareguid) == 0 && spareguid == cbp->cb_vdev_guid) {
|
||||
devname = zpool_vdev_name(NULL, zhp, spares[i],
|
||||
B_FALSE);
|
||||
nvlist_lookup_uint64_array(spares[i],
|
||||
ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &c);
|
||||
if (vs->vs_state != VDEV_STATE_REMOVED &&
|
||||
zpool_vdev_remove_wanted(zhp, devname) == 0)
|
||||
cbp->cb_num_spares++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
zpool_close(zhp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a vdev guid, find and remove all spares associated with it.
|
||||
*/
|
||||
static int
|
||||
find_and_remove_spares(libzfs_handle_t *zhdl, uint64_t vdev_guid)
|
||||
{
|
||||
find_cbdata_t cb;
|
||||
|
||||
cb.cb_num_spares = 0;
|
||||
cb.cb_vdev_guid = vdev_guid;
|
||||
zpool_iter(zhdl, remove_spares, &cb);
|
||||
|
||||
return (cb.cb_num_spares);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a (pool, vdev) GUID pair, find the matching pool and vdev.
|
||||
*/
|
||||
@@ -315,6 +375,8 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
|
||||
libzfs_handle_t *zhdl = zdp->zrd_hdl;
|
||||
boolean_t fault_device, degrade_device;
|
||||
boolean_t is_repair;
|
||||
boolean_t l2arc = B_FALSE;
|
||||
boolean_t spare = B_FALSE;
|
||||
char *scheme;
|
||||
nvlist_t *vdev = NULL;
|
||||
char *uuid;
|
||||
@@ -323,6 +385,8 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
|
||||
boolean_t is_disk;
|
||||
vdev_aux_t aux;
|
||||
uint64_t state = 0;
|
||||
vdev_stat_t *vs;
|
||||
unsigned int c;
|
||||
|
||||
fmd_hdl_debug(hdl, "zfs_retire_recv: '%s'", class);
|
||||
|
||||
@@ -339,10 +403,31 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
|
||||
char *devtype;
|
||||
char *devname;
|
||||
|
||||
if (nvlist_lookup_string(nvl, FM_EREPORT_PAYLOAD_ZFS_VDEV_TYPE,
|
||||
&devtype) == 0) {
|
||||
if (strcmp(devtype, VDEV_TYPE_SPARE) == 0)
|
||||
spare = B_TRUE;
|
||||
else if (strcmp(devtype, VDEV_TYPE_L2CACHE) == 0)
|
||||
l2arc = B_TRUE;
|
||||
}
|
||||
|
||||
if (nvlist_lookup_uint64(nvl,
|
||||
FM_EREPORT_PAYLOAD_ZFS_VDEV_GUID, &vdev_guid) != 0)
|
||||
return;
|
||||
|
||||
if (vdev_guid == 0) {
|
||||
fmd_hdl_debug(hdl, "Got a zero GUID");
|
||||
return;
|
||||
}
|
||||
|
||||
if (spare) {
|
||||
int nspares = find_and_remove_spares(zhdl, vdev_guid);
|
||||
fmd_hdl_debug(hdl, "%d spares removed", nspares);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nvlist_lookup_uint64(nvl, FM_EREPORT_PAYLOAD_ZFS_POOL_GUID,
|
||||
&pool_guid) != 0 ||
|
||||
nvlist_lookup_uint64(nvl, FM_EREPORT_PAYLOAD_ZFS_VDEV_GUID,
|
||||
&vdev_guid) != 0)
|
||||
&pool_guid) != 0)
|
||||
return;
|
||||
|
||||
if ((zhp = find_by_guid(zhdl, pool_guid, vdev_guid,
|
||||
@@ -351,13 +436,30 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
|
||||
|
||||
devname = zpool_vdev_name(NULL, zhp, vdev, B_FALSE);
|
||||
|
||||
/* Can't replace l2arc with a spare: offline the device */
|
||||
if (nvlist_lookup_string(nvl, FM_EREPORT_PAYLOAD_ZFS_VDEV_TYPE,
|
||||
&devtype) == 0 && strcmp(devtype, VDEV_TYPE_L2CACHE) == 0) {
|
||||
fmd_hdl_debug(hdl, "zpool_vdev_offline '%s'", devname);
|
||||
zpool_vdev_offline(zhp, devname, B_TRUE);
|
||||
} else if (!fmd_prop_get_int32(hdl, "spare_on_remove") ||
|
||||
replace_with_spare(hdl, zhp, vdev) == B_FALSE) {
|
||||
nvlist_lookup_uint64_array(vdev, ZPOOL_CONFIG_VDEV_STATS,
|
||||
(uint64_t **)&vs, &c);
|
||||
|
||||
/*
|
||||
* If state removed is requested for already removed vdev,
|
||||
* its a loopback event from spa_async_remove(). Just
|
||||
* ignore it.
|
||||
*/
|
||||
if (vs->vs_state == VDEV_STATE_REMOVED &&
|
||||
state == VDEV_STATE_REMOVED)
|
||||
return;
|
||||
|
||||
/* Remove the vdev since device is unplugged */
|
||||
int remove_status = 0;
|
||||
if (l2arc || (strcmp(class, "resource.fs.zfs.removed") == 0)) {
|
||||
remove_status = zpool_vdev_remove_wanted(zhp, devname);
|
||||
fmd_hdl_debug(hdl, "zpool_vdev_remove_wanted '%s'"
|
||||
", err:%d", devname, libzfs_errno(zhdl));
|
||||
}
|
||||
|
||||
/* Replace the vdev with a spare if its not a l2arc */
|
||||
if (!l2arc && !remove_status &&
|
||||
(!fmd_prop_get_int32(hdl, "spare_on_remove") ||
|
||||
replace_with_spare(hdl, zhp, vdev) == B_FALSE)) {
|
||||
/* Could not handle with spare */
|
||||
fmd_hdl_debug(hdl, "no spare for '%s'", devname);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ dist_zedexec_SCRIPTS = \
|
||||
scrub_finish-notify.sh \
|
||||
statechange-led.sh \
|
||||
statechange-notify.sh \
|
||||
statechange-slot_off.sh \
|
||||
vdev_clear-led.sh \
|
||||
vdev_attach-led.sh \
|
||||
pool_import-led.sh \
|
||||
@@ -39,6 +40,7 @@ zedconfdefaults = \
|
||||
scrub_finish-notify.sh \
|
||||
statechange-led.sh \
|
||||
statechange-notify.sh \
|
||||
statechange-slot_off.sh \
|
||||
vdev_clear-led.sh \
|
||||
vdev_attach-led.sh \
|
||||
pool_import-led.sh \
|
||||
|
||||
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
# shellcheck disable=SC3014,SC2154,SC2086,SC2034
|
||||
#
|
||||
# Turn off disk's enclosure slot if it becomes FAULTED.
|
||||
#
|
||||
# Bad SCSI disks can often "disappear and reappear" causing all sorts of chaos
|
||||
# as they flip between FAULTED and ONLINE. If
|
||||
# ZED_POWER_OFF_ENCLOSURE_SLOT_ON_FAULT is set in zed.rc, and the disk gets
|
||||
# FAULTED, then power down the slot via sysfs:
|
||||
#
|
||||
# /sys/class/enclosure/<enclosure>/<slot>/power_status
|
||||
#
|
||||
# We assume the user will be responsible for turning the slot back on again.
|
||||
#
|
||||
# Note that this script requires that your enclosure be supported by the
|
||||
# Linux SCSI Enclosure services (SES) driver. The script will do nothing
|
||||
# if you have no enclosure, or if your enclosure isn't supported.
|
||||
#
|
||||
# Exit codes:
|
||||
# 0: slot successfully powered off
|
||||
# 1: enclosure not available
|
||||
# 2: ZED_POWER_OFF_ENCLOSURE_SLOT_ON_FAULT disabled
|
||||
# 3: vdev was not FAULTED
|
||||
# 4: The enclosure sysfs path passed from ZFS does not exist
|
||||
# 5: Enclosure slot didn't actually turn off after we told it to
|
||||
|
||||
[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc"
|
||||
. "${ZED_ZEDLET_DIR}/zed-functions.sh"
|
||||
|
||||
if [ ! -d /sys/class/enclosure ] ; then
|
||||
# No JBOD enclosure or NVMe slots
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${ZED_POWER_OFF_ENCLOSURE_SLOT_ON_FAULT}" != "1" ] ; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "$ZEVENT_VDEV_STATE_STR" != "FAULTED" ] ; then
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ ! -f "$ZEVENT_VDEV_ENC_SYSFS_PATH/power_status" ] ; then
|
||||
exit 4
|
||||
fi
|
||||
|
||||
# Turn off the slot and wait for sysfs to report that the slot is off.
|
||||
# It can take ~400ms on some enclosures and multiple retries may be needed.
|
||||
for i in $(seq 1 20) ; do
|
||||
echo "off" | tee "$ZEVENT_VDEV_ENC_SYSFS_PATH/power_status"
|
||||
|
||||
for j in $(seq 1 5) ; do
|
||||
if [ "$(cat $ZEVENT_VDEV_ENC_SYSFS_PATH/power_status)" == "off" ] ; then
|
||||
break 2
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
done
|
||||
|
||||
if [ "$(cat $ZEVENT_VDEV_ENC_SYSFS_PATH/power_status)" != "off" ] ; then
|
||||
exit 5
|
||||
fi
|
||||
|
||||
zed_log_msg "powered down slot $ZEVENT_VDEV_ENC_SYSFS_PATH for $ZEVENT_VDEV_PATH"
|
||||
@@ -143,3 +143,8 @@ ZED_SYSLOG_SUBCLASS_EXCLUDE="history_event"
|
||||
# Disabled by default, 1 to enable and 0 to disable.
|
||||
#ZED_SYSLOG_DISPLAY_GUIDS=1
|
||||
|
||||
##
|
||||
# Power off the drive's slot in the enclosure if it becomes FAULTED. This can
|
||||
# help silence misbehaving drives. This assumes your drive enclosure fully
|
||||
# supports slot power control via sysfs.
|
||||
#ZED_POWER_OFF_ENCLOSURE_SLOT_ON_FAULT=1
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "zed_strings.h"
|
||||
|
||||
#include "agents/zfs_agents.h"
|
||||
#include <libzutil.h>
|
||||
|
||||
#define MAXBUF 4096
|
||||
|
||||
@@ -907,6 +908,25 @@ _zed_event_add_time_strings(uint64_t eid, zed_strings_t *zsp, int64_t etime[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_zed_event_update_enc_sysfs_path(nvlist_t *nvl)
|
||||
{
|
||||
char *vdev_path;
|
||||
|
||||
if (nvlist_lookup_string(nvl, FM_EREPORT_PAYLOAD_ZFS_VDEV_PATH,
|
||||
&vdev_path) != 0) {
|
||||
return; /* some other kind of event, ignore it */
|
||||
}
|
||||
|
||||
if (vdev_path == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
update_vdev_config_dev_sysfs_path(nvl, vdev_path,
|
||||
FM_EREPORT_PAYLOAD_ZFS_VDEV_ENC_SYSFS_PATH);
|
||||
}
|
||||
|
||||
/*
|
||||
* Service the next zevent, blocking until one is available.
|
||||
*/
|
||||
@@ -954,6 +974,17 @@ zed_event_service(struct zed_conf *zcp)
|
||||
zed_log_msg(LOG_WARNING,
|
||||
"Failed to lookup zevent class (eid=%llu)", eid);
|
||||
} else {
|
||||
/*
|
||||
* Special case: If we can dynamically detect an enclosure sysfs
|
||||
* path, then use that value rather than the one stored in the
|
||||
* vd->vdev_enc_sysfs_path. There have been rare cases where
|
||||
* vd->vdev_enc_sysfs_path becomes outdated. However, there
|
||||
* will be other times when we can not dynamically detect the
|
||||
* sysfs path (like if a disk disappears) and have to rely on
|
||||
* the old value for things like turning on the fault LED.
|
||||
*/
|
||||
_zed_event_update_enc_sysfs_path(nvl);
|
||||
|
||||
/* let internal modules see this event first */
|
||||
zfs_agent_post_event(class, NULL, nvl);
|
||||
|
||||
|
||||
+57
-8
@@ -315,14 +315,14 @@ get_usage(zfs_help_t idx)
|
||||
case HELP_ROLLBACK:
|
||||
return (gettext("\trollback [-rRf] <snapshot>\n"));
|
||||
case HELP_SEND:
|
||||
return (gettext("\tsend [-DnPpRvLecwhb] [-[i|I] snapshot] "
|
||||
return (gettext("\tsend [-DnPpRVvLecwhb] [-[i|I] snapshot] "
|
||||
"<snapshot>\n"
|
||||
"\tsend [-DnvPLecw] [-i snapshot|bookmark] "
|
||||
"\tsend [-DnVvPLecw] [-i snapshot|bookmark] "
|
||||
"<filesystem|volume|snapshot>\n"
|
||||
"\tsend [-DnPpvLec] [-i bookmark|snapshot] "
|
||||
"\tsend [-DnPpVvLec] [-i bookmark|snapshot] "
|
||||
"--redact <bookmark> <snapshot>\n"
|
||||
"\tsend [-nvPe] -t <receive_resume_token>\n"
|
||||
"\tsend [-Pnv] --saved filesystem\n"));
|
||||
"\tsend [-nVvPe] -t <receive_resume_token>\n"
|
||||
"\tsend [-PnVv] --saved filesystem\n"));
|
||||
case HELP_SET:
|
||||
return (gettext("\tset <property=value> ... "
|
||||
"<filesystem|volume|snapshot> ...\n"));
|
||||
@@ -535,7 +535,7 @@ usage(boolean_t requested)
|
||||
show_properties = B_TRUE;
|
||||
|
||||
if (show_properties) {
|
||||
(void) fprintf(fp,
|
||||
(void) fprintf(fp, "%s",
|
||||
gettext("\nThe following properties are supported:\n"));
|
||||
|
||||
(void) fprintf(fp, "\n\t%-14s %s %s %s\n\n",
|
||||
@@ -3474,6 +3474,8 @@ print_header(list_cbdata_t *cb)
|
||||
boolean_t first = B_TRUE;
|
||||
boolean_t right_justify;
|
||||
|
||||
color_start(ANSI_BOLD);
|
||||
|
||||
for (; pl != NULL; pl = pl->pl_next) {
|
||||
if (!first) {
|
||||
(void) printf(" ");
|
||||
@@ -3500,9 +3502,31 @@ print_header(list_cbdata_t *cb)
|
||||
(void) printf("%-*s", (int)pl->pl_width, header);
|
||||
}
|
||||
|
||||
color_end();
|
||||
|
||||
(void) printf("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Decides on the color that the avail value should be printed in.
|
||||
* > 80% used = yellow
|
||||
* > 90% used = red
|
||||
*/
|
||||
static const char *
|
||||
zfs_list_avail_color(zfs_handle_t *zhp)
|
||||
{
|
||||
uint64_t used = zfs_prop_get_int(zhp, ZFS_PROP_USED);
|
||||
uint64_t avail = zfs_prop_get_int(zhp, ZFS_PROP_AVAILABLE);
|
||||
int percentage = (int)((double)avail / MAX(avail + used, 1) * 100);
|
||||
|
||||
if (percentage > 20)
|
||||
return (NULL);
|
||||
else if (percentage > 10)
|
||||
return (ANSI_YELLOW);
|
||||
else
|
||||
return (ANSI_RED);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a dataset and a list of fields, print out all the properties according
|
||||
* to the described layout.
|
||||
@@ -3565,6 +3589,22 @@ print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
|
||||
right_justify = B_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* zfs_list_avail_color() needs ZFS_PROP_AVAILABLE + USED
|
||||
* - so we need another for() search for the USED part
|
||||
* - when no colors wanted, we can skip the whole thing
|
||||
*/
|
||||
if (use_color() && pl->pl_prop == ZFS_PROP_AVAILABLE) {
|
||||
zprop_list_t *pl2 = cb->cb_proplist;
|
||||
for (; pl2 != NULL; pl2 = pl2->pl_next) {
|
||||
if (pl2->pl_prop == ZFS_PROP_USED) {
|
||||
color_start(zfs_list_avail_color(zhp));
|
||||
/* found it, no need for more loops */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If this is being called in scripted mode, or if this is the
|
||||
* last column and it is left-justified, don't include a width
|
||||
@@ -3576,6 +3616,9 @@ print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
|
||||
(void) printf("%*s", (int)pl->pl_width, propstr);
|
||||
else
|
||||
(void) printf("%-*s", (int)pl->pl_width, propstr);
|
||||
|
||||
if (pl->pl_prop == ZFS_PROP_AVAILABLE)
|
||||
color_end();
|
||||
}
|
||||
|
||||
(void) printf("\n");
|
||||
@@ -4407,6 +4450,7 @@ zfs_do_send(int argc, char **argv)
|
||||
{"props", no_argument, NULL, 'p'},
|
||||
{"parsable", no_argument, NULL, 'P'},
|
||||
{"dedup", no_argument, NULL, 'D'},
|
||||
{"proctitle", no_argument, NULL, 'V'},
|
||||
{"verbose", no_argument, NULL, 'v'},
|
||||
{"dryrun", no_argument, NULL, 'n'},
|
||||
{"large-block", no_argument, NULL, 'L'},
|
||||
@@ -4421,7 +4465,7 @@ zfs_do_send(int argc, char **argv)
|
||||
};
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt_long(argc, argv, ":i:I:RsDpvnPLeht:cwbd:S",
|
||||
while ((c = getopt_long(argc, argv, ":i:I:RsDpVvnPLeht:cwbd:S",
|
||||
long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'i':
|
||||
@@ -4456,6 +4500,9 @@ zfs_do_send(int argc, char **argv)
|
||||
case 'P':
|
||||
flags.parsable = B_TRUE;
|
||||
break;
|
||||
case 'V':
|
||||
flags.progressastitle = B_TRUE;
|
||||
break;
|
||||
case 'v':
|
||||
flags.verbosity++;
|
||||
flags.progress = B_TRUE;
|
||||
@@ -4531,7 +4578,7 @@ zfs_do_send(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (flags.parsable && flags.verbosity == 0)
|
||||
if ((flags.parsable || flags.progressastitle) && flags.verbosity == 0)
|
||||
flags.verbosity = 1;
|
||||
|
||||
argc -= optind;
|
||||
@@ -8693,6 +8740,8 @@ main(int argc, char **argv)
|
||||
|
||||
libzfs_print_on_error(g_zfs, B_TRUE);
|
||||
|
||||
zfs_setproctitle_init(argc, argv, environ);
|
||||
|
||||
/*
|
||||
* Many commands modify input strings for string parsing reasons.
|
||||
* We create a copy to protect the original argv.
|
||||
|
||||
@@ -116,3 +116,24 @@ after_zpool_upgrade(zpool_handle_t *zhp)
|
||||
"details.\n"), zpool_get_name(zhp));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
zpool_power_current_state(zpool_handle_t *zhp, char *vdev)
|
||||
{
|
||||
|
||||
(void) zhp;
|
||||
(void) vdev;
|
||||
/* Enclosure slot power not supported on FreeBSD yet */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
int
|
||||
zpool_power(zpool_handle_t *zhp, char *vdev, boolean_t turn_on)
|
||||
{
|
||||
|
||||
(void) zhp;
|
||||
(void) vdev;
|
||||
(void) turn_on;
|
||||
/* Enclosure slot power not supported on FreeBSD yet */
|
||||
return (ENOTSUP);
|
||||
}
|
||||
|
||||
@@ -410,3 +410,258 @@ void
|
||||
after_zpool_upgrade(zpool_handle_t *zhp)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Read from a sysfs file and return an allocated string. Removes
|
||||
* the newline from the end of the string if there is one.
|
||||
*
|
||||
* Returns a string on success (which must be freed), or NULL on error.
|
||||
*/
|
||||
static char *zpool_sysfs_gets(char *path)
|
||||
{
|
||||
int fd;
|
||||
struct stat statbuf;
|
||||
char *buf = NULL;
|
||||
ssize_t count = 0;
|
||||
fd = open(path, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return (NULL);
|
||||
|
||||
if (fstat(fd, &statbuf) != 0) {
|
||||
close(fd);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
buf = calloc(sizeof (*buf), statbuf.st_size + 1);
|
||||
if (buf == NULL) {
|
||||
close(fd);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Note, we can read less bytes than st_size, and that's ok. Sysfs
|
||||
* files will report their size is 4k even if they only return a small
|
||||
* string.
|
||||
*/
|
||||
count = read(fd, buf, statbuf.st_size);
|
||||
if (count < 0) {
|
||||
/* Error doing read() or we overran the buffer */
|
||||
close(fd);
|
||||
free(buf);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Remove trailing newline */
|
||||
if (buf[count - 1] == '\n')
|
||||
buf[count - 1] = 0;
|
||||
|
||||
close(fd);
|
||||
|
||||
return (buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a string to a sysfs file.
|
||||
*
|
||||
* Returns 0 on success, non-zero otherwise.
|
||||
*/
|
||||
static int zpool_sysfs_puts(char *path, char *str)
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
file = fopen(path, "w");
|
||||
if (!file) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (fputs(str, file) < 0) {
|
||||
fclose(file);
|
||||
return (-2);
|
||||
}
|
||||
fclose(file);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Given a vdev nvlist_t, rescan its enclosure sysfs path */
|
||||
static void
|
||||
rescan_vdev_config_dev_sysfs_path(nvlist_t *vdev_nv)
|
||||
{
|
||||
update_vdev_config_dev_sysfs_path(vdev_nv,
|
||||
fnvlist_lookup_string(vdev_nv, ZPOOL_CONFIG_PATH),
|
||||
ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a power string: "on", "off", "1", or "0", return 0 if it's an
|
||||
* off value, 1 if it's an on value, and -1 if the value is unrecognized.
|
||||
*/
|
||||
static int zpool_power_parse_value(char *str)
|
||||
{
|
||||
if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0))
|
||||
return (0);
|
||||
|
||||
if ((strcmp(str, "on") == 0) || (strcmp(str, "1") == 0))
|
||||
return (1);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a vdev string return an allocated string containing the sysfs path to
|
||||
* its power control file. Also do a check if the power control file really
|
||||
* exists and has correct permissions.
|
||||
*
|
||||
* Example returned strings:
|
||||
*
|
||||
* /sys/class/enclosure/0:0:122:0/10/power_status
|
||||
* /sys/bus/pci/slots/10/power
|
||||
*
|
||||
* Returns allocated string on success (which must be freed), NULL on failure.
|
||||
*/
|
||||
static char *
|
||||
zpool_power_sysfs_path(zpool_handle_t *zhp, char *vdev)
|
||||
{
|
||||
char *enc_sysfs_dir = NULL;
|
||||
char *path = NULL;
|
||||
nvlist_t *vdev_nv = zpool_find_vdev(zhp, vdev, NULL, NULL, NULL);
|
||||
|
||||
if (vdev_nv == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Make sure we're getting the updated enclosure sysfs path */
|
||||
rescan_vdev_config_dev_sysfs_path(vdev_nv);
|
||||
|
||||
if (nvlist_lookup_string(vdev_nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH,
|
||||
&enc_sysfs_dir) != 0) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (asprintf(&path, "%s/power_status", enc_sysfs_dir) == -1)
|
||||
return (NULL);
|
||||
|
||||
if (access(path, W_OK) != 0) {
|
||||
free(path);
|
||||
path = NULL;
|
||||
/* No HDD 'power_control' file, maybe it's NVMe? */
|
||||
if (asprintf(&path, "%s/power", enc_sysfs_dir) == -1) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (access(path, R_OK | W_OK) != 0) {
|
||||
/* Not NVMe either */
|
||||
free(path);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a path to a sysfs power control file, return B_TRUE if you should use
|
||||
* "on/off" words to control it, or B_FALSE otherwise ("0/1" to control).
|
||||
*/
|
||||
static boolean_t
|
||||
zpool_power_use_word(char *sysfs_path)
|
||||
{
|
||||
if (strcmp(&sysfs_path[strlen(sysfs_path) - strlen("power_status")],
|
||||
"power_status") == 0) {
|
||||
return (B_TRUE);
|
||||
}
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the sysfs power control value for a vdev.
|
||||
*
|
||||
* Returns:
|
||||
* 0 - Power is off
|
||||
* 1 - Power is on
|
||||
* -1 - Error or unsupported
|
||||
*/
|
||||
int
|
||||
zpool_power_current_state(zpool_handle_t *zhp, char *vdev)
|
||||
{
|
||||
char *val;
|
||||
int rc;
|
||||
|
||||
char *path = zpool_power_sysfs_path(zhp, vdev);
|
||||
if (path == NULL)
|
||||
return (-1);
|
||||
|
||||
val = zpool_sysfs_gets(path);
|
||||
if (val == NULL) {
|
||||
free(path);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
rc = zpool_power_parse_value(val);
|
||||
free(val);
|
||||
free(path);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Turn on or off the slot to a device
|
||||
*
|
||||
* Device path is the full path to the device (like /dev/sda or /dev/sda1).
|
||||
*
|
||||
* Return code:
|
||||
* 0: Success
|
||||
* ENOTSUP: Power control not supported for OS
|
||||
* EBADSLT: Couldn't read current power state
|
||||
* ENOENT: No sysfs path to power control
|
||||
* EIO: Couldn't write sysfs power value
|
||||
* EBADE: Sysfs power value didn't change
|
||||
*/
|
||||
int
|
||||
zpool_power(zpool_handle_t *zhp, char *vdev, boolean_t turn_on)
|
||||
{
|
||||
char *sysfs_path;
|
||||
const char *val;
|
||||
int rc;
|
||||
int timeout_ms;
|
||||
|
||||
rc = zpool_power_current_state(zhp, vdev);
|
||||
if (rc == -1) {
|
||||
return (EBADSLT);
|
||||
}
|
||||
|
||||
/* Already correct value? */
|
||||
if (rc == (int)turn_on)
|
||||
return (0);
|
||||
|
||||
sysfs_path = zpool_power_sysfs_path(zhp, vdev);
|
||||
if (sysfs_path == NULL)
|
||||
return (ENOENT);
|
||||
|
||||
if (zpool_power_use_word(sysfs_path)) {
|
||||
val = turn_on ? "on" : "off";
|
||||
} else {
|
||||
val = turn_on ? "1" : "0";
|
||||
}
|
||||
|
||||
rc = zpool_sysfs_puts(sysfs_path, (char *)val);
|
||||
|
||||
free(sysfs_path);
|
||||
if (rc != 0) {
|
||||
return (EIO);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait up to 30 seconds for sysfs power value to change after
|
||||
* writing it.
|
||||
*/
|
||||
timeout_ms = zpool_getenv_int("ZPOOL_POWER_ON_SLOT_TIMEOUT_MS", 30000);
|
||||
for (int i = 0; i < MAX(1, timeout_ms / 200); i++) {
|
||||
rc = zpool_power_current_state(zhp, vdev);
|
||||
if (rc == (int)turn_on)
|
||||
return (0); /* success */
|
||||
|
||||
fsleep(0.200); /* 200ms */
|
||||
}
|
||||
|
||||
/* sysfs value never changed */
|
||||
return (EBADE);
|
||||
}
|
||||
|
||||
+10
-2
@@ -32,10 +32,18 @@ for i in $scripts ; do
|
||||
val=""
|
||||
case $i in
|
||||
enc)
|
||||
val=$(ls "$VDEV_ENC_SYSFS_PATH/../../" 2>/dev/null)
|
||||
if echo "$VDEV_ENC_SYSFS_PATH" | grep -q '/sys/bus/pci/slots' ; then
|
||||
val="$VDEV_ENC_SYSFS_PATH"
|
||||
else
|
||||
val="$(ls """$VDEV_ENC_SYSFS_PATH/../../""" 2>/dev/null)"
|
||||
fi
|
||||
;;
|
||||
slot)
|
||||
val=$(cat "$VDEV_ENC_SYSFS_PATH/slot" 2>/dev/null)
|
||||
if echo "$VDEV_ENC_SYSFS_PATH" | grep -q '/sys/bus/pci/slots' ; then
|
||||
val="$(basename """$VDEV_ENC_SYSFS_PATH""")"
|
||||
else
|
||||
val="$(cat """$VDEV_ENC_SYSFS_PATH/slot""" 2>/dev/null)"
|
||||
fi
|
||||
;;
|
||||
encdev)
|
||||
val=$(ls "$VDEV_ENC_SYSFS_PATH/../device/scsi_generic" 2>/dev/null)
|
||||
|
||||
+12
-28
@@ -439,39 +439,23 @@ static void
|
||||
vdev_run_cmd(vdev_cmd_data_t *data, char *cmd)
|
||||
{
|
||||
int rc;
|
||||
char *argv[2] = {cmd, 0};
|
||||
char *env[5] = {"PATH=/bin:/sbin:/usr/bin:/usr/sbin", NULL, NULL, NULL,
|
||||
NULL};
|
||||
char *argv[2] = {cmd};
|
||||
char **env;
|
||||
char **lines = NULL;
|
||||
int lines_cnt = 0;
|
||||
int i;
|
||||
|
||||
/* Setup our custom environment variables */
|
||||
rc = asprintf(&env[1], "VDEV_PATH=%s",
|
||||
data->path ? data->path : "");
|
||||
if (rc == -1) {
|
||||
env[1] = NULL;
|
||||
env = zpool_vdev_script_alloc_env(data->pool, data->path, data->upath,
|
||||
data->vdev_enc_sysfs_path, NULL, NULL);
|
||||
if (env == NULL)
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = asprintf(&env[2], "VDEV_UPATH=%s",
|
||||
data->upath ? data->upath : "");
|
||||
if (rc == -1) {
|
||||
env[2] = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = asprintf(&env[3], "VDEV_ENC_SYSFS_PATH=%s",
|
||||
data->vdev_enc_sysfs_path ?
|
||||
data->vdev_enc_sysfs_path : "");
|
||||
if (rc == -1) {
|
||||
env[3] = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Run the command */
|
||||
rc = libzfs_run_process_get_stdout_nopath(cmd, argv, env, &lines,
|
||||
&lines_cnt);
|
||||
|
||||
zpool_vdev_script_free_env(env);
|
||||
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
|
||||
@@ -483,10 +467,6 @@ vdev_run_cmd(vdev_cmd_data_t *data, char *cmd)
|
||||
out:
|
||||
if (lines != NULL)
|
||||
libzfs_free_str_array(lines, lines_cnt);
|
||||
|
||||
/* Start with i = 1 since env[0] was statically allocated */
|
||||
for (i = 1; i < ARRAY_SIZE(env); i++)
|
||||
free(env[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -571,6 +551,10 @@ for_each_vdev_run_cb(void *zhp_data, nvlist_t *nv, void *cb_vcdl)
|
||||
if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) != 0)
|
||||
return (1);
|
||||
|
||||
/* Make sure we're getting the updated enclosure sysfs path */
|
||||
update_vdev_config_dev_sysfs_path(nv, path,
|
||||
ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH);
|
||||
|
||||
nvlist_lookup_string(nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH,
|
||||
&vdev_enc_sysfs_path);
|
||||
|
||||
|
||||
+363
-52
@@ -345,7 +345,7 @@ get_usage(zpool_help_t idx)
|
||||
return (gettext("\tattach [-fsw] [-o property=value] "
|
||||
"<pool> <device> <new-device>\n"));
|
||||
case HELP_CLEAR:
|
||||
return (gettext("\tclear [-nF] <pool> [device]\n"));
|
||||
return (gettext("\tclear [[--power]|[-nF]] <pool> [device]\n"));
|
||||
case HELP_CREATE:
|
||||
return (gettext("\tcreate [-fnd] [-o property=value] ... \n"
|
||||
"\t [-O file-system-property=value] ... \n"
|
||||
@@ -381,9 +381,11 @@ get_usage(zpool_help_t idx)
|
||||
"[-T d|u] [pool] ... \n"
|
||||
"\t [interval [count]]\n"));
|
||||
case HELP_OFFLINE:
|
||||
return (gettext("\toffline [-f] [-t] <pool> <device> ...\n"));
|
||||
return (gettext("\toffline [--power]|[[-f][-t]] <pool> "
|
||||
"<device> ...\n"));
|
||||
case HELP_ONLINE:
|
||||
return (gettext("\tonline [-e] <pool> <device> ...\n"));
|
||||
return (gettext("\tonline [--power][-e] <pool> <device> "
|
||||
"...\n"));
|
||||
case HELP_REPLACE:
|
||||
return (gettext("\treplace [-fsw] [-o property=value] "
|
||||
"<pool> <device> [new-device]\n"));
|
||||
@@ -392,7 +394,7 @@ get_usage(zpool_help_t idx)
|
||||
case HELP_REOPEN:
|
||||
return (gettext("\treopen [-n] <pool>\n"));
|
||||
case HELP_INITIALIZE:
|
||||
return (gettext("\tinitialize [-c | -s] [-w] <pool> "
|
||||
return (gettext("\tinitialize [-c | -s | -u] [-w] <pool> "
|
||||
"[<device> ...]\n"));
|
||||
case HELP_SCRUB:
|
||||
return (gettext("\tscrub [-s | -p] [-w] <pool> ...\n"));
|
||||
@@ -402,7 +404,7 @@ get_usage(zpool_help_t idx)
|
||||
return (gettext("\ttrim [-dw] [-r <rate>] [-c | -s] <pool> "
|
||||
"[<device> ...]\n"));
|
||||
case HELP_STATUS:
|
||||
return (gettext("\tstatus [-c [script1,script2,...]] "
|
||||
return (gettext("\tstatus [--power] [-c [script1,script2,...]] "
|
||||
"[-igLpPstvxD] [-T d|u] [pool] ... \n"
|
||||
"\t [interval [count]]\n"));
|
||||
case HELP_UPGRADE:
|
||||
@@ -485,6 +487,77 @@ print_prop_cb(int prop, void *cb)
|
||||
return (ZPROP_CONT);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a leaf vdev name like 'L5' return its VDEV_CONFIG_PATH like
|
||||
* '/dev/disk/by-vdev/L5'.
|
||||
*/
|
||||
static const char *
|
||||
vdev_name_to_path(zpool_handle_t *zhp, char *vdev)
|
||||
{
|
||||
nvlist_t *vdev_nv = zpool_find_vdev(zhp, vdev, NULL, NULL, NULL);
|
||||
if (vdev_nv == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
return (fnvlist_lookup_string(vdev_nv, ZPOOL_CONFIG_PATH));
|
||||
}
|
||||
|
||||
static int
|
||||
zpool_power_on(zpool_handle_t *zhp, char *vdev)
|
||||
{
|
||||
return (zpool_power(zhp, vdev, B_TRUE));
|
||||
}
|
||||
|
||||
static int
|
||||
zpool_power_on_and_disk_wait(zpool_handle_t *zhp, char *vdev)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = zpool_power_on(zhp, vdev);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
|
||||
zpool_disk_wait(vdev_name_to_path(zhp, vdev));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
zpool_power_on_pool_and_wait_for_devices(zpool_handle_t *zhp)
|
||||
{
|
||||
nvlist_t *nv;
|
||||
const char *path = NULL;
|
||||
int rc;
|
||||
|
||||
/* Power up all the devices first */
|
||||
FOR_EACH_REAL_LEAF_VDEV(zhp, nv) {
|
||||
path = fnvlist_lookup_string(nv, ZPOOL_CONFIG_PATH);
|
||||
if (path != NULL) {
|
||||
rc = zpool_power_on(zhp, (char *)path);
|
||||
if (rc != 0) {
|
||||
return (rc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for their devices to show up. Since we powered them on
|
||||
* at roughly the same time, they should all come online around
|
||||
* the same time.
|
||||
*/
|
||||
FOR_EACH_REAL_LEAF_VDEV(zhp, nv) {
|
||||
path = fnvlist_lookup_string(nv, ZPOOL_CONFIG_PATH);
|
||||
zpool_disk_wait(path);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
zpool_power_off(zpool_handle_t *zhp, char *vdev)
|
||||
{
|
||||
return (zpool_power(zhp, vdev, B_FALSE));
|
||||
}
|
||||
|
||||
/*
|
||||
* Display usage message. If we're inside a command, display only the usage for
|
||||
* that command. Otherwise, iterate over the entire command table and display
|
||||
@@ -519,7 +592,7 @@ usage(boolean_t requested)
|
||||
(strcmp(current_command->name, "get") == 0) ||
|
||||
(strcmp(current_command->name, "list") == 0))) {
|
||||
|
||||
(void) fprintf(fp,
|
||||
(void) fprintf(fp, "%s",
|
||||
gettext("\nthe following properties are supported:\n"));
|
||||
|
||||
(void) fprintf(fp, "\n\t%-19s %s %s\n\n",
|
||||
@@ -548,12 +621,13 @@ usage(boolean_t requested)
|
||||
}
|
||||
|
||||
/*
|
||||
* zpool initialize [-c | -s] [-w] <pool> [<vdev> ...]
|
||||
* zpool initialize [-c | -s | -u] [-w] <pool> [<vdev> ...]
|
||||
* Initialize all unused blocks in the specified vdevs, or all vdevs in the pool
|
||||
* if none specified.
|
||||
*
|
||||
* -c Cancel. Ends active initializing.
|
||||
* -s Suspend. Initializing can then be restarted with no flags.
|
||||
* -u Uninitialize. Clears initialization state.
|
||||
* -w Wait. Blocks until initializing has completed.
|
||||
*/
|
||||
int
|
||||
@@ -569,12 +643,14 @@ zpool_do_initialize(int argc, char **argv)
|
||||
struct option long_options[] = {
|
||||
{"cancel", no_argument, NULL, 'c'},
|
||||
{"suspend", no_argument, NULL, 's'},
|
||||
{"uninit", no_argument, NULL, 'u'},
|
||||
{"wait", no_argument, NULL, 'w'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
pool_initialize_func_t cmd_type = POOL_INITIALIZE_START;
|
||||
while ((c = getopt_long(argc, argv, "csw", long_options, NULL)) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "csuw", long_options,
|
||||
NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'c':
|
||||
if (cmd_type != POOL_INITIALIZE_START &&
|
||||
@@ -594,6 +670,15 @@ zpool_do_initialize(int argc, char **argv)
|
||||
}
|
||||
cmd_type = POOL_INITIALIZE_SUSPEND;
|
||||
break;
|
||||
case 'u':
|
||||
if (cmd_type != POOL_INITIALIZE_START &&
|
||||
cmd_type != POOL_INITIALIZE_UNINIT) {
|
||||
(void) fprintf(stderr, gettext("-u cannot be "
|
||||
"combined with other options\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
cmd_type = POOL_INITIALIZE_UNINIT;
|
||||
break;
|
||||
case 'w':
|
||||
wait = B_TRUE;
|
||||
break;
|
||||
@@ -620,8 +705,8 @@ zpool_do_initialize(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (wait && (cmd_type != POOL_INITIALIZE_START)) {
|
||||
(void) fprintf(stderr, gettext("-w cannot be used with -c or "
|
||||
"-s\n"));
|
||||
(void) fprintf(stderr, gettext("-w cannot be used with -c, -s"
|
||||
"or -u\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
|
||||
@@ -2042,11 +2127,13 @@ typedef struct status_cbdata {
|
||||
boolean_t cb_explain;
|
||||
boolean_t cb_first;
|
||||
boolean_t cb_dedup_stats;
|
||||
boolean_t cb_print_unhealthy;
|
||||
boolean_t cb_print_status;
|
||||
boolean_t cb_print_slow_ios;
|
||||
boolean_t cb_print_vdev_init;
|
||||
boolean_t cb_print_vdev_trim;
|
||||
vdev_cmd_data_list_t *vcdl;
|
||||
boolean_t cb_print_power;
|
||||
} status_cbdata_t;
|
||||
|
||||
/* Return 1 if string is NULL, empty, or whitespace; return 0 otherwise. */
|
||||
@@ -2239,6 +2326,35 @@ health_str_to_color(const char *health)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called for each leaf vdev. Returns 0 if the vdev is healthy.
|
||||
* A vdev is unhealthy if any of the following are true:
|
||||
* 1) there are read, write, or checksum errors,
|
||||
* 2) its state is not ONLINE, or
|
||||
* 3) slow IO reporting was requested (-s) and there are slow IOs.
|
||||
*/
|
||||
static int
|
||||
vdev_health_check_cb(void *hdl_data, nvlist_t *nv, void *data)
|
||||
{
|
||||
status_cbdata_t *cb = data;
|
||||
vdev_stat_t *vs;
|
||||
uint_t vsc;
|
||||
(void) hdl_data;
|
||||
|
||||
if (nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
|
||||
(uint64_t **)&vs, &vsc) != 0)
|
||||
return (1);
|
||||
|
||||
if (vs->vs_checksum_errors || vs->vs_read_errors ||
|
||||
vs->vs_write_errors || vs->vs_state != VDEV_STATE_HEALTHY)
|
||||
return (1);
|
||||
|
||||
if (cb->cb_print_slow_ios && vs->vs_slow_ios)
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print out configuration state as requested by status_callback.
|
||||
*/
|
||||
@@ -2257,7 +2373,8 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
|
||||
const char *state;
|
||||
char *type;
|
||||
char *path = NULL;
|
||||
char *rcolor = NULL, *wcolor = NULL, *ccolor = NULL;
|
||||
char *rcolor = NULL, *wcolor = NULL, *ccolor = NULL,
|
||||
*scolor = NULL;
|
||||
|
||||
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
|
||||
&child, &children) != 0)
|
||||
@@ -2284,6 +2401,15 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
|
||||
state = gettext("AVAIL");
|
||||
}
|
||||
|
||||
/*
|
||||
* If '-e' is specified then top-level vdevs and their children
|
||||
* can be pruned if all of their leaves are healthy.
|
||||
*/
|
||||
if (cb->cb_print_unhealthy && depth > 0 &&
|
||||
for_each_vdev_in_nvlist(nv, vdev_health_check_cb, cb) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
printf_color(health_str_to_color(state),
|
||||
"\t%*s%-*s %-8s", depth, "", cb->cb_namewidth - depth,
|
||||
name, state);
|
||||
@@ -2298,6 +2424,9 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
|
||||
if (vs->vs_checksum_errors)
|
||||
ccolor = ANSI_RED;
|
||||
|
||||
if (vs->vs_slow_ios)
|
||||
scolor = ANSI_BLUE;
|
||||
|
||||
if (cb->cb_literal) {
|
||||
printf(" ");
|
||||
printf_color(rcolor, "%5llu",
|
||||
@@ -2330,9 +2459,30 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
|
||||
}
|
||||
|
||||
if (cb->cb_literal)
|
||||
printf(" %5llu", (u_longlong_t)vs->vs_slow_ios);
|
||||
printf_color(scolor, " %5llu",
|
||||
(u_longlong_t)vs->vs_slow_ios);
|
||||
else
|
||||
printf(" %5s", rbuf);
|
||||
printf_color(scolor, " %5s", rbuf);
|
||||
}
|
||||
if (cb->cb_print_power) {
|
||||
if (children == 0) {
|
||||
/* Only leaf vdevs have physical slots */
|
||||
switch (zpool_power_current_state(zhp, (char *)
|
||||
fnvlist_lookup_string(nv,
|
||||
ZPOOL_CONFIG_PATH))) {
|
||||
case 0:
|
||||
printf_color(ANSI_RED, " %5s",
|
||||
gettext("off"));
|
||||
break;
|
||||
case 1:
|
||||
printf(" %5s", gettext("on"));
|
||||
break;
|
||||
default:
|
||||
printf(" %5s", "-");
|
||||
}
|
||||
} else {
|
||||
printf(" %5s", "-");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4205,6 +4355,8 @@ print_iostat_header_impl(iostat_cbdata_t *cb, unsigned int force_column_width,
|
||||
unsigned int namewidth;
|
||||
const char *title;
|
||||
|
||||
color_start(ANSI_BOLD);
|
||||
|
||||
if (cb->cb_flags & IOS_ANYHISTO_M) {
|
||||
title = histo_to_title[IOS_HISTO_IDX(cb->cb_flags)];
|
||||
} else if (cb->cb_vdev_names_count) {
|
||||
@@ -4238,6 +4390,8 @@ print_iostat_header_impl(iostat_cbdata_t *cb, unsigned int force_column_width,
|
||||
if (cb->vcdl != NULL)
|
||||
print_cmd_columns(cb->vcdl, 1);
|
||||
|
||||
color_end();
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@@ -4247,6 +4401,37 @@ print_iostat_header(iostat_cbdata_t *cb)
|
||||
print_iostat_header_impl(cb, 0, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Prints a size string (i.e. 120M) with the suffix ("M") colored
|
||||
* by order of magnitude. Uses column_size to add padding.
|
||||
*/
|
||||
static void
|
||||
print_stat_color(const char *statbuf, unsigned int column_size)
|
||||
{
|
||||
fputs(" ", stdout);
|
||||
size_t len = strlen(statbuf);
|
||||
while (len < column_size) {
|
||||
fputc(' ', stdout);
|
||||
column_size--;
|
||||
}
|
||||
if (*statbuf == '0') {
|
||||
color_start(ANSI_GRAY);
|
||||
fputc('0', stdout);
|
||||
} else {
|
||||
for (; *statbuf; statbuf++) {
|
||||
if (*statbuf == 'K') color_start(ANSI_GREEN);
|
||||
else if (*statbuf == 'M') color_start(ANSI_YELLOW);
|
||||
else if (*statbuf == 'G') color_start(ANSI_RED);
|
||||
else if (*statbuf == 'T') color_start(ANSI_BOLD_BLUE);
|
||||
else if (*statbuf == 'P') color_start(ANSI_MAGENTA);
|
||||
else if (*statbuf == 'E') color_start(ANSI_CYAN);
|
||||
fputc(*statbuf, stdout);
|
||||
if (--column_size <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
color_end();
|
||||
}
|
||||
|
||||
/*
|
||||
* Display a single statistic.
|
||||
@@ -4262,7 +4447,7 @@ print_one_stat(uint64_t value, enum zfs_nicenum_format format,
|
||||
if (scripted)
|
||||
printf("\t%s", buf);
|
||||
else
|
||||
printf(" %*s", column_size, buf);
|
||||
print_stat_color(buf, column_size);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -5338,19 +5523,6 @@ get_interval_count_filter_guids(int *argc, char **argv, float *interval,
|
||||
interval, count);
|
||||
}
|
||||
|
||||
/*
|
||||
* Floating point sleep(). Allows you to pass in a floating point value for
|
||||
* seconds.
|
||||
*/
|
||||
static void
|
||||
fsleep(float sec)
|
||||
{
|
||||
struct timespec req;
|
||||
req.tv_sec = floor(sec);
|
||||
req.tv_nsec = (sec - (float)req.tv_sec) * NANOSEC;
|
||||
nanosleep(&req, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Terminal height, in rows. Returns -1 if stdout is not connected to a TTY or
|
||||
* if we were unable to determine its size.
|
||||
@@ -6839,10 +7011,12 @@ zpool_do_split(int argc, char **argv)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
#define POWER_OPT 1024
|
||||
|
||||
/*
|
||||
* zpool online <pool> <device> ...
|
||||
* zpool online [--power] <pool> <device> ...
|
||||
*
|
||||
* --power: Power on the enclosure slot to the drive (if possible)
|
||||
*/
|
||||
int
|
||||
zpool_do_online(int argc, char **argv)
|
||||
@@ -6853,13 +7027,21 @@ zpool_do_online(int argc, char **argv)
|
||||
int ret = 0;
|
||||
vdev_state_t newstate;
|
||||
int flags = 0;
|
||||
boolean_t is_power_on = B_FALSE;
|
||||
struct option long_options[] = {
|
||||
{"power", no_argument, NULL, POWER_OPT},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt(argc, argv, "e")) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "e", long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'e':
|
||||
flags |= ZFS_ONLINE_EXPAND;
|
||||
break;
|
||||
case POWER_OPT:
|
||||
is_power_on = B_TRUE;
|
||||
break;
|
||||
case '?':
|
||||
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
|
||||
optopt);
|
||||
@@ -6867,6 +7049,9 @@ zpool_do_online(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (libzfs_envvar_is_set("ZPOOL_AUTO_POWER_ON_SLOT"))
|
||||
is_power_on = B_TRUE;
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
@@ -6886,6 +7071,29 @@ zpool_do_online(int argc, char **argv)
|
||||
return (1);
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
vdev_state_t oldstate;
|
||||
boolean_t avail_spare, l2cache;
|
||||
int rc;
|
||||
|
||||
if (is_power_on) {
|
||||
rc = zpool_power_on_and_disk_wait(zhp, argv[i]);
|
||||
if (rc == ENOTSUP) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("Power control not supported\n"));
|
||||
}
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
}
|
||||
|
||||
nvlist_t *tgt = zpool_find_vdev(zhp, argv[i], &avail_spare,
|
||||
&l2cache, NULL);
|
||||
if (tgt == NULL) {
|
||||
ret = 1;
|
||||
continue;
|
||||
}
|
||||
uint_t vsc;
|
||||
oldstate = ((vdev_stat_t *)fnvlist_lookup_uint64_array(tgt,
|
||||
ZPOOL_CONFIG_VDEV_STATS, &vsc))->vs_state;
|
||||
if (zpool_vdev_online(zhp, argv[i], flags, &newstate) == 0) {
|
||||
if (newstate != VDEV_STATE_HEALTHY) {
|
||||
(void) printf(gettext("warning: device '%s' "
|
||||
@@ -6899,6 +7107,17 @@ zpool_do_online(int argc, char **argv)
|
||||
(void) printf(gettext("use 'zpool "
|
||||
"replace' to replace devices "
|
||||
"that are no longer present\n"));
|
||||
if ((flags & ZFS_ONLINE_EXPAND)) {
|
||||
(void) printf(gettext("%s: failed "
|
||||
"to expand usable space on "
|
||||
"unhealthy device '%s'\n"),
|
||||
(oldstate >= VDEV_STATE_DEGRADED ?
|
||||
"error" : "warning"), argv[i]);
|
||||
if (oldstate >= VDEV_STATE_DEGRADED) {
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = 1;
|
||||
@@ -6911,12 +7130,15 @@ zpool_do_online(int argc, char **argv)
|
||||
}
|
||||
|
||||
/*
|
||||
* zpool offline [-ft] <pool> <device> ...
|
||||
* zpool offline [-ft]|[--power] <pool> <device> ...
|
||||
*
|
||||
*
|
||||
* -f Force the device into a faulted state.
|
||||
*
|
||||
* -t Only take the device off-line temporarily. The offline/faulted
|
||||
* state will not be persistent across reboots.
|
||||
*
|
||||
* --power Power off the enclosure slot to the drive (if possible)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
@@ -6928,9 +7150,15 @@ zpool_do_offline(int argc, char **argv)
|
||||
int ret = 0;
|
||||
boolean_t istmp = B_FALSE;
|
||||
boolean_t fault = B_FALSE;
|
||||
boolean_t is_power_off = B_FALSE;
|
||||
|
||||
struct option long_options[] = {
|
||||
{"power", no_argument, NULL, POWER_OPT},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt(argc, argv, "ft")) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "ft", long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
fault = B_TRUE;
|
||||
@@ -6938,6 +7166,9 @@ zpool_do_offline(int argc, char **argv)
|
||||
case 't':
|
||||
istmp = B_TRUE;
|
||||
break;
|
||||
case POWER_OPT:
|
||||
is_power_off = B_TRUE;
|
||||
break;
|
||||
case '?':
|
||||
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
|
||||
optopt);
|
||||
@@ -6945,6 +7176,20 @@ zpool_do_offline(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (is_power_off && fault) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("-0 and -f cannot be used together\n"));
|
||||
usage(B_FALSE);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (is_power_off && istmp) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("-0 and -t cannot be used together\n"));
|
||||
usage(B_FALSE);
|
||||
return (1);
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
@@ -6964,8 +7209,22 @@ zpool_do_offline(int argc, char **argv)
|
||||
return (1);
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (fault) {
|
||||
uint64_t guid = zpool_vdev_path_to_guid(zhp, argv[i]);
|
||||
uint64_t guid = zpool_vdev_path_to_guid(zhp, argv[i]);
|
||||
if (is_power_off) {
|
||||
/*
|
||||
* Note: we have to power off first, then set REMOVED,
|
||||
* or else zpool_vdev_set_removed_state() returns
|
||||
* EAGAIN.
|
||||
*/
|
||||
ret = zpool_power_off(zhp, argv[i]);
|
||||
if (ret != 0) {
|
||||
(void) fprintf(stderr, "%s %s %d\n",
|
||||
gettext("unable to power off slot for"),
|
||||
argv[i], ret);
|
||||
}
|
||||
zpool_vdev_set_removed_state(zhp, guid, VDEV_AUX_NONE);
|
||||
|
||||
} else if (fault) {
|
||||
vdev_aux_t aux;
|
||||
if (istmp == B_FALSE) {
|
||||
/* Force the fault to persist across imports */
|
||||
@@ -6988,7 +7247,7 @@ zpool_do_offline(int argc, char **argv)
|
||||
}
|
||||
|
||||
/*
|
||||
* zpool clear <pool> [device]
|
||||
* zpool clear [-nF]|[--power] <pool> [device]
|
||||
*
|
||||
* Clear all errors associated with a pool or a particular device.
|
||||
*/
|
||||
@@ -7000,13 +7259,20 @@ zpool_do_clear(int argc, char **argv)
|
||||
boolean_t dryrun = B_FALSE;
|
||||
boolean_t do_rewind = B_FALSE;
|
||||
boolean_t xtreme_rewind = B_FALSE;
|
||||
boolean_t is_power_on = B_FALSE;
|
||||
uint32_t rewind_policy = ZPOOL_NO_REWIND;
|
||||
nvlist_t *policy = NULL;
|
||||
zpool_handle_t *zhp;
|
||||
char *pool, *device;
|
||||
|
||||
struct option long_options[] = {
|
||||
{"power", no_argument, NULL, POWER_OPT},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt(argc, argv, "FnX")) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "FnX", long_options,
|
||||
NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'F':
|
||||
do_rewind = B_TRUE;
|
||||
@@ -7017,6 +7283,9 @@ zpool_do_clear(int argc, char **argv)
|
||||
case 'X':
|
||||
xtreme_rewind = B_TRUE;
|
||||
break;
|
||||
case POWER_OPT:
|
||||
is_power_on = B_TRUE;
|
||||
break;
|
||||
case '?':
|
||||
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
|
||||
optopt);
|
||||
@@ -7024,6 +7293,9 @@ zpool_do_clear(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (libzfs_envvar_is_set("ZPOOL_AUTO_POWER_ON_SLOT"))
|
||||
is_power_on = B_TRUE;
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
@@ -7064,6 +7336,14 @@ zpool_do_clear(int argc, char **argv)
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (is_power_on) {
|
||||
if (device == NULL) {
|
||||
zpool_power_on_pool_and_wait_for_devices(zhp);
|
||||
} else {
|
||||
zpool_power_on_and_disk_wait(zhp, device);
|
||||
}
|
||||
}
|
||||
|
||||
if (zpool_clear(zhp, device, policy) != 0)
|
||||
ret = 1;
|
||||
|
||||
@@ -7514,19 +7794,20 @@ print_scan_scrub_resilver_status(pool_scan_stat_t *ps)
|
||||
|
||||
zfs_nicebytes(ps->pss_processed, processed_buf, sizeof (processed_buf));
|
||||
|
||||
assert(ps->pss_func == POOL_SCAN_SCRUB ||
|
||||
ps->pss_func == POOL_SCAN_RESILVER);
|
||||
int is_resilver = ps->pss_func == POOL_SCAN_RESILVER;
|
||||
int is_scrub = ps->pss_func == POOL_SCAN_SCRUB;
|
||||
assert(is_resilver || is_scrub);
|
||||
|
||||
/* Scan is finished or canceled. */
|
||||
if (ps->pss_state == DSS_FINISHED) {
|
||||
secs_to_dhms(end - start, time_buf);
|
||||
|
||||
if (ps->pss_func == POOL_SCAN_SCRUB) {
|
||||
if (is_scrub) {
|
||||
(void) printf(gettext("scrub repaired %s "
|
||||
"in %s with %llu errors on %s"), processed_buf,
|
||||
time_buf, (u_longlong_t)ps->pss_errors,
|
||||
ctime(&end));
|
||||
} else if (ps->pss_func == POOL_SCAN_RESILVER) {
|
||||
} else if (is_resilver) {
|
||||
(void) printf(gettext("resilvered %s "
|
||||
"in %s with %llu errors on %s"), processed_buf,
|
||||
time_buf, (u_longlong_t)ps->pss_errors,
|
||||
@@ -7534,10 +7815,10 @@ print_scan_scrub_resilver_status(pool_scan_stat_t *ps)
|
||||
}
|
||||
return;
|
||||
} else if (ps->pss_state == DSS_CANCELED) {
|
||||
if (ps->pss_func == POOL_SCAN_SCRUB) {
|
||||
if (is_scrub) {
|
||||
(void) printf(gettext("scrub canceled on %s"),
|
||||
ctime(&end));
|
||||
} else if (ps->pss_func == POOL_SCAN_RESILVER) {
|
||||
} else if (is_resilver) {
|
||||
(void) printf(gettext("resilver canceled on %s"),
|
||||
ctime(&end));
|
||||
}
|
||||
@@ -7547,7 +7828,7 @@ print_scan_scrub_resilver_status(pool_scan_stat_t *ps)
|
||||
assert(ps->pss_state == DSS_SCANNING);
|
||||
|
||||
/* Scan is in progress. Resilvers can't be paused. */
|
||||
if (ps->pss_func == POOL_SCAN_SCRUB) {
|
||||
if (is_scrub) {
|
||||
if (pause == 0) {
|
||||
(void) printf(gettext("scrub in progress since %s"),
|
||||
ctime(&start));
|
||||
@@ -7557,7 +7838,7 @@ print_scan_scrub_resilver_status(pool_scan_stat_t *ps)
|
||||
(void) printf(gettext("\tscrub started on %s"),
|
||||
ctime(&start));
|
||||
}
|
||||
} else if (ps->pss_func == POOL_SCAN_RESILVER) {
|
||||
} else if (is_resilver) {
|
||||
(void) printf(gettext("resilver in progress since %s"),
|
||||
ctime(&start));
|
||||
}
|
||||
@@ -7599,17 +7880,27 @@ print_scan_scrub_resilver_status(pool_scan_stat_t *ps)
|
||||
scanned_buf, issued_buf, total_buf);
|
||||
}
|
||||
|
||||
if (ps->pss_func == POOL_SCAN_RESILVER) {
|
||||
if (is_resilver) {
|
||||
(void) printf(gettext("\t%s resilvered, %.2f%% done"),
|
||||
processed_buf, 100 * fraction_done);
|
||||
} else if (ps->pss_func == POOL_SCAN_SCRUB) {
|
||||
} else if (is_scrub) {
|
||||
(void) printf(gettext("\t%s repaired, %.2f%% done"),
|
||||
processed_buf, 100 * fraction_done);
|
||||
}
|
||||
|
||||
if (pause == 0) {
|
||||
/*
|
||||
* Only provide an estimate iff:
|
||||
* 1) the time remaining is valid, and
|
||||
* 2) the issue rate exceeds 10 MB/s, and
|
||||
* 3) it's either:
|
||||
* a) a resilver which has started repairs, or
|
||||
* b) a scrub which has entered the issue phase.
|
||||
*/
|
||||
if (total_secs_left != UINT64_MAX &&
|
||||
issue_rate >= 10 * 1024 * 1024) {
|
||||
issue_rate >= 10 * 1024 * 1024 &&
|
||||
((is_resilver && ps->pss_processed > 0) ||
|
||||
(is_scrub && issued > 0))) {
|
||||
(void) printf(gettext(", %s to go\n"), time_buf);
|
||||
} else {
|
||||
(void) printf(gettext(", no estimated "
|
||||
@@ -8561,6 +8852,10 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
printf_color(ANSI_BOLD, " %5s", gettext("SLOW"));
|
||||
}
|
||||
|
||||
if (cbp->cb_print_power) {
|
||||
printf_color(ANSI_BOLD, " %5s", gettext("POWER"));
|
||||
}
|
||||
|
||||
if (cbp->vcdl != NULL)
|
||||
print_cmd_columns(cbp->vcdl, 0);
|
||||
|
||||
@@ -8608,11 +8903,13 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
if (nerr == 0)
|
||||
(void) printf(gettext("errors: No known data "
|
||||
"errors\n"));
|
||||
else if (!cbp->cb_verbose)
|
||||
else if (!cbp->cb_verbose) {
|
||||
color_start(ANSI_RED);
|
||||
(void) printf(gettext("errors: %llu data "
|
||||
"errors, use '-v' for a list\n"),
|
||||
(u_longlong_t)nerr);
|
||||
else
|
||||
color_end();
|
||||
} else
|
||||
print_error_log(zhp);
|
||||
}
|
||||
|
||||
@@ -8627,10 +8924,11 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
}
|
||||
|
||||
/*
|
||||
* zpool status [-c [script1,script2,...]] [-igLpPstvx] [-T d|u] [pool] ...
|
||||
* [interval [count]]
|
||||
* zpool status [-c [script1,script2,...]] [-igLpPstvx] [--power] [-T d|u] ...
|
||||
* [pool] [interval [count]]
|
||||
*
|
||||
* -c CMD For each vdev, run command CMD
|
||||
* -e Display only unhealthy vdevs
|
||||
* -i Display vdev initialization status.
|
||||
* -g Display guid for individual vdev name.
|
||||
* -L Follow links when resolving vdev path name.
|
||||
@@ -8642,6 +8940,7 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
* -D Display dedup status (undocumented)
|
||||
* -t Display vdev TRIM status.
|
||||
* -T Display a timestamp in date(1) or Unix format
|
||||
* --power Display vdev enclosure slot power status
|
||||
*
|
||||
* Describes the health status of all pools or some subset.
|
||||
*/
|
||||
@@ -8655,8 +8954,14 @@ zpool_do_status(int argc, char **argv)
|
||||
status_cbdata_t cb = { 0 };
|
||||
char *cmd = NULL;
|
||||
|
||||
struct option long_options[] = {
|
||||
{"power", no_argument, NULL, POWER_OPT},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt(argc, argv, "c:igLpPsvxDtT:")) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "c:eigLpPsvxDtT:", long_options,
|
||||
NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'c':
|
||||
if (cmd != NULL) {
|
||||
@@ -8682,6 +8987,9 @@ zpool_do_status(int argc, char **argv)
|
||||
}
|
||||
cmd = optarg;
|
||||
break;
|
||||
case 'e':
|
||||
cb.cb_print_unhealthy = B_TRUE;
|
||||
break;
|
||||
case 'i':
|
||||
cb.cb_print_vdev_init = B_TRUE;
|
||||
break;
|
||||
@@ -8715,6 +9023,9 @@ zpool_do_status(int argc, char **argv)
|
||||
case 'T':
|
||||
get_timestamp_arg(*optarg);
|
||||
break;
|
||||
case POWER_OPT:
|
||||
cb.cb_print_power = B_TRUE;
|
||||
break;
|
||||
case '?':
|
||||
if (optopt == 'c') {
|
||||
print_zpool_script_list("status");
|
||||
|
||||
@@ -124,6 +124,10 @@ vdev_cmd_data_list_t *all_pools_for_each_vdev_run(int argc, char **argv,
|
||||
|
||||
void free_vdev_cmd_data_list(vdev_cmd_data_list_t *vcdl);
|
||||
|
||||
void free_vdev_cmd_data(vdev_cmd_data_t *data);
|
||||
|
||||
int vdev_run_cmd_simple(char *path, char *cmd);
|
||||
|
||||
int check_device(const char *path, boolean_t force,
|
||||
boolean_t isspare, boolean_t iswholedisk);
|
||||
boolean_t check_sector_size_database(char *path, int *sector_size);
|
||||
@@ -131,6 +135,9 @@ void vdev_error(const char *fmt, ...);
|
||||
int check_file(const char *file, boolean_t force, boolean_t isspare);
|
||||
void after_zpool_upgrade(zpool_handle_t *zhp);
|
||||
|
||||
int zpool_power(zpool_handle_t *zhp, char *vdev, boolean_t turn_on);
|
||||
int zpool_power_current_state(zpool_handle_t *zhp, char *vdev);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+40
-7
@@ -373,6 +373,10 @@ make_leaf_vdev(nvlist_t *props, const char *arg, boolean_t is_primary)
|
||||
verify(nvlist_add_string(vdev, ZPOOL_CONFIG_PATH, path) == 0);
|
||||
verify(nvlist_add_string(vdev, ZPOOL_CONFIG_TYPE, type) == 0);
|
||||
|
||||
/* Lookup and add the enclosure sysfs path (if exists) */
|
||||
update_vdev_config_dev_sysfs_path(vdev, path,
|
||||
ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH);
|
||||
|
||||
if (strcmp(type, VDEV_TYPE_DISK) == 0)
|
||||
verify(nvlist_add_uint64(vdev, ZPOOL_CONFIG_WHOLE_DISK,
|
||||
(uint64_t)wholedisk) == 0);
|
||||
@@ -921,6 +925,15 @@ zero_label(char *path)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
lines_to_stderr(char *lines[], int lines_cnt)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < lines_cnt; i++) {
|
||||
fprintf(stderr, "%s\n", lines[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Go through and find any whole disks in the vdev specification, labelling them
|
||||
* as appropriate. When constructing the vdev spec, we were unable to open this
|
||||
@@ -932,7 +945,7 @@ zero_label(char *path)
|
||||
* need to get the devid after we label the disk.
|
||||
*/
|
||||
static int
|
||||
make_disks(zpool_handle_t *zhp, nvlist_t *nv)
|
||||
make_disks(zpool_handle_t *zhp, nvlist_t *nv, boolean_t replacing)
|
||||
{
|
||||
nvlist_t **child;
|
||||
uint_t c, children;
|
||||
@@ -1017,6 +1030,8 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv)
|
||||
*/
|
||||
if (!is_exclusive && !is_spare(NULL, udevpath)) {
|
||||
char *devnode = strrchr(devpath, '/') + 1;
|
||||
char **lines = NULL;
|
||||
int lines_cnt = 0;
|
||||
|
||||
ret = strncmp(udevpath, UDISK_ROOT, strlen(UDISK_ROOT));
|
||||
if (ret == 0) {
|
||||
@@ -1028,9 +1043,27 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv)
|
||||
/*
|
||||
* When labeling a pool the raw device node name
|
||||
* is provided as it appears under /dev/.
|
||||
*
|
||||
* Note that 'zhp' will be NULL when we're creating a
|
||||
* pool.
|
||||
*/
|
||||
if (zpool_label_disk(g_zfs, zhp, devnode) == -1)
|
||||
if (zpool_prepare_and_label_disk(g_zfs, zhp, devnode,
|
||||
nv, zhp == NULL ? "create" :
|
||||
replacing ? "replace" : "add", &lines,
|
||||
&lines_cnt) != 0) {
|
||||
(void) fprintf(stderr,
|
||||
gettext(
|
||||
"Error preparing/labeling disk.\n"));
|
||||
if (lines_cnt > 0) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("zfs_prepare_disk output:\n"));
|
||||
lines_to_stderr(lines, lines_cnt);
|
||||
}
|
||||
|
||||
libzfs_free_str_array(lines, lines_cnt);
|
||||
return (-1);
|
||||
}
|
||||
libzfs_free_str_array(lines, lines_cnt);
|
||||
|
||||
/*
|
||||
* Wait for udev to signal the device is available
|
||||
@@ -1067,19 +1100,19 @@ make_disks(zpool_handle_t *zhp, nvlist_t *nv)
|
||||
}
|
||||
|
||||
for (c = 0; c < children; c++)
|
||||
if ((ret = make_disks(zhp, child[c])) != 0)
|
||||
if ((ret = make_disks(zhp, child[c], replacing)) != 0)
|
||||
return (ret);
|
||||
|
||||
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_SPARES,
|
||||
&child, &children) == 0)
|
||||
for (c = 0; c < children; c++)
|
||||
if ((ret = make_disks(zhp, child[c])) != 0)
|
||||
if ((ret = make_disks(zhp, child[c], replacing)) != 0)
|
||||
return (ret);
|
||||
|
||||
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE,
|
||||
&child, &children) == 0)
|
||||
for (c = 0; c < children; c++)
|
||||
if ((ret = make_disks(zhp, child[c])) != 0)
|
||||
if ((ret = make_disks(zhp, child[c], replacing)) != 0)
|
||||
return (ret);
|
||||
|
||||
return (0);
|
||||
@@ -1740,7 +1773,7 @@ split_mirror_vdev(zpool_handle_t *zhp, char *newname, nvlist_t *props,
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (!flags.dryrun && make_disks(zhp, newroot) != 0) {
|
||||
if (!flags.dryrun && make_disks(zhp, newroot, B_FALSE) != 0) {
|
||||
nvlist_free(newroot);
|
||||
return (NULL);
|
||||
}
|
||||
@@ -1861,7 +1894,7 @@ make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force, int check_rep,
|
||||
/*
|
||||
* Run through the vdev specification and label any whole disks found.
|
||||
*/
|
||||
if (!dryrun && make_disks(zhp, newroot) != 0) {
|
||||
if (!dryrun && make_disks(zhp, newroot, replacing) != 0) {
|
||||
nvlist_free(newroot);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1184,7 +1184,7 @@ ztest_kill(ztest_shared_t *zs)
|
||||
* See comment above spa_write_cachefile().
|
||||
*/
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
spa_write_cachefile(ztest_spa, B_FALSE, B_FALSE);
|
||||
spa_write_cachefile(ztest_spa, B_FALSE, B_FALSE, B_FALSE);
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
|
||||
(void) kill(getpid(), SIGKILL);
|
||||
|
||||
@@ -41,6 +41,7 @@ AM_CPPFLAGS += -D_REENTRANT
|
||||
AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64
|
||||
AM_CPPFLAGS += -D_LARGEFILE64_SOURCE
|
||||
AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\"
|
||||
AM_CPPFLAGS += -DZFSEXECDIR=\"$(zfsexecdir)\"
|
||||
AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\"
|
||||
AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
|
||||
AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
|
||||
@@ -180,6 +180,62 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_INFINITE_RECURSION], [
|
||||
AC_SUBST([INFINITE_RECURSION])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Check if kernel cc supports -Winfinite-recursion option.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_KERNEL_CC_INFINITE_RECURSION], [
|
||||
AC_MSG_CHECKING([whether $KERNEL_CC supports -Winfinite-recursion])
|
||||
|
||||
saved_cc="$CC"
|
||||
saved_flags="$CFLAGS"
|
||||
CC="gcc"
|
||||
CFLAGS="$CFLAGS -Werror -Winfinite-recursion"
|
||||
|
||||
AS_IF([ test -n "$KERNEL_CC" ], [
|
||||
CC="$KERNEL_CC"
|
||||
])
|
||||
AS_IF([ test -n "$KERNEL_LLVM" ], [
|
||||
CC="clang"
|
||||
])
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
|
||||
KERNEL_INFINITE_RECURSION=-Winfinite-recursion
|
||||
AC_DEFINE([HAVE_KERNEL_INFINITE_RECURSION], 1,
|
||||
[Define if compiler supports -Winfinite-recursion])
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
KERNEL_INFINITE_RECURSION=
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
|
||||
CC="$saved_cc"
|
||||
CFLAGS="$saved_flags"
|
||||
AC_SUBST([KERNEL_INFINITE_RECURSION])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Check if cc supports -Wformat-overflow option.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_FORMAT_OVERFLOW], [
|
||||
AC_MSG_CHECKING([whether $CC supports -Wformat-overflow])
|
||||
|
||||
saved_flags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror -Wformat-overflow"
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
|
||||
FORMAT_OVERFLOW=-Wformat-overflow
|
||||
AC_DEFINE([HAVE_FORMAT_OVERFLOW], 1,
|
||||
[Define if compiler supports -Wformat-overflow])
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
FORMAT_OVERFLOW=
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
|
||||
CFLAGS="$saved_flags"
|
||||
AC_SUBST([FORMAT_OVERFLOW])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Check if gcc supports -fno-omit-frame-pointer option.
|
||||
dnl #
|
||||
@@ -221,3 +277,34 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_IPA_SRA], [
|
||||
CFLAGS="$saved_flags"
|
||||
AC_SUBST([NO_IPA_SRA])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Check if kernel cc supports -fno-ipa-sra option.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_KERNEL_CC_NO_IPA_SRA], [
|
||||
AC_MSG_CHECKING([whether $KERNEL_CC supports -fno-ipa-sra])
|
||||
|
||||
saved_cc="$CC"
|
||||
saved_flags="$CFLAGS"
|
||||
CC="gcc"
|
||||
CFLAGS="$CFLAGS -Werror -fno-ipa-sra"
|
||||
|
||||
AS_IF([ test -n "$KERNEL_CC" ], [
|
||||
CC="$KERNEL_CC"
|
||||
])
|
||||
AS_IF([ test -n "$KERNEL_LLVM" ], [
|
||||
CC="clang"
|
||||
])
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
|
||||
KERNEL_NO_IPA_SRA=-fno-ipa-sra
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
KERNEL_NO_IPA_SRA=
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
|
||||
CC="$saved_cc"
|
||||
CFLAGS="$saved_flags"
|
||||
AC_SUBST([KERNEL_NO_IPA_SRA])
|
||||
])
|
||||
|
||||
+6
-19
@@ -1,7 +1,6 @@
|
||||
dnl #
|
||||
dnl # The majority of the python scripts are written to be compatible
|
||||
dnl # with Python 2.6 and Python 3.4. Therefore, they may be installed
|
||||
dnl # and used with either interpreter. This option is intended to
|
||||
dnl # with Python 3.6. This option is intended to
|
||||
dnl # to provide a method to specify the default system version, and
|
||||
dnl # set the PYTHON environment variable accordingly.
|
||||
dnl #
|
||||
@@ -13,9 +12,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [
|
||||
[with_python=check])
|
||||
|
||||
AS_CASE([$with_python],
|
||||
[check], [AC_CHECK_PROGS([PYTHON], [python3 python2], [:])],
|
||||
[2*], [PYTHON="python${with_python}"],
|
||||
[*python2*], [PYTHON="${with_python}"],
|
||||
[check], [AC_CHECK_PROGS([PYTHON], [python3], [:])],
|
||||
[3*], [PYTHON="python${with_python}"],
|
||||
[*python3*], [PYTHON="${with_python}"],
|
||||
[no], [PYTHON=":"],
|
||||
@@ -23,8 +20,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [
|
||||
)
|
||||
|
||||
dnl #
|
||||
dnl # Minimum supported Python versions for utilities:
|
||||
dnl # Python 2.6 or Python 3.4
|
||||
dnl # Minimum supported Python versions for utilities: Python 3.6
|
||||
dnl #
|
||||
AM_PATH_PYTHON([], [], [:])
|
||||
AS_IF([test -z "$PYTHON_VERSION"], [
|
||||
@@ -33,25 +29,16 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [
|
||||
PYTHON_MINOR=${PYTHON_VERSION#*\.}
|
||||
|
||||
AS_CASE([$PYTHON_VERSION],
|
||||
[2.*], [
|
||||
AS_IF([test $PYTHON_MINOR -lt 6],
|
||||
[AC_MSG_ERROR("Python >= 2.6 is required")])
|
||||
],
|
||||
[3.*], [
|
||||
AS_IF([test $PYTHON_MINOR -lt 4],
|
||||
[AC_MSG_ERROR("Python >= 3.4 is required")])
|
||||
AS_IF([test $PYTHON_MINOR -lt 6],
|
||||
[AC_MSG_ERROR("Python >= 3.6 is required")])
|
||||
],
|
||||
[:|2|3], [],
|
||||
[PYTHON_VERSION=3]
|
||||
)
|
||||
|
||||
AM_CONDITIONAL([USING_PYTHON], [test "$PYTHON" != :])
|
||||
AM_CONDITIONAL([USING_PYTHON_2], [test "x${PYTHON_VERSION%%\.*}" = x2])
|
||||
AM_CONDITIONAL([USING_PYTHON_3], [test "x${PYTHON_VERSION%%\.*}" = x3])
|
||||
|
||||
AM_COND_IF([USING_PYTHON_2],
|
||||
[AC_SUBST([PYTHON_SHEBANG], [python2])],
|
||||
[AC_SUBST([PYTHON_SHEBANG], [python3])])
|
||||
AC_SUBST([PYTHON_SHEBANG], [python3])
|
||||
|
||||
dnl #
|
||||
dnl # Request that packages be built for a specific Python version.
|
||||
|
||||
@@ -18,7 +18,7 @@ AC_DEFUN([ZFS_AC_PYTHON_MODULE], [
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Determines if pyzfs can be built, requires Python 2.7 or later.
|
||||
dnl # Determines if pyzfs can be built, requires Python 3.6 or later.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
|
||||
AC_ARG_ENABLE([pyzfs],
|
||||
@@ -72,12 +72,11 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYZFS], [
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Require python-devel libraries
|
||||
dnl # Require python3-devel libraries
|
||||
dnl #
|
||||
AS_IF([test "x$enable_pyzfs" = xcheck -o "x$enable_pyzfs" = xyes], [
|
||||
AS_CASE([$PYTHON_VERSION],
|
||||
[3.*], [PYTHON_REQUIRED_VERSION=">= '3.4.0'"],
|
||||
[2.*], [PYTHON_REQUIRED_VERSION=">= '2.7.0'"],
|
||||
[3.*], [PYTHON_REQUIRED_VERSION=">= '3.6.0'"],
|
||||
[AC_MSG_ERROR("Python $PYTHON_VERSION unknown")]
|
||||
)
|
||||
|
||||
|
||||
+34
-12
@@ -172,7 +172,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_get_acl], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
struct posix_acl *get_acl_fn(struct inode *inode, int type)
|
||||
static struct posix_acl *get_acl_fn(struct inode *inode, int type)
|
||||
{ return NULL; }
|
||||
|
||||
static const struct inode_operations
|
||||
@@ -184,7 +184,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_get_acl_rcu], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
struct posix_acl *get_acl_fn(struct inode *inode, int type,
|
||||
static struct posix_acl *get_acl_fn(struct inode *inode, int type,
|
||||
bool rcu) { return NULL; }
|
||||
|
||||
static const struct inode_operations
|
||||
@@ -196,7 +196,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_get_inode_acl], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
struct posix_acl *get_inode_acl_fn(struct inode *inode, int type,
|
||||
static struct posix_acl *get_inode_acl_fn(struct inode *inode, int type,
|
||||
bool rcu) { return NULL; }
|
||||
|
||||
static const struct inode_operations
|
||||
@@ -236,11 +236,26 @@ dnl #
|
||||
dnl # 6.2 API change,
|
||||
dnl # set_acl() second paramter changed to a struct dentry *
|
||||
dnl #
|
||||
dnl # 6.3 API change,
|
||||
dnl # set_acl() first parameter changed to struct mnt_idmap *
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_set_acl_mnt_idmap_dentry], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
static int set_acl_fn(struct mnt_idmap *idmap,
|
||||
struct dentry *dent, 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_userns_dentry], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int set_acl_fn(struct user_namespace *userns,
|
||||
static int set_acl_fn(struct user_namespace *userns,
|
||||
struct dentry *dent, struct posix_acl *acl,
|
||||
int type) { return 0; }
|
||||
|
||||
@@ -252,7 +267,7 @@ 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,
|
||||
static int set_acl_fn(struct user_namespace *userns,
|
||||
struct inode *inode, struct posix_acl *acl,
|
||||
int type) { return 0; }
|
||||
|
||||
@@ -264,7 +279,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int set_acl_fn(struct inode *inode, struct posix_acl *acl,
|
||||
static int set_acl_fn(struct inode *inode, struct posix_acl *acl,
|
||||
int type) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
@@ -281,17 +296,24 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
|
||||
AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
|
||||
AC_DEFINE(HAVE_SET_ACL_USERNS, 1, [iops->set_acl() takes 4 args])
|
||||
],[
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns_dentry], [
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_mnt_idmap_dentry], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
|
||||
AC_DEFINE(HAVE_SET_ACL_USERNS_DENTRY_ARG2, 1,
|
||||
[iops->set_acl() takes 4 args, arg2 is struct dentry *])
|
||||
AC_DEFINE(HAVE_SET_ACL_IDMAP_DENTRY, 1,
|
||||
[iops->set_acl() takes 4 args, arg1 is struct mnt_idmap *])
|
||||
],[
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns_dentry], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists, takes 3 args])
|
||||
AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
|
||||
AC_DEFINE(HAVE_SET_ACL_USERNS_DENTRY_ARG2, 1,
|
||||
[iops->set_acl() takes 4 args, arg2 is struct dentry *])
|
||||
],[
|
||||
ZFS_LINUX_REQUIRE_API([i_op->set_acl()], [3.14])
|
||||
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])
|
||||
],[
|
||||
ZFS_LINUX_REQUIRE_API([i_op->set_acl()], [3.14])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -8,7 +8,7 @@ dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_AUTOMOUNT], [
|
||||
ZFS_LINUX_TEST_SRC([dentry_operations_d_automount], [
|
||||
#include <linux/dcache.h>
|
||||
struct vfsmount *d_automount(struct path *p) { return NULL; }
|
||||
static struct vfsmount *d_automount(struct path *p) { return NULL; }
|
||||
struct dentry_operations dops __attribute__ ((unused)) = {
|
||||
.d_automount = d_automount,
|
||||
};
|
||||
|
||||
@@ -247,7 +247,7 @@ dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_END_IO_T_ARGS], [
|
||||
ZFS_LINUX_TEST_SRC([bio_end_io_t_args], [
|
||||
#include <linux/bio.h>
|
||||
void wanted_end_io(struct bio *bio) { return; }
|
||||
static void wanted_end_io(struct bio *bio) { return; }
|
||||
bio_end_io_t *end_io __attribute__ ((unused)) = wanted_end_io;
|
||||
], [])
|
||||
])
|
||||
|
||||
+242
-3
@@ -16,12 +16,90 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH], [
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.5.x API change,
|
||||
dnl # blkdev_get_by_path() takes 4 args
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH_4ARG], [
|
||||
ZFS_LINUX_TEST_SRC([blkdev_get_by_path_4arg], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct block_device *bdev __attribute__ ((unused)) = NULL;
|
||||
const char *path = "path";
|
||||
fmode_t mode = 0;
|
||||
void *holder = NULL;
|
||||
struct blk_holder_ops h;
|
||||
|
||||
bdev = blkdev_get_by_path(path, mode, holder, &h);
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.8.x API change
|
||||
dnl # bdev_open_by_path() replaces blkdev_get_by_path()
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_OPEN_BY_PATH], [
|
||||
ZFS_LINUX_TEST_SRC([bdev_open_by_path], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct bdev_handle *bdh __attribute__ ((unused)) = NULL;
|
||||
const char *path = "path";
|
||||
fmode_t mode = 0;
|
||||
void *holder = NULL;
|
||||
struct blk_holder_ops h;
|
||||
|
||||
bdh = bdev_open_by_path(path, mode, holder, &h);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], [
|
||||
AC_MSG_CHECKING([whether blkdev_get_by_path() exists])
|
||||
AC_MSG_CHECKING([whether blkdev_get_by_path() exists and takes 3 args])
|
||||
ZFS_LINUX_TEST_RESULT([blkdev_get_by_path], [
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
ZFS_LINUX_TEST_ERROR([blkdev_get_by_path()])
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([whether blkdev_get_by_path() exists and takes 4 args])
|
||||
ZFS_LINUX_TEST_RESULT([blkdev_get_by_path_4arg], [
|
||||
AC_DEFINE(HAVE_BLKDEV_GET_BY_PATH_4ARG, 1,
|
||||
[blkdev_get_by_path() exists and takes 4 args])
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([whether bdev_open_by_path() exists])
|
||||
ZFS_LINUX_TEST_RESULT([bdev_open_by_path], [
|
||||
AC_DEFINE(HAVE_BDEV_OPEN_BY_PATH, 1,
|
||||
[bdev_open_by_path() exists])
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
ZFS_LINUX_TEST_ERROR([blkdev_get_by_path()])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.5.x API change
|
||||
dnl # blk_mode_t was added as a type to supercede some places where fmode_t
|
||||
dnl # is used
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BLK_MODE_T], [
|
||||
ZFS_LINUX_TEST_SRC([blk_mode_t], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
blk_mode_t m __attribute((unused)) = (blk_mode_t)0;
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BLK_MODE_T], [
|
||||
AC_MSG_CHECKING([whether blk_mode_t is defined])
|
||||
ZFS_LINUX_TEST_RESULT([blk_mode_t], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_MODE_T, 1, [blk_mode_t is defined])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
@@ -41,12 +119,58 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_PUT], [
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.5.x API change.
|
||||
dnl # blkdev_put() takes (void* holder) as arg 2
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_PUT_HOLDER], [
|
||||
ZFS_LINUX_TEST_SRC([blkdev_put_holder], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct block_device *bdev = NULL;
|
||||
void *holder = NULL;
|
||||
|
||||
blkdev_put(bdev, holder);
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.8.x API change
|
||||
dnl # bdev_release() replaces blkdev_put()
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_RELEASE], [
|
||||
ZFS_LINUX_TEST_SRC([bdev_release], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct bdev_handle *bdh = NULL;
|
||||
bdev_release(bdh);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_PUT], [
|
||||
AC_MSG_CHECKING([whether blkdev_put() exists])
|
||||
ZFS_LINUX_TEST_RESULT([blkdev_put], [
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
ZFS_LINUX_TEST_ERROR([blkdev_put()])
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([whether blkdev_put() accepts void* as arg 2])
|
||||
ZFS_LINUX_TEST_RESULT([blkdev_put_holder], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLKDEV_PUT_HOLDER, 1,
|
||||
[blkdev_put() accepts void* as arg 2])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([whether bdev_release() exists])
|
||||
ZFS_LINUX_TEST_RESULT([bdev_release], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BDEV_RELEASE, 1,
|
||||
[bdev_release() exists])
|
||||
], [
|
||||
ZFS_LINUX_TEST_ERROR([blkdev_put()])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -103,6 +227,84 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE], [
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.5.x API change
|
||||
dnl # disk_check_media_change() was added
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_DISK_CHECK_MEDIA_CHANGE], [
|
||||
ZFS_LINUX_TEST_SRC([disk_check_media_change], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct block_device *bdev = NULL;
|
||||
bool error;
|
||||
|
||||
error = disk_check_media_change(bdev->bd_disk);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_DISK_CHECK_MEDIA_CHANGE], [
|
||||
AC_MSG_CHECKING([whether disk_check_media_change() exists])
|
||||
ZFS_LINUX_TEST_RESULT([disk_check_media_change], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_DISK_CHECK_MEDIA_CHANGE, 1,
|
||||
[disk_check_media_change() exists])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # bdev_kobj() is introduced from 5.12
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_KOBJ], [
|
||||
ZFS_LINUX_TEST_SRC([bdev_kobj], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/kobject.h>
|
||||
], [
|
||||
struct block_device *bdev = NULL;
|
||||
struct kobject *disk_kobj;
|
||||
disk_kobj = bdev_kobj(bdev);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_KOBJ], [
|
||||
AC_MSG_CHECKING([whether bdev_kobj() exists])
|
||||
ZFS_LINUX_TEST_RESULT([bdev_kobj], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BDEV_KOBJ, 1,
|
||||
[bdev_kobj() exists])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # part_to_dev() was removed in 5.12
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_PART_TO_DEV], [
|
||||
ZFS_LINUX_TEST_SRC([part_to_dev], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct hd_struct *p = NULL;
|
||||
struct device *pdev;
|
||||
pdev = part_to_dev(p);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_PART_TO_DEV], [
|
||||
AC_MSG_CHECKING([whether part_to_dev() exists])
|
||||
ZFS_LINUX_TEST_RESULT([part_to_dev], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_PART_TO_DEV, 1,
|
||||
[part_to_dev() exists])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 5.10 API, check_disk_change() is removed, in favor of
|
||||
dnl # bdev_check_media_change(), which doesn't force revalidation
|
||||
@@ -392,9 +594,36 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_ERESTARTSYS], [
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.5.x API change
|
||||
dnl # BLK_STS_NEXUS replaced with BLK_STS_RESV_CONFLICT
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BLK_STS_RESV_CONFLICT], [
|
||||
ZFS_LINUX_TEST_SRC([blk_sts_resv_conflict], [
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
blk_status_t s __attribute__ ((unused)) = BLK_STS_RESV_CONFLICT;
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BLK_STS_RESV_CONFLICT], [
|
||||
AC_MSG_CHECKING([whether BLK_STS_RESV_CONFLICT is defined])
|
||||
ZFS_LINUX_TEST_RESULT([blk_sts_resv_conflict], [
|
||||
AC_DEFINE(HAVE_BLK_STS_RESV_CONFLICT, 1, [BLK_STS_RESV_CONFLICT is defined])
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH_4ARG
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_OPEN_BY_PATH
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_PUT
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_PUT_HOLDER
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_RELEASE
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_INVALIDATE_BDEV
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_LOOKUP_BDEV
|
||||
@@ -405,6 +634,11 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_BDEVNAME
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_ISSUE_SECURE_ERASE
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_KOBJ
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_PART_TO_DEV
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_DISK_CHECK_MEDIA_CHANGE
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_BLK_STS_RESV_CONFLICT
|
||||
ZFS_AC_KERNEL_SRC_BLKDEV_BLK_MODE_T
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [
|
||||
@@ -421,4 +655,9 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [
|
||||
ZFS_AC_KERNEL_BLKDEV_BDEVNAME
|
||||
ZFS_AC_KERNEL_BLKDEV_GET_ERESTARTSYS
|
||||
ZFS_AC_KERNEL_BLKDEV_ISSUE_SECURE_ERASE
|
||||
ZFS_AC_KERNEL_BLKDEV_BDEV_KOBJ
|
||||
ZFS_AC_KERNEL_BLKDEV_PART_TO_DEV
|
||||
ZFS_AC_KERNEL_BLKDEV_DISK_CHECK_MEDIA_CHANGE
|
||||
ZFS_AC_KERNEL_BLKDEV_BLK_STS_RESV_CONFLICT
|
||||
ZFS_AC_KERNEL_BLKDEV_BLK_MODE_T
|
||||
])
|
||||
|
||||
@@ -5,7 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [
|
||||
ZFS_LINUX_TEST_SRC([block_device_operations_check_events], [
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
unsigned int blk_check_events(struct gendisk *disk,
|
||||
static unsigned int blk_check_events(struct gendisk *disk,
|
||||
unsigned int clearing) {
|
||||
(void) disk, (void) clearing;
|
||||
return (0);
|
||||
@@ -34,7 +34,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
|
||||
ZFS_LINUX_TEST_SRC([block_device_operations_release_void], [
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
void blk_release(struct gendisk *g, fmode_t mode) {
|
||||
static void blk_release(struct gendisk *g, fmode_t mode) {
|
||||
(void) g, (void) mode;
|
||||
return;
|
||||
}
|
||||
@@ -49,12 +49,42 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
|
||||
], [], [])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 5.9.x API change
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_1ARG], [
|
||||
ZFS_LINUX_TEST_SRC([block_device_operations_release_void_1arg], [
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
static void blk_release(struct gendisk *g) {
|
||||
(void) g;
|
||||
return;
|
||||
}
|
||||
|
||||
static const struct block_device_operations
|
||||
bops __attribute__ ((unused)) = {
|
||||
.open = NULL,
|
||||
.release = blk_release,
|
||||
.ioctl = NULL,
|
||||
.compat_ioctl = NULL,
|
||||
};
|
||||
], [], [])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [
|
||||
AC_MSG_CHECKING([whether bops->release() is void])
|
||||
AC_MSG_CHECKING([whether bops->release() is void and takes 2 args])
|
||||
ZFS_LINUX_TEST_RESULT([block_device_operations_release_void], [
|
||||
AC_MSG_RESULT(yes)
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([bops->release()])
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([whether bops->release() is void and takes 1 arg])
|
||||
ZFS_LINUX_TEST_RESULT([block_device_operations_release_void_1arg], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_BLOCK_DEVICE_OPERATIONS_RELEASE_1ARG], [1],
|
||||
[Define if release() in block_device_operations takes 1 arg])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([bops->release()])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -66,7 +96,7 @@ 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) {
|
||||
static int blk_revalidate_disk(struct gendisk *disk) {
|
||||
(void) disk;
|
||||
return(0);
|
||||
}
|
||||
@@ -92,6 +122,7 @@ AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [
|
||||
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_RELEASE_1ARG
|
||||
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK
|
||||
])
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_COMMIT_METADATA], [
|
||||
ZFS_LINUX_TEST_SRC([export_operations_commit_metadata], [
|
||||
#include <linux/exportfs.h>
|
||||
int commit_metadata(struct inode *inode) { return 0; }
|
||||
static int commit_metadata(struct inode *inode) { return 0; }
|
||||
static struct export_operations eops __attribute__ ((unused))={
|
||||
.commit_metadata = commit_metadata,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
dnl #
|
||||
dnl # cpu_has_feature() may referencing GPL-only cpu_feature_keys on powerpc
|
||||
dnl #
|
||||
|
||||
dnl #
|
||||
dnl # Checking if cpu_has_feature is exported GPL-only
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE], [
|
||||
ZFS_LINUX_TEST_SRC([cpu_has_feature], [
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
|
||||
#include <asm/cpu_has_feature.h>
|
||||
#else
|
||||
#include <asm/cputable.h>
|
||||
#endif
|
||||
], [
|
||||
return cpu_has_feature(CPU_FTR_ALTIVEC) ? 0 : 1;
|
||||
], [], [ZFS_META_LICENSE])
|
||||
])
|
||||
AC_DEFUN([ZFS_AC_KERNEL_CPU_HAS_FEATURE], [
|
||||
AC_MSG_CHECKING([whether cpu_has_feature() is GPL-only])
|
||||
ZFS_LINUX_TEST_RESULT([cpu_has_feature_license], [
|
||||
AC_MSG_RESULT(no)
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_CPU_HAS_FEATURE_GPL_ONLY, 1,
|
||||
[cpu_has_feature() is GPL-only])
|
||||
])
|
||||
])
|
||||
@@ -2,12 +2,15 @@ dnl #
|
||||
dnl # 4.9, current_time() added
|
||||
dnl # 4.18, return type changed from timespec to timespec64
|
||||
dnl #
|
||||
dnl # Note that we don't care about the return type in this check. If we have
|
||||
dnl # to implement a fallback, we'll know we're <4.9, which was timespec.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_CURRENT_TIME], [
|
||||
ZFS_LINUX_TEST_SRC([current_time], [
|
||||
#include <linux/fs.h>
|
||||
], [
|
||||
struct inode ip __attribute__ ((unused));
|
||||
ip.i_atime = current_time(&ip);
|
||||
(void) current_time(&ip);
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_D_REVALIDATE_NAMEIDATA], [
|
||||
#include <linux/dcache.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int revalidate (struct dentry *dentry,
|
||||
static int revalidate (struct dentry *dentry,
|
||||
struct nameidata *nidata) { return 0; }
|
||||
|
||||
static const struct dentry_operations
|
||||
|
||||
@@ -8,7 +8,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_DIRTY_INODE], [
|
||||
ZFS_LINUX_TEST_SRC([dirty_inode_with_flags], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
void dirty_inode(struct inode *a, int b) { return; }
|
||||
static void dirty_inode(struct inode *a, int b) { return; }
|
||||
|
||||
static const struct super_operations
|
||||
sops __attribute__ ((unused)) = {
|
||||
|
||||
@@ -7,7 +7,7 @@ dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_ENCODE_FH_WITH_INODE], [
|
||||
ZFS_LINUX_TEST_SRC([export_operations_encode_fh], [
|
||||
#include <linux/exportfs.h>
|
||||
int encode_fh(struct inode *inode, __u32 *fh, int *max_len,
|
||||
static int encode_fh(struct inode *inode, __u32 *fh, int *max_len,
|
||||
struct inode *parent) { return 0; }
|
||||
static struct export_operations eops __attribute__ ((unused))={
|
||||
.encode_fh = encode_fh,
|
||||
|
||||
@@ -6,7 +6,7 @@ dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_EVICT_INODE], [
|
||||
ZFS_LINUX_TEST_SRC([evict_inode], [
|
||||
#include <linux/fs.h>
|
||||
void evict_inode (struct inode * t) { return; }
|
||||
static void evict_inode (struct inode * t) { return; }
|
||||
static struct super_operations sops __attribute__ ((unused)) = {
|
||||
.evict_inode = evict_inode,
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FALLOCATE], [
|
||||
ZFS_LINUX_TEST_SRC([file_fallocate], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
long test_fallocate(struct file *file, int mode,
|
||||
static long test_fallocate(struct file *file, int mode,
|
||||
loff_t offset, loff_t len) { return 0; }
|
||||
|
||||
static const struct file_operations
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_COPY_SPLICE_READ], [
|
||||
dnl #
|
||||
dnl # Kernel 6.5 - generic_file_splice_read was removed in favor
|
||||
dnl # of copy_splice_read for the .splice_read member of the
|
||||
dnl # file_operations struct.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([has_copy_splice_read], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
struct file_operations fops __attribute__((unused)) = {
|
||||
.splice_read = copy_splice_read,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_COPY_SPLICE_READ], [
|
||||
AC_MSG_CHECKING([whether copy_splice_read() exists])
|
||||
ZFS_LINUX_TEST_RESULT([has_copy_splice_read], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_COPY_SPLICE_READ, 1,
|
||||
[copy_splice_read exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,26 @@
|
||||
dnl #
|
||||
dnl # filemap_range_has_page was not available till 4.13
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_FILEMAP], [
|
||||
ZFS_LINUX_TEST_SRC([filemap_range_has_page], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct address_space *mapping = NULL;
|
||||
loff_t lstart = 0;
|
||||
loff_t lend = 0;
|
||||
bool ret __attribute__ ((unused));
|
||||
|
||||
ret = filemap_range_has_page(mapping, lstart, lend);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_FILEMAP], [
|
||||
AC_MSG_CHECKING([whether filemap_range_has_page() is available])
|
||||
ZFS_LINUX_TEST_RESULT([filemap_range_has_page], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_FILEMAP_RANGE_HAS_PAGE, 1,
|
||||
[filemap_range_has_page() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
@@ -0,0 +1,26 @@
|
||||
dnl #
|
||||
dnl # Starting from Linux 5.13, flush_dcache_page() becomes an inline
|
||||
dnl # function and may indirectly referencing GPL-only cpu_feature_keys on
|
||||
dnl # powerpc
|
||||
dnl #
|
||||
|
||||
dnl #
|
||||
dnl # Checking if flush_dcache_page is exported GPL-only
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_FLUSH_DCACHE_PAGE], [
|
||||
ZFS_LINUX_TEST_SRC([flush_dcache_page], [
|
||||
#include <asm/cacheflush.h>
|
||||
], [
|
||||
flush_dcache_page(0);
|
||||
], [], [ZFS_META_LICENSE])
|
||||
])
|
||||
AC_DEFUN([ZFS_AC_KERNEL_FLUSH_DCACHE_PAGE], [
|
||||
AC_MSG_CHECKING([whether flush_dcache_page() is GPL-only])
|
||||
ZFS_LINUX_TEST_RESULT([flush_dcache_page_license], [
|
||||
AC_MSG_RESULT(no)
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_FLUSH_DCACHE_PAGE_GPL_ONLY, 1,
|
||||
[flush_dcache_page() is GPL-only])
|
||||
])
|
||||
])
|
||||
+28
-11
@@ -91,6 +91,13 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
|
||||
__kernel_fpu_end();
|
||||
], [], [ZFS_META_LICENSE])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([kernel_neon], [
|
||||
#include <asm/neon.h>
|
||||
], [
|
||||
kernel_neon_begin();
|
||||
kernel_neon_end();
|
||||
], [], [ZFS_META_LICENSE])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([fpu_internal], [
|
||||
#if defined(__x86_64) || defined(__x86_64__) || \
|
||||
defined(__i386) || defined(__i386__)
|
||||
@@ -186,18 +193,28 @@ AC_DEFUN([ZFS_AC_KERNEL_FPU], [
|
||||
AC_DEFINE(KERNEL_EXPORTS_X86_FPU, 1,
|
||||
[kernel exports FPU functions])
|
||||
],[
|
||||
ZFS_LINUX_TEST_RESULT([fpu_internal], [
|
||||
AC_MSG_RESULT(internal)
|
||||
AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
|
||||
[kernel fpu internal])
|
||||
dnl #
|
||||
dnl # ARM neon symbols (only on arm and arm64)
|
||||
dnl # could be GPL-only on arm64 after Linux 6.2
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_RESULT([kernel_neon_license],[
|
||||
AC_MSG_RESULT(kernel_neon_*)
|
||||
AC_DEFINE(HAVE_KERNEL_NEON, 1,
|
||||
[kernel has kernel_neon_* functions])
|
||||
],[
|
||||
ZFS_LINUX_TEST_RESULT([fpu_xsave_internal], [
|
||||
AC_MSG_RESULT(internal with internal XSAVE)
|
||||
AC_DEFINE(HAVE_KERNEL_FPU_XSAVE_INTERNAL, 1,
|
||||
[kernel fpu and XSAVE internal])
|
||||
],[
|
||||
AC_MSG_RESULT(unavailable)
|
||||
])
|
||||
ZFS_LINUX_TEST_RESULT([fpu_internal], [
|
||||
AC_MSG_RESULT(internal)
|
||||
AC_DEFINE(HAVE_KERNEL_FPU_INTERNAL, 1,
|
||||
[kernel fpu internal])
|
||||
],[
|
||||
ZFS_LINUX_TEST_RESULT([fpu_xsave_internal], [
|
||||
AC_MSG_RESULT(internal with internal XSAVE)
|
||||
AC_DEFINE(HAVE_KERNEL_FPU_XSAVE_INTERNAL, 1,
|
||||
[kernel fpu and XSAVE internal])
|
||||
],[
|
||||
AC_MSG_RESULT(unavailable)
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
dnl #
|
||||
dnl # 6.6 API change,
|
||||
dnl # fsync_bdev was removed in favor of sync_blockdev
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SYNC_BDEV], [
|
||||
ZFS_LINUX_TEST_SRC([fsync_bdev], [
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
fsync_bdev(NULL);
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([sync_blockdev], [
|
||||
#include <linux/blkdev.h>
|
||||
],[
|
||||
sync_blockdev(NULL);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SYNC_BDEV], [
|
||||
AC_MSG_CHECKING([whether fsync_bdev() exists])
|
||||
ZFS_LINUX_TEST_RESULT([fsync_bdev], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_FSYNC_BDEV, 1,
|
||||
[fsync_bdev() is declared in include/blkdev.h])
|
||||
],[
|
||||
AC_MSG_CHECKING([whether sync_blockdev() exists])
|
||||
ZFS_LINUX_TEST_RESULT([sync_blockdev], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SYNC_BLOCKDEV, 1,
|
||||
[sync_blockdev() is declared in include/blkdev.h])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR(
|
||||
[neither fsync_bdev() nor sync_blockdev() exist])
|
||||
])
|
||||
])
|
||||
])
|
||||
@@ -5,7 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FSYNC], [
|
||||
ZFS_LINUX_TEST_SRC([fsync_without_dentry], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int test_fsync(struct file *f, int x) { return 0; }
|
||||
static int test_fsync(struct file *f, int x) { return 0; }
|
||||
|
||||
static const struct file_operations
|
||||
fops __attribute__ ((unused)) = {
|
||||
@@ -16,7 +16,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FSYNC], [
|
||||
ZFS_LINUX_TEST_SRC([fsync_range], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int test_fsync(struct file *f, loff_t a, loff_t b, int c)
|
||||
static int test_fsync(struct file *f, loff_t a, loff_t b, int c)
|
||||
{ return 0; }
|
||||
|
||||
static const struct file_operations
|
||||
|
||||
@@ -4,7 +4,14 @@ 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], [
|
||||
dnl # 6.3 API
|
||||
dnl # generic_fillattr() now takes struct mnt_idmap* as the first argument
|
||||
dnl #
|
||||
dnl # 6.6 API
|
||||
dnl # generic_fillattr() now takes u32 as second argument, representing a
|
||||
dnl # request_mask for statx
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR], [
|
||||
ZFS_LINUX_TEST_SRC([generic_fillattr_userns], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
@@ -13,16 +20,49 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS], [
|
||||
struct kstat *k = NULL;
|
||||
generic_fillattr(userns, in, k);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS], [
|
||||
AC_MSG_CHECKING([whether generic_fillattr requires 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*])
|
||||
ZFS_LINUX_TEST_SRC([generic_fillattr_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
struct mnt_idmap *idmap = NULL;
|
||||
struct inode *in = NULL;
|
||||
struct kstat *k = NULL;
|
||||
generic_fillattr(idmap, in, k);
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([generic_fillattr_mnt_idmap_reqmask], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct mnt_idmap *idmap = NULL;
|
||||
struct inode *in = NULL;
|
||||
struct kstat *k = NULL;
|
||||
generic_fillattr(idmap, 0, in, k);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FILLATTR], [
|
||||
AC_MSG_CHECKING(
|
||||
[whether generic_fillattr requires struct mnt_idmap* and request_mask])
|
||||
ZFS_LINUX_TEST_RESULT([generic_fillattr_mnt_idmap_reqmask], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_GENERIC_FILLATTR_IDMAP_REQMASK, 1,
|
||||
[generic_fillattr requires struct mnt_idmap* and u32 request_mask])
|
||||
],[
|
||||
AC_MSG_CHECKING([whether generic_fillattr requires struct mnt_idmap*])
|
||||
ZFS_LINUX_TEST_RESULT([generic_fillattr_mnt_idmap], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_GENERIC_FILLATTR_IDMAP, 1,
|
||||
[generic_fillattr requires struct mnt_idmap*])
|
||||
],[
|
||||
AC_MSG_CHECKING([whether generic_fillattr requires 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])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
@@ -2,7 +2,20 @@ dnl #
|
||||
dnl # Check for generic io accounting interface.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [
|
||||
ZFS_LINUX_TEST_SRC([bdev_io_acct], [
|
||||
ZFS_LINUX_TEST_SRC([bdev_io_acct_63], [
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct block_device *bdev = NULL;
|
||||
struct bio *bio = NULL;
|
||||
unsigned long passed_time = 0;
|
||||
unsigned long start_time;
|
||||
|
||||
start_time = bdev_start_io_acct(bdev, bio_op(bio),
|
||||
passed_time);
|
||||
bdev_end_io_acct(bdev, bio_op(bio), bio_sectors(bio), start_time);
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([bdev_io_acct_old], [
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct block_device *bdev = NULL;
|
||||
@@ -63,74 +76,85 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [
|
||||
dnl #
|
||||
dnl # 5.19 API,
|
||||
dnl # Linux 6.3, and then backports thereof, changed
|
||||
dnl # the signatures on bdev_start_io_acct/bdev_end_io_acct
|
||||
dnl #
|
||||
dnl # disk_start_io_acct() and disk_end_io_acct() have been replaced by
|
||||
dnl # bdev_start_io_acct() and bdev_end_io_acct().
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether generic bdev_*_io_acct() are available])
|
||||
ZFS_LINUX_TEST_RESULT([bdev_io_acct], [
|
||||
AC_MSG_CHECKING([whether 6.3+ bdev_*_io_acct() are available])
|
||||
ZFS_LINUX_TEST_RESULT([bdev_io_acct_63], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BDEV_IO_ACCT, 1, [bdev_*_io_acct() available])
|
||||
AC_DEFINE(HAVE_BDEV_IO_ACCT_63, 1, [bdev_*_io_acct() available])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
dnl #
|
||||
dnl # 5.12 API,
|
||||
dnl # 5.19 API,
|
||||
dnl #
|
||||
dnl # bio_start_io_acct() and bio_end_io_acct() became GPL-exported
|
||||
dnl # so use disk_start_io_acct() and disk_end_io_acct() instead
|
||||
dnl # disk_start_io_acct() and disk_end_io_acct() have been replaced by
|
||||
dnl # bdev_start_io_acct() and bdev_end_io_acct().
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether generic disk_*_io_acct() are available])
|
||||
ZFS_LINUX_TEST_RESULT([disk_io_acct], [
|
||||
AC_MSG_CHECKING([whether pre-6.3 bdev_*_io_acct() are available])
|
||||
ZFS_LINUX_TEST_RESULT([bdev_io_acct_old], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_DISK_IO_ACCT, 1, [disk_*_io_acct() available])
|
||||
AC_DEFINE(HAVE_BDEV_IO_ACCT_OLD, 1, [bdev_*_io_acct() available])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
dnl #
|
||||
dnl # 5.7 API,
|
||||
dnl # 5.12 API,
|
||||
dnl #
|
||||
dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers.
|
||||
dnl # bio_start_io_acct() and bio_end_io_acct() became GPL-exported
|
||||
dnl # so use disk_start_io_acct() and disk_end_io_acct() instead
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether generic bio_*_io_acct() are available])
|
||||
ZFS_LINUX_TEST_RESULT([bio_io_acct], [
|
||||
AC_MSG_CHECKING([whether generic disk_*_io_acct() are available])
|
||||
ZFS_LINUX_TEST_RESULT([disk_io_acct], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available])
|
||||
AC_DEFINE(HAVE_DISK_IO_ACCT, 1, [disk_*_io_acct() available])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
dnl #
|
||||
dnl # 4.14 API,
|
||||
dnl # 5.7 API,
|
||||
dnl #
|
||||
dnl # generic_start_io_acct/generic_end_io_acct now require
|
||||
dnl # request_queue to be provided. No functional changes,
|
||||
dnl # but preparation for inflight accounting.
|
||||
dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers.
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args])
|
||||
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args],
|
||||
[generic_start_io_acct], [block/bio.c], [
|
||||
AC_MSG_CHECKING([whether generic bio_*_io_acct() are available])
|
||||
ZFS_LINUX_TEST_RESULT([bio_io_acct], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1,
|
||||
[generic_*_io_acct() 4 arg available])
|
||||
AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
dnl #
|
||||
dnl # 3.19 API addition
|
||||
dnl # 4.14 API,
|
||||
dnl #
|
||||
dnl # torvalds/linux@394ffa50 allows us to increment
|
||||
dnl # iostat counters without generic_make_request().
|
||||
dnl # generic_start_io_acct/generic_end_io_acct now require
|
||||
dnl # request_queue to be provided. No functional changes,
|
||||
dnl # but preparation for inflight accounting.
|
||||
dnl #
|
||||
AC_MSG_CHECKING(
|
||||
[whether generic_*_io_acct wants 3 args])
|
||||
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args],
|
||||
AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args])
|
||||
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args],
|
||||
[generic_start_io_acct], [block/bio.c], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1,
|
||||
[generic_*_io_acct() 3 arg available])
|
||||
AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1,
|
||||
[generic_*_io_acct() 4 arg available])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
dnl #
|
||||
dnl # 3.19 API addition
|
||||
dnl #
|
||||
dnl # torvalds/linux@394ffa50 allows us to increment
|
||||
dnl # iostat counters without generic_make_request().
|
||||
dnl #
|
||||
AC_MSG_CHECKING(
|
||||
[whether generic_*_io_acct wants 3 args])
|
||||
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args],
|
||||
[generic_start_io_acct], [block/bio.c], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1,
|
||||
[generic_*_io_acct() 3 arg available])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -5,7 +5,7 @@ dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_LINK], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_get_link], [
|
||||
#include <linux/fs.h>
|
||||
const char *get_link(struct dentry *de, struct inode *ip,
|
||||
static const char *get_link(struct dentry *de, struct inode *ip,
|
||||
struct delayed_call *done) { return "symlink"; }
|
||||
static struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
@@ -15,7 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_LINK], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_get_link_cookie], [
|
||||
#include <linux/fs.h>
|
||||
const char *get_link(struct dentry *de, struct
|
||||
static const char *get_link(struct dentry *de, struct
|
||||
inode *ip, void **cookie) { return "symlink"; }
|
||||
static struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
@@ -25,7 +25,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_LINK], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_follow_link], [
|
||||
#include <linux/fs.h>
|
||||
const char *follow_link(struct dentry *de,
|
||||
static const char *follow_link(struct dentry *de,
|
||||
void **cookie) { return "symlink"; }
|
||||
static struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
@@ -35,7 +35,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_LINK], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_follow_link_nameidata], [
|
||||
#include <linux/fs.h>
|
||||
void *follow_link(struct dentry *de, struct
|
||||
static void *follow_link(struct dentry *de, struct
|
||||
nameidata *nd) { return (void *)NULL; }
|
||||
static struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [
|
||||
dnl #
|
||||
dnl # 6.3 API change
|
||||
dnl # The first arg is changed to struct mnt_idmap *
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([create_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
static int inode_create(struct mnt_idmap *idmap,
|
||||
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 # 5.12 API change that added the struct user_namespace* arg
|
||||
dnl # to the front of this function type's arg list.
|
||||
@@ -7,7 +25,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int inode_create(struct user_namespace *userns,
|
||||
static int inode_create(struct user_namespace *userns,
|
||||
struct inode *inode ,struct dentry *dentry,
|
||||
umode_t umode, bool flag) { return 0; }
|
||||
|
||||
@@ -24,7 +42,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int inode_create(struct inode *inode ,struct dentry *dentry,
|
||||
static int inode_create(struct inode *inode ,struct dentry *dentry,
|
||||
umode_t umode, bool flag) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
@@ -35,19 +53,28 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_CREATE], [
|
||||
AC_MSG_CHECKING([whether iops->create() takes struct user_namespace*])
|
||||
ZFS_LINUX_TEST_RESULT([create_userns], [
|
||||
AC_MSG_CHECKING([whether iops->create() takes struct mnt_idmap*])
|
||||
ZFS_LINUX_TEST_RESULT([create_mnt_idmap], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOPS_CREATE_USERNS, 1,
|
||||
[iops->create() takes struct user_namespace*])
|
||||
AC_DEFINE(HAVE_IOPS_CREATE_IDMAP, 1,
|
||||
[iops->create() takes struct mnt_idmap*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING([whether iops->create() passes flags])
|
||||
ZFS_LINUX_TEST_RESULT([create_flags], [
|
||||
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,4 +1,24 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
|
||||
dnl #
|
||||
dnl # Linux 6.3 API
|
||||
dnl # The first arg of getattr I/O operations handler type
|
||||
dnl # is changed to struct mnt_idmap*
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_getattr_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
static int test_getattr(
|
||||
struct mnt_idmap *idmap,
|
||||
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 5.12 API
|
||||
dnl # The getattr I/O operations handler type was extended to require
|
||||
@@ -8,7 +28,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_getattr_userns], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int test_getattr(
|
||||
static int test_getattr(
|
||||
struct user_namespace *userns,
|
||||
const struct path *p, struct kstat *k,
|
||||
u32 request_mask, unsigned int query_flags)
|
||||
@@ -27,7 +47,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_getattr_path], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int test_getattr(
|
||||
static int test_getattr(
|
||||
const struct path *p, struct kstat *k,
|
||||
u32 request_mask, unsigned int query_flags)
|
||||
{ return 0; }
|
||||
@@ -41,7 +61,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_getattr_vfsmount], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int test_getattr(
|
||||
static int test_getattr(
|
||||
struct vfsmount *mnt, struct dentry *d,
|
||||
struct kstat *k)
|
||||
{ return 0; }
|
||||
@@ -55,37 +75,48 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_INODE_GETATTR], [
|
||||
dnl #
|
||||
dnl # Kernel 5.12 test
|
||||
dnl # Kernel 6.3 test
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether iops->getattr() takes user_namespace])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_getattr_userns], [
|
||||
AC_MSG_CHECKING([whether iops->getattr() takes mnt_idmap])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_getattr_mnt_idmap], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_USERNS_IOPS_GETATTR, 1,
|
||||
[iops->getattr() takes struct user_namespace*])
|
||||
AC_DEFINE(HAVE_IDMAP_IOPS_GETATTR, 1,
|
||||
[iops->getattr() takes struct mnt_idmap*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
dnl #
|
||||
dnl # Kernel 4.11 test
|
||||
dnl # Kernel 5.12 test
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether iops->getattr() takes a path])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [
|
||||
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)
|
||||
|
||||
dnl #
|
||||
dnl # Kernel < 4.11 test
|
||||
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_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)
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -6,7 +6,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
struct dentry *inode_lookup(struct inode *inode,
|
||||
static struct dentry *inode_lookup(struct inode *inode,
|
||||
struct dentry *dentry, unsigned int flags) { return NULL; }
|
||||
|
||||
static const struct inode_operations iops
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_SETATTR], [
|
||||
dnl #
|
||||
dnl # Linux 6.3 API
|
||||
dnl # The first arg of setattr I/O operations handler type
|
||||
dnl # is changed to struct mnt_idmap*
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_setattr_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
static int test_setattr(
|
||||
struct mnt_idmap *idmap,
|
||||
struct dentry *de, struct iattr *ia)
|
||||
{ return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.setattr = test_setattr,
|
||||
};
|
||||
],[])
|
||||
|
||||
dnl #
|
||||
dnl # Linux 5.12 API
|
||||
dnl # The setattr 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_setattr_userns], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
static int test_setattr(
|
||||
struct user_namespace *userns,
|
||||
struct dentry *de, struct iattr *ia)
|
||||
{ return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.setattr = test_setattr,
|
||||
};
|
||||
],[])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_setattr], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
static int test_setattr(
|
||||
struct dentry *de, struct iattr *ia)
|
||||
{ return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.setattr = test_setattr,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_INODE_SETATTR], [
|
||||
dnl #
|
||||
dnl # Kernel 6.3 test
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether iops->setattr() takes mnt_idmap])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_setattr_mnt_idmap], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IDMAP_IOPS_SETATTR, 1,
|
||||
[iops->setattr() takes struct mnt_idmap*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
dnl #
|
||||
dnl # Kernel 5.12 test
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether iops->setattr() takes user_namespace])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_setattr_userns], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_USERNS_IOPS_SETATTR, 1,
|
||||
[iops->setattr() takes struct user_namespace*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING([whether iops->setattr() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_setattr], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOPS_SETATTR, 1,
|
||||
[iops->setattr() exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
@@ -27,6 +27,73 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_TIMES], [
|
||||
memset(&ip, 0, sizeof(ip));
|
||||
ts = ip.i_mtime;
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.6 API change
|
||||
dnl # i_ctime no longer directly accessible, must use
|
||||
dnl # inode_get_ctime(ip), inode_set_ctime*(ip) to
|
||||
dnl # read/write.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_get_ctime], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct inode ip;
|
||||
|
||||
memset(&ip, 0, sizeof(ip));
|
||||
inode_get_ctime(&ip);
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([inode_set_ctime_to_ts], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct inode ip;
|
||||
struct timespec64 ts = {0};
|
||||
|
||||
memset(&ip, 0, sizeof(ip));
|
||||
inode_set_ctime_to_ts(&ip, ts);
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.7 API change
|
||||
dnl # i_atime/i_mtime no longer directly accessible, must use
|
||||
dnl # inode_get_mtime(ip), inode_set_mtime*(ip) to
|
||||
dnl # read/write.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_get_atime], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct inode ip;
|
||||
|
||||
memset(&ip, 0, sizeof(ip));
|
||||
inode_get_atime(&ip);
|
||||
])
|
||||
ZFS_LINUX_TEST_SRC([inode_get_mtime], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct inode ip;
|
||||
|
||||
memset(&ip, 0, sizeof(ip));
|
||||
inode_get_mtime(&ip);
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([inode_set_atime_to_ts], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct inode ip;
|
||||
struct timespec64 ts = {0};
|
||||
|
||||
memset(&ip, 0, sizeof(ip));
|
||||
inode_set_atime_to_ts(&ip, ts);
|
||||
])
|
||||
ZFS_LINUX_TEST_SRC([inode_set_mtime_to_ts], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct inode ip;
|
||||
struct timespec64 ts = {0};
|
||||
|
||||
memset(&ip, 0, sizeof(ip));
|
||||
inode_set_mtime_to_ts(&ip, ts);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [
|
||||
@@ -47,4 +114,58 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_TIMES], [
|
||||
AC_DEFINE(HAVE_INODE_TIMESPEC64_TIMES, 1,
|
||||
[inode->i_*time's are timespec64])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether inode_get_ctime() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_get_ctime], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INODE_GET_CTIME, 1,
|
||||
[inode_get_ctime() exists in linux/fs.h])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether inode_set_ctime_to_ts() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_set_ctime_to_ts], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INODE_SET_CTIME_TO_TS, 1,
|
||||
[inode_set_ctime_to_ts() exists in linux/fs.h])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether inode_get_atime() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_get_atime], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INODE_GET_ATIME, 1,
|
||||
[inode_get_atime() exists in linux/fs.h])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether inode_set_atime_to_ts() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_set_atime_to_ts], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INODE_SET_ATIME_TO_TS, 1,
|
||||
[inode_set_atime_to_ts() exists in linux/fs.h])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether inode_get_mtime() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_get_mtime], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INODE_GET_MTIME, 1,
|
||||
[inode_get_mtime() exists in linux/fs.h])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether inode_set_mtime_to_ts() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_set_mtime_to_ts], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INODE_SET_MTIME_TO_TS, 1,
|
||||
[inode_set_mtime_to_ts() exists in linux/fs.h])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
@@ -16,12 +16,20 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE], [
|
||||
(void) inode_owner_or_capable(ip);
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([inode_owner_or_capable_idmapped], [
|
||||
ZFS_LINUX_TEST_SRC([inode_owner_or_capable_userns], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
struct inode *ip = NULL;
|
||||
(void) inode_owner_or_capable(&init_user_ns, ip);
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([inode_owner_or_capable_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mnt_idmapping.h>
|
||||
],[
|
||||
struct inode *ip = NULL;
|
||||
(void) inode_owner_or_capable(&nop_mnt_idmap, ip);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [
|
||||
@@ -35,12 +43,21 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [
|
||||
|
||||
AC_MSG_CHECKING(
|
||||
[whether inode_owner_or_capable() takes user_ns])
|
||||
ZFS_LINUX_TEST_RESULT([inode_owner_or_capable_idmapped], [
|
||||
ZFS_LINUX_TEST_RESULT([inode_owner_or_capable_userns], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED, 1,
|
||||
AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE_USERNS, 1,
|
||||
[inode_owner_or_capable() takes user_ns])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([capability])
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(
|
||||
[whether inode_owner_or_capable() takes mnt_idmap])
|
||||
ZFS_LINUX_TEST_RESULT([inode_owner_or_capable_mnt_idmap], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE_IDMAP, 1,
|
||||
[inode_owner_or_capable() takes mnt_idmap])
|
||||
], [
|
||||
ZFS_LINUX_TEST_ERROR([capability])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -4,7 +4,7 @@ dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [
|
||||
ZFS_LINUX_TEST_SRC([make_request_fn_void], [
|
||||
#include <linux/blkdev.h>
|
||||
void make_request(struct request_queue *q,
|
||||
static void make_request(struct request_queue *q,
|
||||
struct bio *bio) { return; }
|
||||
],[
|
||||
blk_queue_make_request(NULL, &make_request);
|
||||
@@ -12,7 +12,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([make_request_fn_blk_qc_t], [
|
||||
#include <linux/blkdev.h>
|
||||
blk_qc_t make_request(struct request_queue *q,
|
||||
static blk_qc_t make_request(struct request_queue *q,
|
||||
struct bio *bio) { return (BLK_QC_T_NONE); }
|
||||
],[
|
||||
blk_queue_make_request(NULL, &make_request);
|
||||
@@ -20,7 +20,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([blk_alloc_queue_request_fn], [
|
||||
#include <linux/blkdev.h>
|
||||
blk_qc_t make_request(struct request_queue *q,
|
||||
static blk_qc_t make_request(struct request_queue *q,
|
||||
struct bio *bio) { return (BLK_QC_T_NONE); }
|
||||
],[
|
||||
struct request_queue *q __attribute__ ((unused));
|
||||
@@ -29,7 +29,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([blk_alloc_queue_request_fn_rh], [
|
||||
#include <linux/blkdev.h>
|
||||
blk_qc_t make_request(struct request_queue *q,
|
||||
static blk_qc_t make_request(struct request_queue *q,
|
||||
struct bio *bio) { return (BLK_QC_T_NONE); }
|
||||
],[
|
||||
struct request_queue *q __attribute__ ((unused));
|
||||
|
||||
+43
-16
@@ -2,6 +2,22 @@ dnl #
|
||||
dnl # Supported mkdir() interfaces checked newest to oldest.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [
|
||||
dnl #
|
||||
dnl # 6.3 API change
|
||||
dnl # mkdir() takes struct mnt_idmap * as the first arg
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([mkdir_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
static int mkdir(struct mnt_idmap *idmap,
|
||||
struct inode *inode, struct dentry *dentry,
|
||||
umode_t umode) { return 0; }
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.mkdir = mkdir,
|
||||
};
|
||||
],[])
|
||||
|
||||
dnl #
|
||||
dnl # 5.12 API change
|
||||
dnl # The struct user_namespace arg was added as the first argument to
|
||||
@@ -10,7 +26,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [
|
||||
ZFS_LINUX_TEST_SRC([mkdir_user_namespace], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int mkdir(struct user_namespace *userns,
|
||||
static int mkdir(struct user_namespace *userns,
|
||||
struct inode *inode, struct dentry *dentry,
|
||||
umode_t umode) { return 0; }
|
||||
|
||||
@@ -31,7 +47,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int mkdir(struct inode *inode, struct dentry *dentry,
|
||||
static int mkdir(struct inode *inode, struct dentry *dentry,
|
||||
umode_t umode) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
@@ -43,25 +59,36 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_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 # 6.3 API change
|
||||
dnl # mkdir() takes struct mnt_idmap * as the first arg
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether iops->mkdir() takes struct user_namespace*])
|
||||
ZFS_LINUX_TEST_RESULT([mkdir_user_namespace], [
|
||||
AC_MSG_CHECKING([whether iops->mkdir() takes struct mnt_idmap*])
|
||||
ZFS_LINUX_TEST_RESULT([mkdir_mnt_idmap], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1,
|
||||
[iops->mkdir() takes struct user_namespace*])
|
||||
AC_DEFINE(HAVE_IOPS_MKDIR_IDMAP, 1,
|
||||
[iops->mkdir() takes struct mnt_idmap*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING([whether iops->mkdir() takes umode_t])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_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_MKDIR_UMODE_T, 1,
|
||||
[iops->mkdir() takes umode_t])
|
||||
AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1,
|
||||
[iops->mkdir() takes struct user_namespace*])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([mkdir()])
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
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()])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
+31
-5
@@ -1,4 +1,22 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_MKNOD], [
|
||||
dnl #
|
||||
dnl # 6.3 API change
|
||||
dnl # The first arg is now struct mnt_idmap*
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([mknod_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
static int tmp_mknod(struct mnt_idmap *idmap,
|
||||
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,
|
||||
};
|
||||
],[])
|
||||
|
||||
dnl #
|
||||
dnl # 5.12 API change that added the struct user_namespace* arg
|
||||
dnl # to the front of this function type's arg list.
|
||||
@@ -7,7 +25,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MKNOD], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int tmp_mknod(struct user_namespace *userns,
|
||||
static int tmp_mknod(struct user_namespace *userns,
|
||||
struct inode *inode ,struct dentry *dentry,
|
||||
umode_t u, dev_t d) { return 0; }
|
||||
|
||||
@@ -19,12 +37,20 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_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_CHECKING([whether iops->mknod() takes struct mnt_idmap*])
|
||||
ZFS_LINUX_TEST_RESULT([mknod_mnt_idmap], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOPS_MKNOD_USERNS, 1,
|
||||
[iops->mknod() takes struct user_namespace*])
|
||||
AC_DEFINE(HAVE_IOPS_MKNOD_IDMAP, 1,
|
||||
[iops->mknod() takes struct mnt_idmap*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
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)
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -7,14 +7,14 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_PROC_OPERATIONS], [
|
||||
ZFS_LINUX_TEST_SRC([proc_ops_struct], [
|
||||
#include <linux/proc_fs.h>
|
||||
|
||||
int test_open(struct inode *ip, struct file *fp) { return 0; }
|
||||
ssize_t test_read(struct file *fp, char __user *ptr,
|
||||
static int test_open(struct inode *ip, struct file *fp) { return 0; }
|
||||
static ssize_t test_read(struct file *fp, char __user *ptr,
|
||||
size_t size, loff_t *offp) { return 0; }
|
||||
ssize_t test_write(struct file *fp, const char __user *ptr,
|
||||
static ssize_t test_write(struct file *fp, const char __user *ptr,
|
||||
size_t size, loff_t *offp) { return 0; }
|
||||
loff_t test_lseek(struct file *fp, loff_t off, int flag)
|
||||
static loff_t test_lseek(struct file *fp, loff_t off, int flag)
|
||||
{ return 0; }
|
||||
int test_release(struct inode *ip, struct file *fp)
|
||||
static int test_release(struct inode *ip, struct file *fp)
|
||||
{ return 0; }
|
||||
|
||||
const struct proc_ops test_ops __attribute__ ((unused)) = {
|
||||
|
||||
@@ -4,7 +4,7 @@ dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_PUT_LINK], [
|
||||
ZFS_LINUX_TEST_SRC([put_link_cookie], [
|
||||
#include <linux/fs.h>
|
||||
void put_link(struct inode *ip, void *cookie)
|
||||
static void put_link(struct inode *ip, void *cookie)
|
||||
{ return; }
|
||||
static struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
@@ -14,7 +14,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_PUT_LINK], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([put_link_nameidata], [
|
||||
#include <linux/fs.h>
|
||||
void put_link(struct dentry *de, struct
|
||||
static void put_link(struct dentry *de, struct
|
||||
nameidata *nd, void *ptr) { return; }
|
||||
static struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_RECLAIMED], [
|
||||
dnl #
|
||||
dnl # 6.4 API change
|
||||
dnl # The reclaimed_slab of struct reclaim_state
|
||||
dnl # is renamed to reclaimed
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([reclaim_state_reclaimed], [
|
||||
#include <linux/swap.h>
|
||||
static const struct reclaim_state
|
||||
rs __attribute__ ((unused)) = {
|
||||
.reclaimed = 100,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_RECLAIMED], [
|
||||
AC_MSG_CHECKING([whether struct reclaim_state has reclaimed field])
|
||||
ZFS_LINUX_TEST_RESULT([reclaim_state_reclaimed], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_RECLAIM_STATE_RECLAIMED, 1,
|
||||
[struct reclaim_state has reclaimed])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
dnl #
|
||||
dnl # Linux 6.5 removes register_sysctl_table
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_REGISTER_SYSCTL_TABLE], [
|
||||
ZFS_LINUX_TEST_SRC([has_register_sysctl_table], [
|
||||
#include <linux/sysctl.h>
|
||||
|
||||
static struct ctl_table dummy_table[] = {
|
||||
{}
|
||||
};
|
||||
|
||||
],[
|
||||
struct ctl_table_header *h
|
||||
__attribute((unused)) = register_sysctl_table(dummy_table);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_REGISTER_SYSCTL_TABLE], [
|
||||
AC_MSG_CHECKING([whether register_sysctl_table exists])
|
||||
ZFS_LINUX_TEST_RESULT([has_register_sysctl_table], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_REGISTER_SYSCTL_TABLE, 1,
|
||||
[register_sysctl_table exists])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
+34
-10
@@ -6,7 +6,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_rename_flags], [
|
||||
#include <linux/fs.h>
|
||||
int rename_fn(struct inode *sip, struct dentry *sdp,
|
||||
static int rename_fn(struct inode *sip, struct dentry *sdp,
|
||||
struct inode *tip, struct dentry *tdp,
|
||||
unsigned int flags) { return 0; }
|
||||
|
||||
@@ -24,7 +24,22 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_rename_userns], [
|
||||
#include <linux/fs.h>
|
||||
int rename_fn(struct user_namespace *user_ns, struct inode *sip,
|
||||
static 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,
|
||||
};
|
||||
],[])
|
||||
|
||||
dnl #
|
||||
dnl # 6.3 API change - the first arg is now struct mnt_idmap*
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_rename_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
static int rename_fn(struct mnt_idmap *idmap, struct inode *sip,
|
||||
struct dentry *sdp, struct inode *tip, struct dentry *tdp,
|
||||
unsigned int flags) { return 0; }
|
||||
|
||||
@@ -36,21 +51,30 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_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_CHECKING([whether iops->rename() takes struct mnt_idmap*])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_rename_mnt_idmap], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOPS_RENAME_USERNS, 1,
|
||||
[iops->rename() takes struct user_namespace*])
|
||||
AC_DEFINE(HAVE_IOPS_RENAME_IDMAP, 1,
|
||||
[iops->rename() takes struct mnt_idmap*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING([whether iop->rename() wants flags])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_rename_flags], [
|
||||
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)
|
||||
|
||||
AC_MSG_CHECKING([whether iops->rename() wants flags])
|
||||
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)
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -27,26 +27,48 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SETATTR_PREPARE], [
|
||||
int error __attribute__ ((unused)) =
|
||||
setattr_prepare(userns, dentry, attr);
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.3 API change
|
||||
dnl # The first arg of setattr_prepare() is changed to struct mnt_idmap*
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([setattr_prepare_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
], [
|
||||
struct dentry *dentry = NULL;
|
||||
struct iattr *attr = NULL;
|
||||
struct mnt_idmap *idmap = NULL;
|
||||
int error __attribute__ ((unused)) =
|
||||
setattr_prepare(idmap, dentry, attr);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SETATTR_PREPARE], [
|
||||
AC_MSG_CHECKING([whether setattr_prepare() is available and accepts struct user_namespace*])
|
||||
ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare_userns],
|
||||
AC_MSG_CHECKING([whether setattr_prepare() is available and accepts struct mnt_idmap*])
|
||||
ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare_mnt_idmap],
|
||||
[setattr_prepare], [fs/attr.c], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SETATTR_PREPARE_USERNS, 1,
|
||||
[setattr_prepare() accepts user_namespace])
|
||||
AC_DEFINE(HAVE_SETATTR_PREPARE_IDMAP, 1,
|
||||
[setattr_prepare() accepts mnt_idmap])
|
||||
], [
|
||||
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_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_NO_USERNS, 1,
|
||||
[setattr_prepare() is available, doesn't accept user_namespace])
|
||||
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)
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -5,7 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SHOW_OPTIONS], [
|
||||
ZFS_LINUX_TEST_SRC([super_operations_show_options], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int show_options(struct seq_file * x, struct dentry * y) {
|
||||
static int show_options(struct seq_file * x, struct dentry * y) {
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
+84
-12
@@ -8,9 +8,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK], [
|
||||
ZFS_LINUX_TEST_SRC([super_block_s_shrink], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int shrink(struct shrinker *s, struct shrink_control *sc)
|
||||
{ return 0; }
|
||||
|
||||
static const struct super_block
|
||||
sb __attribute__ ((unused)) = {
|
||||
.s_shrink.seeks = DEFAULT_SEEKS,
|
||||
@@ -19,12 +16,44 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK], [
|
||||
],[])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.7 API change
|
||||
dnl # s_shrink is now a pointer.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK_PTR], [
|
||||
ZFS_LINUX_TEST_SRC([super_block_s_shrink_ptr], [
|
||||
#include <linux/fs.h>
|
||||
static unsigned long shrinker_cb(struct shrinker *shrink,
|
||||
struct shrink_control *sc) { return 0; }
|
||||
static struct shrinker shrinker = {
|
||||
.count_objects = shrinker_cb,
|
||||
.scan_objects = shrinker_cb,
|
||||
.seeks = DEFAULT_SEEKS,
|
||||
};
|
||||
static const struct super_block
|
||||
sb __attribute__ ((unused)) = {
|
||||
.s_shrink = &shrinker,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SUPER_BLOCK_S_SHRINK], [
|
||||
AC_MSG_CHECKING([whether super_block has s_shrink])
|
||||
ZFS_LINUX_TEST_RESULT([super_block_s_shrink], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SUPER_BLOCK_S_SHRINK, 1,
|
||||
[have super_block s_shrink])
|
||||
],[
|
||||
ZFS_LINUX_TEST_ERROR([sb->s_shrink()])
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([whether super_block has s_shrink pointer])
|
||||
ZFS_LINUX_TEST_RESULT([super_block_s_shrink_ptr], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SUPER_BLOCK_S_SHRINK_PTR, 1,
|
||||
[have super_block s_shrink pointer])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
ZFS_LINUX_TEST_ERROR([sb->s_shrink()])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -57,7 +86,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID], [
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_REGISTER_SHRINKER_VARARG], [
|
||||
ZFS_LINUX_TEST_SRC([register_shrinker_vararg], [
|
||||
#include <linux/mm.h>
|
||||
unsigned long shrinker_cb(struct shrinker *shrink,
|
||||
static unsigned long shrinker_cb(struct shrinker *shrink,
|
||||
struct shrink_control *sc) { return 0; }
|
||||
],[
|
||||
struct shrinker cache_shrinker = {
|
||||
@@ -72,7 +101,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_REGISTER_SHRINKER_VARARG], [
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK], [
|
||||
ZFS_LINUX_TEST_SRC([shrinker_cb_shrink_control], [
|
||||
#include <linux/mm.h>
|
||||
int shrinker_cb(struct shrinker *shrink,
|
||||
static int shrinker_cb(struct shrinker *shrink,
|
||||
struct shrink_control *sc) { return 0; }
|
||||
],[
|
||||
struct shrinker cache_shrinker = {
|
||||
@@ -84,7 +113,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([shrinker_cb_shrink_control_split], [
|
||||
#include <linux/mm.h>
|
||||
unsigned long shrinker_cb(struct shrinker *shrink,
|
||||
static unsigned long shrinker_cb(struct shrinker *shrink,
|
||||
struct shrink_control *sc) { return 0; }
|
||||
],[
|
||||
struct shrinker cache_shrinker = {
|
||||
@@ -96,6 +125,25 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK], [
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.7 API change
|
||||
dnl # register_shrinker has been replaced by shrinker_register.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_REGISTER], [
|
||||
ZFS_LINUX_TEST_SRC([shrinker_register], [
|
||||
#include <linux/shrinker.h>
|
||||
static unsigned long shrinker_cb(struct shrinker *shrink,
|
||||
struct shrink_control *sc) { return 0; }
|
||||
],[
|
||||
struct shrinker cache_shrinker = {
|
||||
.count_objects = shrinker_cb,
|
||||
.scan_objects = shrinker_cb,
|
||||
.seeks = DEFAULT_SEEKS,
|
||||
};
|
||||
shrinker_register(&cache_shrinker);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[
|
||||
dnl #
|
||||
dnl # 6.0 API change
|
||||
@@ -133,14 +181,36 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINKER_CALLBACK],[
|
||||
dnl # cs->shrink() is logically split in to
|
||||
dnl # cs->count_objects() and cs->scan_objects()
|
||||
dnl #
|
||||
AC_MSG_CHECKING([if cs->count_objects callback exists])
|
||||
AC_MSG_CHECKING(
|
||||
[whether cs->count_objects callback exists])
|
||||
ZFS_LINUX_TEST_RESULT(
|
||||
[shrinker_cb_shrink_control_split],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK, 1,
|
||||
[cs->count_objects exists])
|
||||
[shrinker_cb_shrink_control_split],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK, 1,
|
||||
[cs->count_objects exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING(
|
||||
[whether shrinker_register exists])
|
||||
ZFS_LINUX_TEST_RESULT([shrinker_register], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SHRINKER_REGISTER, 1,
|
||||
[shrinker_register exists])
|
||||
|
||||
dnl # We assume that the split shrinker
|
||||
dnl # callback exists if
|
||||
dnl # shrinker_register() exists,
|
||||
dnl # because the latter is a much more
|
||||
dnl # recent addition, and the macro
|
||||
dnl # test for shrinker_register() only
|
||||
dnl # works if the callback is split
|
||||
AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK,
|
||||
1, [cs->count_objects exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
ZFS_LINUX_TEST_ERROR([shrinker])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
@@ -174,10 +244,12 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINK_CONTROL_STRUCT], [
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER], [
|
||||
ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK
|
||||
ZFS_AC_KERNEL_SRC_SUPER_BLOCK_S_SHRINK_PTR
|
||||
ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_HAS_NID
|
||||
ZFS_AC_KERNEL_SRC_SHRINKER_CALLBACK
|
||||
ZFS_AC_KERNEL_SRC_SHRINK_CONTROL_STRUCT
|
||||
ZFS_AC_KERNEL_SRC_REGISTER_SHRINKER_VARARG
|
||||
ZFS_AC_KERNEL_SRC_SHRINKER_REGISTER
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SHRINKER], [
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
dnl #
|
||||
dnl # 6.8.x replaced strlcpy with strscpy. Check for both so we can provide
|
||||
dnl # appropriate fallbacks.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_STRLCPY], [
|
||||
ZFS_LINUX_TEST_SRC([kernel_has_strlcpy], [
|
||||
#include <linux/string.h>
|
||||
], [
|
||||
const char *src = "goodbye";
|
||||
char dst[32];
|
||||
size_t len;
|
||||
len = strlcpy(dst, src, sizeof (dst));
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_STRSCPY], [
|
||||
ZFS_LINUX_TEST_SRC([kernel_has_strscpy], [
|
||||
#include <linux/string.h>
|
||||
], [
|
||||
const char *src = "goodbye";
|
||||
char dst[32];
|
||||
ssize_t len;
|
||||
len = strscpy(dst, src, sizeof (dst));
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_STRLCPY], [
|
||||
AC_MSG_CHECKING([whether strlcpy() exists])
|
||||
ZFS_LINUX_TEST_RESULT([kernel_has_strlcpy], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_KERNEL_STRLCPY, 1,
|
||||
[strlcpy() exists])
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_STRSCPY], [
|
||||
AC_MSG_CHECKING([whether strscpy() exists])
|
||||
ZFS_LINUX_TEST_RESULT([kernel_has_strscpy], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_KERNEL_STRSCPY, 1,
|
||||
[strscpy() exists])
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
@@ -1,4 +1,20 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SYMLINK], [
|
||||
dnl #
|
||||
dnl # 6.3 API change that changed the first arg
|
||||
dnl # to struct mnt_idmap*
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([symlink_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
static int tmp_symlink(struct mnt_idmap *idmap,
|
||||
struct inode *inode ,struct dentry *dentry,
|
||||
const char *path) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.symlink = tmp_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.
|
||||
@@ -7,7 +23,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SYMLINK], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int tmp_symlink(struct user_namespace *userns,
|
||||
static int tmp_symlink(struct user_namespace *userns,
|
||||
struct inode *inode ,struct dentry *dentry,
|
||||
const char *path) { return 0; }
|
||||
|
||||
@@ -19,12 +35,19 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_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_CHECKING([whether iops->symlink() takes struct mnt_idmap*])
|
||||
ZFS_LINUX_TEST_RESULT([symlink_mnt_idmap], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOPS_SYMLINK_USERNS, 1,
|
||||
[iops->symlink() takes struct user_namespace*])
|
||||
AC_DEFINE(HAVE_IOPS_SYMLINK_IDMAP, 1,
|
||||
[iops->symlink() takes struct mnt_idmap*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
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)
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -18,7 +18,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_TIMER_SETUP], [
|
||||
int data;
|
||||
};
|
||||
|
||||
void task_expire(struct timer_list *tl)
|
||||
static void task_expire(struct timer_list *tl)
|
||||
{
|
||||
struct my_task_timer *task_timer =
|
||||
from_timer(task_timer, tl, timer);
|
||||
@@ -31,7 +31,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_TIMER_SETUP], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([timer_list_function], [
|
||||
#include <linux/timer.h>
|
||||
void task_expire(struct timer_list *tl) {}
|
||||
static void task_expire(struct timer_list *tl) {}
|
||||
],[
|
||||
struct timer_list tl;
|
||||
tl.function = task_expire;
|
||||
|
||||
+29
-10
@@ -4,12 +4,25 @@ dnl # Add support for i_op->tmpfile
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_TMPFILE], [
|
||||
dnl #
|
||||
dnl # 6.3 API change
|
||||
dnl # The first arg is now struct mnt_idmap *
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
static int tmpfile(struct mnt_idmap *idmap,
|
||||
struct inode *inode, struct file *file,
|
||||
umode_t mode) { return 0; }
|
||||
static struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.tmpfile = tmpfile,
|
||||
};
|
||||
],[])
|
||||
dnl # 6.1 API change
|
||||
dnl # use struct file instead of struct dentry
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
|
||||
#include <linux/fs.h>
|
||||
int tmpfile(struct user_namespace *userns,
|
||||
static int tmpfile(struct user_namespace *userns,
|
||||
struct inode *inode, struct file *file,
|
||||
umode_t mode) { return 0; }
|
||||
static struct inode_operations
|
||||
@@ -23,7 +36,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_TMPFILE], [
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_dentry_userns], [
|
||||
#include <linux/fs.h>
|
||||
int tmpfile(struct user_namespace *userns,
|
||||
static int tmpfile(struct user_namespace *userns,
|
||||
struct inode *inode, struct dentry *dentry,
|
||||
umode_t mode) { return 0; }
|
||||
static struct inode_operations
|
||||
@@ -33,7 +46,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_TMPFILE], [
|
||||
],[])
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_dentry], [
|
||||
#include <linux/fs.h>
|
||||
int tmpfile(struct inode *inode, struct dentry *dentry,
|
||||
static int tmpfile(struct inode *inode, struct dentry *dentry,
|
||||
umode_t mode) { return 0; }
|
||||
static struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
@@ -44,23 +57,29 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_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_mnt_idmap], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
|
||||
AC_DEFINE(HAVE_TMPFILE_USERNS, 1, [i_op->tmpfile() has userns])
|
||||
],[
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_dentry_userns], [
|
||||
AC_DEFINE(HAVE_TMPFILE_IDMAP, 1, [i_op->tmpfile() has mnt_idmap])
|
||||
], [
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
|
||||
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_DEFINE(HAVE_TMPFILE_DENTRY, 1, [i_op->tmpfile() uses old dentry signature])
|
||||
],[
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_dentry], [
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_dentry_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_DEFINE(HAVE_TMPFILE_DENTRY, 1, [i_op->tmpfile() uses old dentry signature])
|
||||
],[
|
||||
ZFS_LINUX_REQUIRE_API([i_op->tmpfile()], [3.11])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_dentry], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
|
||||
AC_DEFINE(HAVE_TMPFILE_DENTRY, 1, [i_op->tmpfile() uses old dentry signature])
|
||||
],[
|
||||
ZFS_LINUX_REQUIRE_API([i_op->tmpfile()], [3.11])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -5,7 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO], [
|
||||
ZFS_LINUX_TEST_SRC([direct_io_iter], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
ssize_t test_direct_IO(struct kiocb *kiocb,
|
||||
static ssize_t test_direct_IO(struct kiocb *kiocb,
|
||||
struct iov_iter *iter) { return 0; }
|
||||
|
||||
static const struct address_space_operations
|
||||
@@ -17,7 +17,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO], [
|
||||
ZFS_LINUX_TEST_SRC([direct_io_iter_offset], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
ssize_t test_direct_IO(struct kiocb *kiocb,
|
||||
static ssize_t test_direct_IO(struct kiocb *kiocb,
|
||||
struct iov_iter *iter, loff_t offset) { return 0; }
|
||||
|
||||
static const struct address_space_operations
|
||||
@@ -29,7 +29,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO], [
|
||||
ZFS_LINUX_TEST_SRC([direct_io_iter_rw_offset], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
ssize_t test_direct_IO(int rw, struct kiocb *kiocb,
|
||||
static ssize_t test_direct_IO(int rw, struct kiocb *kiocb,
|
||||
struct iov_iter *iter, loff_t offset) { return 0; }
|
||||
|
||||
static const struct address_space_operations
|
||||
@@ -41,7 +41,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO], [
|
||||
ZFS_LINUX_TEST_SRC([direct_io_iovec], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
ssize_t test_direct_IO(int rw, struct kiocb *kiocb,
|
||||
static ssize_t test_direct_IO(int rw, struct kiocb *kiocb,
|
||||
const struct iovec *iov, loff_t offset,
|
||||
unsigned long nr_segs) { return 0; }
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/uio.h>
|
||||
],[
|
||||
int type __attribute__ ((unused)) =
|
||||
ITER_IOVEC | ITER_KVEC | ITER_BVEC | ITER_PIPE;
|
||||
int type __attribute__ ((unused)) = ITER_KVEC;
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([iov_iter_advance], [
|
||||
@@ -93,6 +92,14 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [
|
||||
struct iov_iter iter = { 0 };
|
||||
__attribute__((unused)) enum iter_type i = iov_iter_type(&iter);
|
||||
])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([iter_iov], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/uio.h>
|
||||
],[
|
||||
struct iov_iter iter = { 0 };
|
||||
__attribute__((unused)) const struct iovec *iov = iter_iov(&iter);
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
|
||||
@@ -201,4 +208,19 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
|
||||
AC_DEFINE(HAVE_VFS_IOV_ITER, 1,
|
||||
[All required iov_iter interfaces are available])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Kernel 6.5 introduces the iter_iov() function that returns the
|
||||
dnl # __iov member of an iov_iter*. The iov member was renamed to this
|
||||
dnl # __iov member, and is intended to be accessed via the helper
|
||||
dnl # function now.
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether iter_iov() is available])
|
||||
ZFS_LINUX_TEST_RESULT([iter_iov], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_ITER_IOV, 1,
|
||||
[iter_iov() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_ITERATE], [
|
||||
ZFS_LINUX_TEST_SRC([file_operations_iterate_shared], [
|
||||
#include <linux/fs.h>
|
||||
int iterate(struct file *filp, struct dir_context * context)
|
||||
static int iterate(struct file *filp, struct dir_context * context)
|
||||
{ return 0; }
|
||||
|
||||
static const struct file_operations fops
|
||||
@@ -12,7 +12,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_ITERATE], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([file_operations_iterate], [
|
||||
#include <linux/fs.h>
|
||||
int iterate(struct file *filp,
|
||||
static int iterate(struct file *filp,
|
||||
struct dir_context *context) { return 0; }
|
||||
|
||||
static const struct file_operations fops
|
||||
@@ -27,7 +27,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_ITERATE], [
|
||||
|
||||
ZFS_LINUX_TEST_SRC([file_operations_readdir], [
|
||||
#include <linux/fs.h>
|
||||
int readdir(struct file *filp, void *entry,
|
||||
static int readdir(struct file *filp, void *entry,
|
||||
filldir_t func) { return 0; }
|
||||
|
||||
static const struct file_operations fops
|
||||
|
||||
@@ -5,9 +5,9 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_RW_ITERATE], [
|
||||
ZFS_LINUX_TEST_SRC([file_operations_rw], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
ssize_t test_read(struct kiocb *kiocb, struct iov_iter *to)
|
||||
static ssize_t test_read(struct kiocb *kiocb, struct iov_iter *to)
|
||||
{ return 0; }
|
||||
ssize_t test_write(struct kiocb *kiocb, struct iov_iter *from)
|
||||
static ssize_t test_write(struct kiocb *kiocb, struct iov_iter *from)
|
||||
{ return 0; }
|
||||
|
||||
static const struct file_operations
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_WRITEPAGE_T], [
|
||||
dnl #
|
||||
dnl # 6.3 API change
|
||||
dnl # The writepage_t function type now has its first argument as
|
||||
dnl # struct folio* instead of struct page*
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([writepage_t_folio], [
|
||||
#include <linux/writeback.h>
|
||||
static int putpage(struct folio *folio,
|
||||
struct writeback_control *wbc, void *data)
|
||||
{ return 0; }
|
||||
writepage_t func = putpage;
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_WRITEPAGE_T], [
|
||||
AC_MSG_CHECKING([whether int (*writepage_t)() takes struct folio*])
|
||||
ZFS_LINUX_TEST_RESULT([writepage_t_folio], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_WRITEPAGE_T_FOLIO, 1,
|
||||
[int (*writepage_t)() takes struct folio*])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
@@ -68,7 +68,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
int get(const struct xattr_handler *handler,
|
||||
static int get(const struct xattr_handler *handler,
|
||||
struct dentry *dentry, struct inode *inode,
|
||||
const char *name, void *buffer, size_t size) { return 0; }
|
||||
static const struct xattr_handler
|
||||
@@ -80,7 +80,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_get_xattr_handler], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
int get(const struct xattr_handler *handler,
|
||||
static int get(const struct xattr_handler *handler,
|
||||
struct dentry *dentry, const char *name,
|
||||
void *buffer, size_t size) { return 0; }
|
||||
static const struct xattr_handler
|
||||
@@ -92,7 +92,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
int get(struct dentry *dentry, const char *name,
|
||||
static int get(struct dentry *dentry, const char *name,
|
||||
void *buffer, size_t size, int handler_flags)
|
||||
{ return 0; }
|
||||
static const struct xattr_handler
|
||||
@@ -104,7 +104,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_GET], [
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_get_dentry_inode_flags], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
int get(const struct xattr_handler *handler,
|
||||
static int get(const struct xattr_handler *handler,
|
||||
struct dentry *dentry, struct inode *inode,
|
||||
const char *name, void *buffer,
|
||||
size_t size, int flags) { return 0; }
|
||||
@@ -179,10 +179,25 @@ 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_mnt_idmap], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
static int set(const struct xattr_handler *handler,
|
||||
struct mnt_idmap *idmap,
|
||||
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_userns], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
int set(const struct xattr_handler *handler,
|
||||
static int set(const struct xattr_handler *handler,
|
||||
struct user_namespace *mnt_userns,
|
||||
struct dentry *dentry, struct inode *inode,
|
||||
const char *name, const void *buffer,
|
||||
@@ -197,7 +212,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
int set(const struct xattr_handler *handler,
|
||||
static int set(const struct xattr_handler *handler,
|
||||
struct dentry *dentry, struct inode *inode,
|
||||
const char *name, const void *buffer,
|
||||
size_t size, int flags)
|
||||
@@ -211,7 +226,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_set_xattr_handler], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
int set(const struct xattr_handler *handler,
|
||||
static int set(const struct xattr_handler *handler,
|
||||
struct dentry *dentry, const char *name,
|
||||
const void *buffer, size_t size, int flags)
|
||||
{ return 0; }
|
||||
@@ -224,7 +239,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
int set(struct dentry *dentry, const char *name,
|
||||
static int set(struct dentry *dentry, const char *name,
|
||||
const void *buffer, size_t size, int flags,
|
||||
int handler_flags) { return 0; }
|
||||
static const struct xattr_handler
|
||||
@@ -240,53 +255,63 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
|
||||
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, inode, and user_namespace])
|
||||
ZFS_LINUX_TEST_RESULT([xattr_handler_set_userns], [
|
||||
dnl # 6.3 API change,
|
||||
dnl # The xattr_handler->set() callback 2nd arg is now struct mnt_idmap *
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and mnt_idmap])
|
||||
ZFS_LINUX_TEST_RESULT([xattr_handler_set_mnt_idmap], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_XATTR_SET_USERNS, 1,
|
||||
[xattr_handler->set() takes user_namespace])
|
||||
],[
|
||||
dnl #
|
||||
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 dentry and inode])
|
||||
ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [
|
||||
AC_DEFINE(HAVE_XATTR_SET_IDMAP, 1,
|
||||
[xattr_handler->set() takes mnt_idmap])
|
||||
], [
|
||||
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()])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
@@ -300,7 +325,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_list_simple], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
bool list(struct dentry *dentry) { return 0; }
|
||||
static bool list(struct dentry *dentry) { return 0; }
|
||||
static const struct xattr_handler
|
||||
xops __attribute__ ((unused)) = {
|
||||
.list = list,
|
||||
@@ -310,7 +335,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_list_xattr_handler], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
size_t list(const struct xattr_handler *handler,
|
||||
static size_t list(const struct xattr_handler *handler,
|
||||
struct dentry *dentry, char *list, size_t list_size,
|
||||
const char *name, size_t name_len) { return 0; }
|
||||
static const struct xattr_handler
|
||||
@@ -322,7 +347,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_LIST], [
|
||||
ZFS_LINUX_TEST_SRC([xattr_handler_list_dentry], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
size_t list(struct dentry *dentry,
|
||||
static size_t list(struct dentry *dentry,
|
||||
char *list, size_t list_size,
|
||||
const char *name, size_t name_len,
|
||||
int handler_flags) { return 0; }
|
||||
|
||||
+32
-2
@@ -69,6 +69,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE
|
||||
ZFS_AC_KERNEL_SRC_XATTR
|
||||
ZFS_AC_KERNEL_SRC_ACL
|
||||
ZFS_AC_KERNEL_SRC_INODE_SETATTR
|
||||
ZFS_AC_KERNEL_SRC_INODE_GETATTR
|
||||
ZFS_AC_KERNEL_SRC_INODE_SET_FLAGS
|
||||
ZFS_AC_KERNEL_SRC_INODE_SET_IVERSION
|
||||
@@ -130,7 +131,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_KSTRTOUL
|
||||
ZFS_AC_KERNEL_SRC_PERCPU
|
||||
ZFS_AC_KERNEL_SRC_CPU_HOTPLUG
|
||||
ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS
|
||||
ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR
|
||||
ZFS_AC_KERNEL_SRC_MKNOD
|
||||
ZFS_AC_KERNEL_SRC_SYMLINK
|
||||
ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS
|
||||
@@ -139,11 +140,25 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_SYSFS
|
||||
ZFS_AC_KERNEL_SRC_SET_SPECIAL_STATE
|
||||
ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG
|
||||
ZFS_AC_KERNEL_SRC_STRLCPY
|
||||
ZFS_AC_KERNEL_SRC_STRSCPY
|
||||
ZFS_AC_KERNEL_SRC_PAGEMAP_FOLIO_WAIT_BIT
|
||||
ZFS_AC_KERNEL_SRC_ADD_DISK
|
||||
ZFS_AC_KERNEL_SRC_KTHREAD
|
||||
ZFS_AC_KERNEL_SRC_ZERO_PAGE
|
||||
ZFS_AC_KERNEL_SRC___COPY_FROM_USER_INATOMIC
|
||||
ZFS_AC_KERNEL_SRC_FILEMAP
|
||||
ZFS_AC_KERNEL_SRC_WRITEPAGE_T
|
||||
ZFS_AC_KERNEL_SRC_RECLAIMED
|
||||
ZFS_AC_KERNEL_SRC_REGISTER_SYSCTL_TABLE
|
||||
ZFS_AC_KERNEL_SRC_COPY_SPLICE_READ
|
||||
ZFS_AC_KERNEL_SRC_SYNC_BDEV
|
||||
case "$host_cpu" in
|
||||
powerpc*)
|
||||
ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE
|
||||
ZFS_AC_KERNEL_SRC_FLUSH_DCACHE_PAGE
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_MSG_CHECKING([for available kernel interfaces])
|
||||
ZFS_LINUX_TEST_COMPILE_ALL([kabi])
|
||||
@@ -186,6 +201,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE
|
||||
ZFS_AC_KERNEL_XATTR
|
||||
ZFS_AC_KERNEL_ACL
|
||||
ZFS_AC_KERNEL_INODE_SETATTR
|
||||
ZFS_AC_KERNEL_INODE_GETATTR
|
||||
ZFS_AC_KERNEL_INODE_SET_FLAGS
|
||||
ZFS_AC_KERNEL_INODE_SET_IVERSION
|
||||
@@ -247,7 +263,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_KSTRTOUL
|
||||
ZFS_AC_KERNEL_PERCPU
|
||||
ZFS_AC_KERNEL_CPU_HOTPLUG
|
||||
ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS
|
||||
ZFS_AC_KERNEL_GENERIC_FILLATTR
|
||||
ZFS_AC_KERNEL_MKNOD
|
||||
ZFS_AC_KERNEL_SYMLINK
|
||||
ZFS_AC_KERNEL_BIO_MAX_SEGS
|
||||
@@ -256,11 +272,25 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_SYSFS
|
||||
ZFS_AC_KERNEL_SET_SPECIAL_STATE
|
||||
ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG
|
||||
ZFS_AC_KERNEL_STRLCPY
|
||||
ZFS_AC_KERNEL_STRSCPY
|
||||
ZFS_AC_KERNEL_PAGEMAP_FOLIO_WAIT_BIT
|
||||
ZFS_AC_KERNEL_ADD_DISK
|
||||
ZFS_AC_KERNEL_KTHREAD
|
||||
ZFS_AC_KERNEL_ZERO_PAGE
|
||||
ZFS_AC_KERNEL___COPY_FROM_USER_INATOMIC
|
||||
ZFS_AC_KERNEL_FILEMAP
|
||||
ZFS_AC_KERNEL_WRITEPAGE_T
|
||||
ZFS_AC_KERNEL_RECLAIMED
|
||||
ZFS_AC_KERNEL_REGISTER_SYSCTL_TABLE
|
||||
ZFS_AC_KERNEL_COPY_SPLICE_READ
|
||||
ZFS_AC_KERNEL_SYNC_BDEV
|
||||
case "$host_cpu" in
|
||||
powerpc*)
|
||||
ZFS_AC_KERNEL_CPU_HAS_FEATURE
|
||||
ZFS_AC_KERNEL_FLUSH_DCACHE_PAGE
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
dnl #
|
||||
|
||||
+13
-27
@@ -81,7 +81,7 @@ AC_DEFUN([ZFS_AC_DEBUG], [
|
||||
AC_DEFUN([ZFS_AC_DEBUGINFO_ENABLE], [
|
||||
DEBUG_CFLAGS="$DEBUG_CFLAGS -g -fno-inline $NO_IPA_SRA"
|
||||
|
||||
KERNEL_DEBUG_CFLAGS="$KERNEL_DEBUG_CFLAGS -fno-inline $NO_IPA_SRA"
|
||||
KERNEL_DEBUG_CFLAGS="$KERNEL_DEBUG_CFLAGS -fno-inline $KERNEL_NO_IPA_SRA"
|
||||
KERNEL_MAKE="$KERNEL_MAKE CONFIG_DEBUG_INFO=y"
|
||||
|
||||
DEBUGINFO_ZFS="_with_debuginfo"
|
||||
@@ -211,12 +211,15 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
|
||||
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_CLOBBERED
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_INFINITE_RECURSION
|
||||
ZFS_AC_CONFIG_ALWAYS_KERNEL_CC_INFINITE_RECURSION
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_IMPLICIT_FALLTHROUGH
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_ZERO_LENGTH
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_FORMAT_OVERFLOW
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_OMIT_FRAME_POINTER
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_IPA_SRA
|
||||
ZFS_AC_CONFIG_ALWAYS_KERNEL_CC_NO_IPA_SRA
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_ASAN
|
||||
ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD
|
||||
ZFS_AC_CONFIG_ALWAYS_SYSTEM
|
||||
@@ -518,6 +521,8 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
|
||||
VENDOR=alpine ;
|
||||
elif test -f /bin/freebsd-version ; then
|
||||
VENDOR=freebsd ;
|
||||
elif test -f /etc/openEuler-release ; then
|
||||
VENDOR=openeuler ;
|
||||
else
|
||||
VENDOR= ;
|
||||
fi],
|
||||
@@ -542,6 +547,7 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
|
||||
ubuntu) DEFAULT_PACKAGE=deb ;;
|
||||
debian) DEFAULT_PACKAGE=deb ;;
|
||||
freebsd) DEFAULT_PACKAGE=pkg ;;
|
||||
openeuler) DEFAULT_PACKAGE=rpm ;;
|
||||
*) DEFAULT_PACKAGE=rpm ;;
|
||||
esac
|
||||
AC_MSG_RESULT([$DEFAULT_PACKAGE])
|
||||
@@ -555,35 +561,14 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
|
||||
AC_MSG_RESULT([$initdir])
|
||||
AC_SUBST(initdir)
|
||||
|
||||
AC_MSG_CHECKING([default init script type and shell])
|
||||
AC_MSG_CHECKING([default shell])
|
||||
case "$VENDOR" in
|
||||
toss) DEFAULT_INIT_SCRIPT=redhat ;;
|
||||
redhat) DEFAULT_INIT_SCRIPT=redhat ;;
|
||||
fedora) DEFAULT_INIT_SCRIPT=fedora ;;
|
||||
gentoo) DEFAULT_INIT_SCRIPT=openrc ;;
|
||||
alpine) DEFAULT_INIT_SCRIPT=openrc ;;
|
||||
arch) DEFAULT_INIT_SCRIPT=lsb ;;
|
||||
sles) DEFAULT_INIT_SCRIPT=lsb ;;
|
||||
slackware) DEFAULT_INIT_SCRIPT=lsb ;;
|
||||
lunar) DEFAULT_INIT_SCRIPT=lunar ;;
|
||||
ubuntu) DEFAULT_INIT_SCRIPT=lsb ;;
|
||||
debian) DEFAULT_INIT_SCRIPT=lsb ;;
|
||||
freebsd) DEFAULT_INIT_SCRIPT=freebsd;;
|
||||
*) DEFAULT_INIT_SCRIPT=lsb ;;
|
||||
gentoo) DEFAULT_INIT_SHELL="/sbin/openrc-run";;
|
||||
alpine) DEFAULT_INIT_SHELL="/sbin/openrc-run";;
|
||||
*) DEFAULT_INIT_SHELL="/bin/sh" ;;
|
||||
esac
|
||||
|
||||
# On gentoo, it's possible that OpenRC isn't installed. Check if
|
||||
# /sbin/openrc-run exists, and if not, fall back to generic defaults.
|
||||
|
||||
DEFAULT_INIT_SHELL="/bin/sh"
|
||||
AS_IF([test "$DEFAULT_INIT_SCRIPT" = "openrc"], [
|
||||
AS_IF([test -x "/sbin/openrc-run"],
|
||||
[DEFAULT_INIT_SHELL="/sbin/openrc-run"],
|
||||
[DEFAULT_INIT_SCRIPT=lsb])
|
||||
])
|
||||
|
||||
AC_MSG_RESULT([$DEFAULT_INIT_SCRIPT:$DEFAULT_INIT_SHELL])
|
||||
AC_SUBST(DEFAULT_INIT_SCRIPT)
|
||||
AC_MSG_RESULT([$DEFAULT_INIT_SHELL])
|
||||
AC_SUBST(DEFAULT_INIT_SHELL)
|
||||
|
||||
AC_MSG_CHECKING([default nfs server init script])
|
||||
@@ -602,6 +587,7 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
|
||||
redhat) initconfdir=/etc/sysconfig ;;
|
||||
fedora) initconfdir=/etc/sysconfig ;;
|
||||
sles) initconfdir=/etc/sysconfig ;;
|
||||
openeuler) initconfdir=/etc/sysconfig ;;
|
||||
ubuntu) initconfdir=/etc/default ;;
|
||||
debian) initconfdir=/etc/default ;;
|
||||
freebsd) initconfdir=$sysconfdir/rc.conf.d;;
|
||||
|
||||
@@ -222,6 +222,7 @@ AC_CONFIG_FILES([
|
||||
tests/zfs-tests/cmd/mmap_exec/Makefile
|
||||
tests/zfs-tests/cmd/mmap_libaio/Makefile
|
||||
tests/zfs-tests/cmd/mmap_seek/Makefile
|
||||
tests/zfs-tests/cmd/mmap_sync/Makefile
|
||||
tests/zfs-tests/cmd/mmapwrite/Makefile
|
||||
tests/zfs-tests/cmd/nvlist_to_lua/Makefile
|
||||
tests/zfs-tests/cmd/randfree_file/Makefile
|
||||
|
||||
@@ -69,7 +69,7 @@ __zfs_match_snapshot()
|
||||
else
|
||||
if [ "$cur" != "" ] && __zfs_list_datasets "$cur" &> /dev/null
|
||||
then
|
||||
$__ZFS_CMD list -H -o name -s name -t filesystem -r "$cur" | tail -n +2
|
||||
$__ZFS_CMD list -H -o name -s name -t filesystem,volume -r "$cur" | tail -n +2
|
||||
# We output the base dataset name even though we might be
|
||||
# completing a command that can only take a snapshot, because it
|
||||
# prevents bash from considering the completion finished when it
|
||||
|
||||
@@ -15,6 +15,7 @@ pkgdracut_SCRIPTS = \
|
||||
|
||||
pkgdracut_DATA = \
|
||||
zfs-env-bootfs.service \
|
||||
zfs-nonroot-necessities.service \
|
||||
zfs-snapshot-bootfs.service \
|
||||
zfs-rollback-bootfs.service
|
||||
|
||||
|
||||
@@ -84,6 +84,9 @@ install() {
|
||||
inst_simple "${moddir}/zfs-env-bootfs.service" "${systemdsystemunitdir}/zfs-env-bootfs.service"
|
||||
systemctl -q --root "${initdir}" add-wants zfs-import.target zfs-env-bootfs.service
|
||||
|
||||
inst_simple "${moddir}/zfs-nonroot-necessities.service" "${systemdsystemunitdir}/zfs-nonroot-necessities.service"
|
||||
systemctl -q --root "${initdir}" add-requires initrd-root-fs.target zfs-nonroot-necessities.service
|
||||
|
||||
for _service in \
|
||||
"zfs-import-scan.service" \
|
||||
"zfs-import-cache.service"; do
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
[Unit]
|
||||
Description=Set BOOTFS environment for dracut
|
||||
Documentation=man:zpool(8)
|
||||
Description=Set BOOTFS and BOOTFSFLAGS environment variables for dracut
|
||||
DefaultDependencies=no
|
||||
After=zfs-import-cache.service
|
||||
After=zfs-import-scan.service
|
||||
@@ -8,7 +7,17 @@ Before=zfs-import.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c "exec systemctl set-environment BOOTFS=$(@sbindir@/zpool list -H -o bootfs | grep -m1 -vFx -)"
|
||||
ExecStart=/bin/sh -c ' \
|
||||
. /lib/dracut-zfs-lib.sh; \
|
||||
decode_root_args || exit 0; \
|
||||
[ "$root" = "zfs:AUTO" ] && root="$(@sbindir@/zpool list -H -o bootfs | grep -m1 -vFx -)"; \
|
||||
rootflags="$(getarg rootflags=)"; \
|
||||
case ",$rootflags," in \
|
||||
*,zfsutil,*) ;; \
|
||||
,,) rootflags=zfsutil ;; \
|
||||
*) rootflags="zfsutil,$rootflags" ;; \
|
||||
esac; \
|
||||
exec systemctl set-environment BOOTFS="$root" BOOTFSFLAGS="$rootflags"'
|
||||
|
||||
[Install]
|
||||
WantedBy=zfs-import.target
|
||||
|
||||
@@ -14,81 +14,24 @@ GENERATOR_DIR="$1"
|
||||
. /lib/dracut-zfs-lib.sh
|
||||
decode_root_args || exit 0
|
||||
|
||||
[ -z "${rootflags}" ] && rootflags=$(getarg rootflags=)
|
||||
case ",${rootflags}," in
|
||||
*,zfsutil,*) ;;
|
||||
,,) rootflags=zfsutil ;;
|
||||
*) rootflags="zfsutil,${rootflags}" ;;
|
||||
esac
|
||||
|
||||
[ -n "$debug" ] && echo "zfs-generator: writing extension for sysroot.mount to $GENERATOR_DIR/sysroot.mount.d/zfs-enhancement.conf" >> /dev/kmsg
|
||||
|
||||
|
||||
mkdir -p "$GENERATOR_DIR"/sysroot.mount.d "$GENERATOR_DIR"/initrd-root-fs.target.requires "$GENERATOR_DIR"/dracut-pre-mount.service.d
|
||||
mkdir -p "$GENERATOR_DIR"/sysroot.mount.d "$GENERATOR_DIR"/dracut-pre-mount.service.d
|
||||
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "Before=initrd-root-fs.target"
|
||||
echo "After=zfs-import.target"
|
||||
echo
|
||||
echo "[Mount]"
|
||||
if [ "${root}" = "zfs:AUTO" ]; then
|
||||
echo "PassEnvironment=BOOTFS"
|
||||
echo 'What=${BOOTFS}'
|
||||
else
|
||||
echo "What=${root}"
|
||||
fi
|
||||
echo "PassEnvironment=BOOTFS BOOTFSFLAGS"
|
||||
echo 'What=${BOOTFS}'
|
||||
echo "Type=zfs"
|
||||
echo "Options=${rootflags}"
|
||||
echo 'Options=${BOOTFSFLAGS}'
|
||||
} > "$GENERATOR_DIR"/sysroot.mount.d/zfs-enhancement.conf
|
||||
ln -fs ../sysroot.mount "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount
|
||||
|
||||
|
||||
if [ "${root}" = "zfs:AUTO" ]; then
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "Before=initrd-root-fs.target"
|
||||
echo "After=sysroot.mount"
|
||||
echo "DefaultDependencies=no"
|
||||
echo
|
||||
echo "[Service]"
|
||||
echo "Type=oneshot"
|
||||
echo "PassEnvironment=BOOTFS"
|
||||
echo "ExecStart=/bin/sh -c '" ' \
|
||||
. /lib/dracut-zfs-lib.sh; \
|
||||
_zfs_nonroot_necessities_cb() { \
|
||||
zfs mount | grep -m1 -q "^$1 " && return 0; \
|
||||
echo "Mounting $1 on /sysroot$2"; \
|
||||
mount -o zfsutil -t zfs "$1" "/sysroot$2"; \
|
||||
}; \
|
||||
for_relevant_root_children "${BOOTFS}" _zfs_nonroot_necessities_cb;' \
|
||||
"'"
|
||||
} > "$GENERATOR_DIR"/zfs-nonroot-necessities.service
|
||||
ln -fs ../zfs-nonroot-necessities.service "$GENERATOR_DIR"/initrd-root-fs.target.requires/zfs-nonroot-necessities.service
|
||||
else
|
||||
# We can solve this statically at generation time, so do!
|
||||
_zfs_generator_cb() {
|
||||
dset="${1}"
|
||||
mpnt="${2}"
|
||||
unit="$(systemd-escape --suffix=mount -p "/sysroot${mpnt}")"
|
||||
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "Before=initrd-root-fs.target"
|
||||
echo "After=sysroot.mount"
|
||||
echo
|
||||
echo "[Mount]"
|
||||
echo "Where=/sysroot${mpnt}"
|
||||
echo "What=${dset}"
|
||||
echo "Type=zfs"
|
||||
echo "Options=zfsutil"
|
||||
} > "$GENERATOR_DIR/${unit}"
|
||||
ln -fs ../"${unit}" "$GENERATOR_DIR"/initrd-root-fs.target.requires/"${unit}"
|
||||
}
|
||||
|
||||
for_relevant_root_children "${root}" _zfs_generator_cb
|
||||
fi
|
||||
|
||||
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "After=zfs-import.target"
|
||||
|
||||
@@ -38,7 +38,7 @@ mount_dataset() {
|
||||
|
||||
# for_relevant_root_children DATASET EXEC
|
||||
# Runs "EXEC dataset mountpoint" for all children of DATASET that are needed for system bringup
|
||||
# Used by zfs-generator.sh and friends, too!
|
||||
# Used by zfs-nonroot-necessities.service and friends, too!
|
||||
for_relevant_root_children() {
|
||||
dataset="${1}"
|
||||
exec="${2}"
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
[Unit]
|
||||
Before=initrd-root-fs.target
|
||||
After=sysroot.mount
|
||||
DefaultDependencies=no
|
||||
ConditionEnvironment=BOOTFS
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
PassEnvironment=BOOTFS
|
||||
ExecStart=/bin/sh -c ' \
|
||||
. /lib/dracut-zfs-lib.sh; \
|
||||
_zfs_nonroot_necessities_cb() { \
|
||||
@sbindir@/zfs mount | grep -m1 -q "^$1 " && return 0; \
|
||||
echo "Mounting $1 on /sysroot$2"; \
|
||||
mount -o zfsutil -t zfs "$1" "/sysroot$2"; \
|
||||
}; \
|
||||
for_relevant_root_children "${BOOTFS}" _zfs_nonroot_necessities_cb'
|
||||
|
||||
[Install]
|
||||
RequiredBy=initrd-root-fs.target
|
||||
@@ -5,8 +5,9 @@ After=zfs-import.target dracut-pre-mount.service zfs-snapshot-bootfs.service
|
||||
Before=dracut-mount.service
|
||||
DefaultDependencies=no
|
||||
ConditionKernelCommandLine=bootfs.rollback
|
||||
ConditionEnvironment=BOOTFS
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c '. /lib/dracut-zfs-lib.sh; decode_root_args || exit; [ "$root" = "zfs:AUTO" ] && root="$BOOTFS"; SNAPNAME="$(getarg bootfs.rollback)"; exec @sbindir@/zfs rollback -Rf "$root@${SNAPNAME:-%v}"'
|
||||
ExecStart=/bin/sh -c '. /lib/dracut-lib.sh; SNAPNAME="$(getarg bootfs.rollback)"; exec @sbindir@/zfs rollback -Rf "$BOOTFS@${SNAPNAME:-%v}"'
|
||||
RemainAfterExit=yes
|
||||
|
||||
@@ -5,8 +5,9 @@ After=zfs-import.target dracut-pre-mount.service
|
||||
Before=dracut-mount.service
|
||||
DefaultDependencies=no
|
||||
ConditionKernelCommandLine=bootfs.snapshot
|
||||
ConditionEnvironment=BOOTFS
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=-/bin/sh -c '. /lib/dracut-zfs-lib.sh; decode_root_args || exit; [ "$root" = "zfs:AUTO" ] && root="$BOOTFS"; SNAPNAME="$(getarg bootfs.snapshot)"; exec @sbindir@/zfs snapshot "$root@${SNAPNAME:-%v}"'
|
||||
ExecStart=-/bin/sh -c '. /lib/dracut-lib.sh; SNAPNAME="$(getarg bootfs.snapshot)"; exec @sbindir@/zfs snapshot "$BOOTFS@${SNAPNAME:-%v}"'
|
||||
RemainAfterExit=yes
|
||||
|
||||
@@ -7,5 +7,6 @@ dist_scripts_SCRIPTS = \
|
||||
|
||||
SUBDIRS = local-top
|
||||
|
||||
SHELLCHECK_IGNORE = ,SC2295
|
||||
SHELLCHECKDIRS = $(SUBDIRS)
|
||||
SHELLCHECK_SHELL = sh
|
||||
|
||||
@@ -192,7 +192,7 @@ import_pool()
|
||||
|
||||
# Verify that the pool isn't already imported
|
||||
# Make as sure as we can to not require '-f' to import.
|
||||
"${ZPOOL}" get name,guid -o value -H 2>/dev/null | grep -Fxq "$pool" && return 0
|
||||
"${ZPOOL}" get -H -o value name,guid 2>/dev/null | grep -Fxq "$pool" && return 0
|
||||
|
||||
# For backwards compatibility, make sure that ZPOOL_IMPORT_PATH is set
|
||||
# to something we can use later with the real import(s). We want to
|
||||
@@ -326,7 +326,7 @@ mount_fs()
|
||||
|
||||
# Need the _original_ datasets mountpoint!
|
||||
mountpoint=$(get_fs_value "$fs" mountpoint)
|
||||
ZFS_CMD="mount.zfs -o zfsutil"
|
||||
ZFS_CMD="mount -o zfsutil -t zfs"
|
||||
if [ "$mountpoint" = "legacy" ] || [ "$mountpoint" = "none" ]; then
|
||||
# Can't use the mountpoint property. Might be one of our
|
||||
# clones. Check the 'org.zol:mountpoint' property set in
|
||||
@@ -341,7 +341,10 @@ mount_fs()
|
||||
# isn't the root fs.
|
||||
return 0
|
||||
fi
|
||||
ZFS_CMD="mount.zfs"
|
||||
# Don't use mount.zfs -o zfsutils for legacy mountpoint
|
||||
if [ "$mountpoint" = "legacy" ]; then
|
||||
ZFS_CMD="mount -t zfs"
|
||||
fi
|
||||
# Last hail-mary: Hope 'rootmnt' is set!
|
||||
mountpoint=""
|
||||
else
|
||||
@@ -880,12 +883,12 @@ mountroot()
|
||||
fi
|
||||
|
||||
# In case the pool was specified as guid, resolve guid to name
|
||||
pool="$("${ZPOOL}" get name,guid -o name,value -H | \
|
||||
pool="$("${ZPOOL}" get -H -o name,value name,guid | \
|
||||
awk -v pool="${ZFS_RPOOL}" '$2 == pool { print $1 }')"
|
||||
if [ -n "$pool" ]; then
|
||||
# If $ZFS_BOOTFS contains guid, replace the guid portion with $pool
|
||||
ZFS_BOOTFS=$(echo "$ZFS_BOOTFS" | \
|
||||
sed -e "s/$("${ZPOOL}" get guid -o value "$pool" -H)/$pool/g")
|
||||
sed -e "s/$("${ZPOOL}" get -H -o value guid "$pool")/$pool/g")
|
||||
ZFS_RPOOL="${pool}"
|
||||
fi
|
||||
|
||||
@@ -911,7 +914,7 @@ mountroot()
|
||||
echo " not specified on the kernel command line."
|
||||
echo ""
|
||||
echo "Manually mount the root filesystem on $rootmnt and then exit."
|
||||
echo "Hint: Try: mount.zfs -o zfsutil ${ZFS_RPOOL-rpool}/ROOT/system $rootmnt"
|
||||
echo "Hint: Try: mount -o zfsutil -t zfs ${ZFS_RPOOL-rpool}/ROOT/system $rootmnt"
|
||||
shell
|
||||
fi
|
||||
|
||||
|
||||
@@ -548,16 +548,11 @@ zfs_key_config_modify_session_counter(pam_handle_t *pamh,
|
||||
errno);
|
||||
return (-1);
|
||||
}
|
||||
size_t runtime_path_len = strlen(runtime_path);
|
||||
size_t counter_path_len = runtime_path_len + 1 + 10;
|
||||
char *counter_path = malloc(counter_path_len + 1);
|
||||
if (!counter_path) {
|
||||
|
||||
char *counter_path;
|
||||
if (asprintf(&counter_path, "%s/%u", runtime_path, config->uid) == -1)
|
||||
return (-1);
|
||||
}
|
||||
counter_path[0] = 0;
|
||||
strcat(counter_path, runtime_path);
|
||||
snprintf(counter_path + runtime_path_len, counter_path_len, "/%d",
|
||||
config->uid);
|
||||
|
||||
const int fd = open(counter_path,
|
||||
O_RDWR | O_CLOEXEC | O_CREAT | O_NOFOLLOW,
|
||||
S_IRUSR | S_IWUSR);
|
||||
|
||||
@@ -29,13 +29,12 @@ setup(
|
||||
"Development Status :: 4 - Beta",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Topic :: System :: Filesystems",
|
||||
"Topic :: Software Development :: Libraries",
|
||||
],
|
||||
@@ -53,7 +52,7 @@ setup(
|
||||
setup_requires=[
|
||||
"cffi",
|
||||
],
|
||||
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,<4',
|
||||
python_requires='>=3.6,<4',
|
||||
zip_safe=False,
|
||||
test_suite="libzfs_core.test",
|
||||
)
|
||||
|
||||
+2
-26
@@ -43,32 +43,8 @@ config ZFS
|
||||
If unsure, say N.
|
||||
EOF
|
||||
|
||||
add_after()
|
||||
{
|
||||
FILE="$1"
|
||||
MARKER="$2"
|
||||
NEW="$3"
|
||||
|
||||
while IFS='' read -r LINE
|
||||
do
|
||||
printf "%s\n" "$LINE"
|
||||
|
||||
if [ -n "$MARKER" ] && [ "$LINE" = "$MARKER" ]
|
||||
then
|
||||
printf "%s\n" "$NEW"
|
||||
MARKER=''
|
||||
if IFS='' read -r LINE
|
||||
then
|
||||
[ "$LINE" != "$NEW" ] && printf "%s\n" "$LINE"
|
||||
fi
|
||||
fi
|
||||
done < "$FILE" > "$FILE.new"
|
||||
|
||||
mv "$FILE.new" "$FILE"
|
||||
}
|
||||
|
||||
add_after "$KERNEL_DIR/fs/Kconfig" 'if BLOCK' 'source "fs/zfs/Kconfig"'
|
||||
add_after "$KERNEL_DIR/fs/Makefile" 'endif' 'obj-$(CONFIG_ZFS) += zfs/'
|
||||
sed -i '/source "fs\/ext2\/Kconfig\"/i\source "fs/zfs/Kconfig"' "$KERNEL_DIR/fs/Kconfig"
|
||||
echo 'obj-$(CONFIG_ZFS) += zfs/' >> "$KERNEL_DIR/fs/Makefile"
|
||||
|
||||
echo "$0: done. now you can build the kernel with ZFS support." >&2
|
||||
echo "$0: make sure you enable ZFS support (CONFIG_ZFS) before building." >&2
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user