mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-23 19:28:36 +00:00
zfs: merge openzfs/zfs@2e6b3c4d9
Notable upstream pull request merges: #15793401c3563d
libzfs: use zfs_strerror() in place of strerror() #15793692f0daba
libzfs: make userquota_propname_decode threadsafe #157980cbf13529
libnvpair.c: replace strstr() with strchr() for a single character #1581278e8c1f84
Remove list_size struct member from list implementation #15816aeb33776f
Update vdev devid and physpath if changed between imports #158188161b7327
Don't assert mg_initialized due to device addition race #15823c3fd7a521
Update man pages to time(1) from time(2) #15825884a48d99
zpool wait: print timestamp before the header Obtained from: OpenZFS OpenZFS commit:2e6b3c4d94
This commit is contained in:
commit
fd45b686f9
4
sys/contrib/openzfs/.github/codeql-cpp.yml
vendored
Normal file
4
sys/contrib/openzfs/.github/codeql-cpp.yml
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
name: "Custom CodeQL Analysis"
|
||||
|
||||
queries:
|
||||
- uses: ./.github/codeql/custom-queries/cpp/deprecatedFunctionUsage.ql
|
4
sys/contrib/openzfs/.github/codeql-python.yml
vendored
Normal file
4
sys/contrib/openzfs/.github/codeql-python.yml
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
name: "Custom CodeQL Analysis"
|
||||
|
||||
paths-ignore:
|
||||
- tests
|
59
sys/contrib/openzfs/.github/codeql/custom-queries/cpp/deprecatedFunctionUsage.ql
vendored
Normal file
59
sys/contrib/openzfs/.github/codeql/custom-queries/cpp/deprecatedFunctionUsage.ql
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* @name Deprecated function usage detection
|
||||
* @description Detects functions whose usage is banned from the OpenZFS
|
||||
* codebase due to QA concerns.
|
||||
* @kind problem
|
||||
* @severity error
|
||||
* @id cpp/deprecated-function-usage
|
||||
*/
|
||||
|
||||
import cpp
|
||||
|
||||
predicate isDeprecatedFunction(Function f) {
|
||||
f.getName() = "strtok" or
|
||||
f.getName() = "__xpg_basename" or
|
||||
f.getName() = "basename" or
|
||||
f.getName() = "dirname" or
|
||||
f.getName() = "bcopy" or
|
||||
f.getName() = "bcmp" or
|
||||
f.getName() = "bzero" or
|
||||
f.getName() = "asctime" or
|
||||
f.getName() = "asctime_r" or
|
||||
f.getName() = "gmtime" or
|
||||
f.getName() = "localtime" or
|
||||
f.getName() = "strncpy"
|
||||
|
||||
}
|
||||
|
||||
string getReplacementMessage(Function f) {
|
||||
if f.getName() = "strtok" then
|
||||
result = "Use strtok_r(3) instead!"
|
||||
else if f.getName() = "__xpg_basename" then
|
||||
result = "basename(3) is underspecified. Use zfs_basename() instead!"
|
||||
else if f.getName() = "basename" then
|
||||
result = "basename(3) is underspecified. Use zfs_basename() instead!"
|
||||
else if f.getName() = "dirname" then
|
||||
result = "dirname(3) is underspecified. Use zfs_dirnamelen() instead!"
|
||||
else if f.getName() = "bcopy" then
|
||||
result = "bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!"
|
||||
else if f.getName() = "bcmp" then
|
||||
result = "bcmp(3) is deprecated. Use memcmp(3) instead!"
|
||||
else if f.getName() = "bzero" then
|
||||
result = "bzero(3) is deprecated. Use memset(3) instead!"
|
||||
else if f.getName() = "asctime" then
|
||||
result = "Use strftime(3) instead!"
|
||||
else if f.getName() = "asctime_r" then
|
||||
result = "Use strftime(3) instead!"
|
||||
else if f.getName() = "gmtime" then
|
||||
result = "gmtime(3) isn't thread-safe. Use gmtime_r(3) instead!"
|
||||
else if f.getName() = "localtime" then
|
||||
result = "localtime(3) isn't thread-safe. Use localtime_r(3) instead!"
|
||||
else
|
||||
result = "strncpy(3) is deprecated. Use strlcpy(3) instead!"
|
||||
}
|
||||
|
||||
from FunctionCall fc, Function f
|
||||
where
|
||||
fc.getTarget() = f and
|
||||
isDeprecatedFunction(f)
|
||||
select fc, getReplacementMessage(f)
|
4
sys/contrib/openzfs/.github/codeql/custom-queries/cpp/qlpack.yml
vendored
Normal file
4
sys/contrib/openzfs/.github/codeql/custom-queries/cpp/qlpack.yml
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
name: openzfs-cpp-queries
|
||||
version: 0.0.0
|
||||
libraryPathDependencies: codeql-cpp
|
||||
suites: openzfs-cpp-suite
|
50
sys/contrib/openzfs/.github/workflows/README.md
vendored
50
sys/contrib/openzfs/.github/workflows/README.md
vendored
|
@ -4,44 +4,54 @@
|
|||
```mermaid
|
||||
flowchart TB
|
||||
subgraph CleanUp and Summary
|
||||
Part1-20.04-->CleanUp+nice+Summary
|
||||
Part2-20.04-->CleanUp+nice+Summary
|
||||
PartN-20.04-->CleanUp+nice+Summary
|
||||
Part1-22.04-->CleanUp+nice+Summary
|
||||
Part2-22.04-->CleanUp+nice+Summary
|
||||
PartN-22.04-->CleanUp+nice+Summary
|
||||
CleanUp+Summary
|
||||
end
|
||||
|
||||
subgraph Functional Testings
|
||||
sanity-checks-20.04
|
||||
zloop-checks-20.04
|
||||
functional-testing-20.04-->Part1-20.04
|
||||
functional-testing-20.04-->Part2-20.04
|
||||
functional-testing-20.04-->PartN-20.04
|
||||
functional-testing-20.04-->Part3-20.04
|
||||
functional-testing-20.04-->Part4-20.04
|
||||
functional-testing-22.04-->Part1-22.04
|
||||
functional-testing-22.04-->Part2-22.04
|
||||
functional-testing-22.04-->PartN-22.04
|
||||
end
|
||||
|
||||
subgraph Sanity and zloop Testings
|
||||
sanity-checks-20.04-->functional-testing-20.04
|
||||
sanity-checks-22.04-->functional-testing-22.04
|
||||
zloop-checks-20.04-->functional
|
||||
zloop-checks-22.04-->functional
|
||||
functional-testing-22.04-->Part3-22.04
|
||||
functional-testing-22.04-->Part4-22.04
|
||||
sanity-checks-22.04
|
||||
zloop-checks-22.04
|
||||
end
|
||||
|
||||
subgraph Code Checking + Building
|
||||
Build-Ubuntu-20.04
|
||||
codeql.yml
|
||||
checkstyle.yml
|
||||
Build-Ubuntu-20.04-->sanity-checks-20.04
|
||||
Build-Ubuntu-22.04-->sanity-checks-22.04
|
||||
Build-Ubuntu-20.04-->zloop-checks-20.04
|
||||
Build-Ubuntu-22.04-->zloop-checks-22.04
|
||||
Build-Ubuntu-22.04
|
||||
end
|
||||
|
||||
Build-Ubuntu-20.04-->sanity-checks-20.04
|
||||
Build-Ubuntu-20.04-->zloop-checks-20.04
|
||||
Build-Ubuntu-20.04-->functional-testing-20.04
|
||||
Build-Ubuntu-22.04-->sanity-checks-22.04
|
||||
Build-Ubuntu-22.04-->zloop-checks-22.04
|
||||
Build-Ubuntu-22.04-->functional-testing-22.04
|
||||
|
||||
sanity-checks-20.04-->CleanUp+Summary
|
||||
Part1-20.04-->CleanUp+Summary
|
||||
Part2-20.04-->CleanUp+Summary
|
||||
Part3-20.04-->CleanUp+Summary
|
||||
Part4-20.04-->CleanUp+Summary
|
||||
Part1-22.04-->CleanUp+Summary
|
||||
Part2-22.04-->CleanUp+Summary
|
||||
Part3-22.04-->CleanUp+Summary
|
||||
Part4-22.04-->CleanUp+Summary
|
||||
sanity-checks-22.04-->CleanUp+Summary
|
||||
```
|
||||
|
||||
|
||||
1) build zfs modules for Ubuntu 20.04 and 22.04 (~15m)
|
||||
2) 2x zloop test (~10m) + 2x sanity test (~25m)
|
||||
3) functional testings in parts 1..5 (each ~1h)
|
||||
3) 4x functional testings in parts 1..4 (each ~1h)
|
||||
4) cleanup and create summary
|
||||
- content of summary depends on the results of the steps
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ jobs:
|
|||
checkstyle:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install dependencies
|
||||
|
@ -52,7 +52,7 @@ jobs:
|
|||
if: failure() && steps.CheckABI.outcome == 'failure'
|
||||
run: |
|
||||
find -name *.abi | tar -cf abi_files.tar -T -
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure() && steps.CheckABI.outcome == 'failure'
|
||||
with:
|
||||
name: New ABI files (use only if you're sure about interface changes)
|
||||
|
|
|
@ -24,11 +24,12 @@ jobs:
|
|||
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
config-file: .github/codeql-${{ matrix.language }}.yml
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Autobuild
|
||||
|
|
|
@ -87,7 +87,7 @@ function summarize_f() {
|
|||
output "\n## $headline\n"
|
||||
rm -rf testfiles
|
||||
for i in $(seq 1 $FUNCTIONAL_PARTS); do
|
||||
tarfile="$2/part$i.tar"
|
||||
tarfile="$2-part$i/part$i.tar"
|
||||
check_tarfile "$tarfile"
|
||||
check_logfile "testfiles/log"
|
||||
done
|
||||
|
|
|
@ -55,29 +55,24 @@ function mod_install() {
|
|||
cat /proc/spl/kstat/zfs/chksum_bench
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Reclaim and report disk space"
|
||||
# remove 4GiB of images
|
||||
sudo systemd-run docker system prune --force --all --volumes
|
||||
echo "::group::Optimize storage for ZFS testings"
|
||||
# remove swap and umount fast storage
|
||||
# 89GiB -> rootfs + bootfs with ~80MB/s -> don't care
|
||||
# 64GiB -> /mnt with 420MB/s -> new testing ssd
|
||||
sudo swapoff -a
|
||||
|
||||
# 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 /
|
||||
# this one is fast and mounted @ /mnt
|
||||
# -> we reformat with ext4 + move it to /var/tmp
|
||||
DEV="/dev/disk/azure/resource-part1"
|
||||
sudo umount /mnt
|
||||
sudo mkfs.ext4 -O ^has_journal -F $DEV
|
||||
sudo mount -o noatime,barrier=0 $DEV /var/tmp
|
||||
sudo chmod 1777 /var/tmp
|
||||
|
||||
# disk usage afterwards
|
||||
df -h /
|
||||
sudo df -h /
|
||||
sudo df -h /var/tmp
|
||||
sudo fstrim -a
|
||||
echo "::endgroup::"
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ jobs:
|
|||
zloop:
|
||||
runs-on: ubuntu-${{ inputs.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: modules-${{ inputs.os }}
|
||||
- name: Install modules
|
||||
|
@ -34,7 +34,7 @@ jobs:
|
|||
if: failure()
|
||||
run: |
|
||||
sudo chmod +r -R /var/tmp/zloop/
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: Zpool-logs-${{ inputs.os }}
|
||||
|
@ -43,7 +43,7 @@ jobs:
|
|||
!/var/tmp/zloop/*/vdev/
|
||||
retention-days: 14
|
||||
if-no-files-found: ignore
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: Zpool-files-${{ inputs.os }}
|
||||
|
@ -55,10 +55,10 @@ jobs:
|
|||
sanity:
|
||||
runs-on: ubuntu-${{ inputs.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: modules-${{ inputs.os }}
|
||||
- name: Install modules
|
||||
|
@ -77,7 +77,7 @@ jobs:
|
|||
RESPATH="/var/tmp/test_results"
|
||||
mv -f $RESPATH/current $RESPATH/testfiles
|
||||
tar cf $RESPATH/sanity.tar -h -C $RESPATH testfiles
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: success() || failure()
|
||||
with:
|
||||
name: Logs-${{ inputs.os }}-sanity
|
||||
|
@ -91,10 +91,10 @@ jobs:
|
|||
matrix:
|
||||
tests: [ part1, part2, part3, part4 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: modules-${{ inputs.os }}
|
||||
- name: Install modules
|
||||
|
@ -116,9 +116,9 @@ jobs:
|
|||
RESPATH="/var/tmp/test_results"
|
||||
mv -f $RESPATH/current $RESPATH/testfiles
|
||||
tar cf $RESPATH/${{ matrix.tests }}.tar -h -C $RESPATH testfiles
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: success() || failure()
|
||||
with:
|
||||
name: Logs-${{ inputs.os }}-functional
|
||||
name: Logs-${{ inputs.os }}-functional-${{ matrix.tests }}
|
||||
path: /var/tmp/test_results/${{ matrix.tests }}.tar
|
||||
if-no-files-found: ignore
|
||||
|
|
|
@ -14,14 +14,14 @@ jobs:
|
|||
os: [20.04, 22.04]
|
||||
runs-on: ubuntu-${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Build modules
|
||||
run: .github/workflows/scripts/setup-dependencies.sh build
|
||||
- name: Prepare modules upload
|
||||
run: tar czf modules-${{ matrix.os }}.tgz *.deb .github tests/test-runner tests/ImageOS.txt
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: modules-${{ matrix.os }}
|
||||
path: modules-${{ matrix.os }}.tgz
|
||||
|
@ -44,7 +44,7 @@ jobs:
|
|||
runs-on: ubuntu-22.04
|
||||
needs: testings
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
- name: Generating summary
|
||||
run: |
|
||||
tar xzf modules-22.04/modules-22.04.tgz .github tests
|
||||
|
@ -58,7 +58,7 @@ jobs:
|
|||
run: .github/workflows/scripts/generate-summary.sh 3
|
||||
- name: Summary for errors #4
|
||||
run: .github/workflows/scripts/generate-summary.sh 4
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Summary Files
|
||||
path: Summary/
|
||||
|
|
|
@ -6,5 +6,5 @@ Release: 1
|
|||
Release-Tags: relext
|
||||
License: CDDL
|
||||
Author: OpenZFS
|
||||
Linux-Maximum: 6.6
|
||||
Linux-Maximum: 6.7
|
||||
Linux-Minimum: 3.10
|
||||
|
|
|
@ -11042,6 +11042,9 @@ print_wait_status_row(wait_data_t *wd, zpool_handle_t *zhp, int row)
|
|||
col_widths[i] = MAX(strlen(headers[i]), 6) + 2;
|
||||
}
|
||||
|
||||
if (timestamp_fmt != NODATE)
|
||||
print_timestamp(timestamp_fmt);
|
||||
|
||||
/* Print header if appropriate */
|
||||
int term_height = terminal_height();
|
||||
boolean_t reprint_header = (!wd->wd_headers_once && term_height > 0 &&
|
||||
|
@ -11116,9 +11119,6 @@ print_wait_status_row(wait_data_t *wd, zpool_handle_t *zhp, int row)
|
|||
if (vdev_any_spare_replacing(nvroot))
|
||||
bytes_rem[ZPOOL_WAIT_REPLACE] = bytes_rem[ZPOOL_WAIT_RESILVER];
|
||||
|
||||
if (timestamp_fmt != NODATE)
|
||||
print_timestamp(timestamp_fmt);
|
||||
|
||||
for (i = 0; i < ZPOOL_WAIT_NUM_ACTIVITIES; i++) {
|
||||
char buf[64];
|
||||
if (!wd->wd_enabled[i])
|
||||
|
|
|
@ -42,21 +42,6 @@ AM_CPPFLAGS += $(DEBUG_CPPFLAGS)
|
|||
AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
|
||||
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-@ac_system_l@-user\"
|
||||
|
||||
AM_CPPFLAGS_NOCHECK = -D"strtok(...)=strtok(__VA_ARGS__) __attribute__((deprecated(\"Use strtok_r(3) instead!\")))"
|
||||
AM_CPPFLAGS_NOCHECK += -D"__xpg_basename(...)=__xpg_basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
|
||||
AM_CPPFLAGS_NOCHECK += -D"basename(...)=basename(__VA_ARGS__) __attribute__((deprecated(\"basename(3) is underspecified. Use zfs_basename() instead!\")))"
|
||||
AM_CPPFLAGS_NOCHECK += -D"dirname(...)=dirname(__VA_ARGS__) __attribute__((deprecated(\"dirname(3) is underspecified. Use zfs_dirnamelen() instead!\")))"
|
||||
AM_CPPFLAGS_NOCHECK += -D"bcopy(...)=__attribute__((deprecated(\"bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!\"))) bcopy(__VA_ARGS__)"
|
||||
AM_CPPFLAGS_NOCHECK += -D"bcmp(...)=__attribute__((deprecated(\"bcmp(3) is deprecated. Use memcmp(3) instead!\"))) bcmp(__VA_ARGS__)"
|
||||
AM_CPPFLAGS_NOCHECK += -D"bzero(...)=__attribute__((deprecated(\"bzero(3) is deprecated. Use memset(3) instead!\"))) bzero(__VA_ARGS__)"
|
||||
AM_CPPFLAGS_NOCHECK += -D"asctime(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime(__VA_ARGS__)"
|
||||
AM_CPPFLAGS_NOCHECK += -D"asctime_r(...)=__attribute__((deprecated(\"Use strftime(3) instead!\"))) asctime_r(__VA_ARGS__)"
|
||||
AM_CPPFLAGS_NOCHECK += -D"gmtime(...)=__attribute__((deprecated(\"gmtime(3) isn't thread-safe. Use gmtime_r(3) instead!\"))) gmtime(__VA_ARGS__)"
|
||||
AM_CPPFLAGS_NOCHECK += -D"localtime(...)=__attribute__((deprecated(\"localtime(3) isn't thread-safe. Use localtime_r(3) instead!\"))) localtime(__VA_ARGS__)"
|
||||
AM_CPPFLAGS_NOCHECK += -D"strncpy(...)=__attribute__((deprecated(\"strncpy(3) is deprecated. Use strlcpy(3) instead!\"))) strncpy(__VA_ARGS__)"
|
||||
|
||||
AM_CPPFLAGS += $(AM_CPPFLAGS_NOCHECK)
|
||||
|
||||
if ASAN_ENABLED
|
||||
AM_CPPFLAGS += -DZFS_ASAN_ENABLED
|
||||
endif
|
||||
|
|
|
@ -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
|
||||
|
@ -243,7 +243,7 @@ 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>
|
||||
|
||||
int set_acl_fn(struct mnt_idmap *idmap,
|
||||
static int set_acl_fn(struct mnt_idmap *idmap,
|
||||
struct dentry *dent, struct posix_acl *acl,
|
||||
int type) { return 0; }
|
||||
|
||||
|
@ -255,7 +255,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
|
|||
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; }
|
||||
|
||||
|
@ -267,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; }
|
||||
|
||||
|
@ -279,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
|
||||
|
|
|
@ -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;
|
||||
], [])
|
||||
])
|
||||
|
|
|
@ -35,6 +35,25 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH_4ARG], [
|
|||
])
|
||||
])
|
||||
|
||||
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 and takes 3 args])
|
||||
ZFS_LINUX_TEST_RESULT([blkdev_get_by_path], [
|
||||
|
@ -47,7 +66,15 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], [
|
|||
[blkdev_get_by_path() exists and takes 4 args])
|
||||
AC_MSG_RESULT(yes)
|
||||
], [
|
||||
ZFS_LINUX_TEST_ERROR([blkdev_get_by_path()])
|
||||
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()])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
@ -108,18 +135,41 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_PUT_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)
|
||||
], [
|
||||
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])
|
||||
], [
|
||||
ZFS_LINUX_TEST_ERROR([blkdev_put()])
|
||||
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()])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
@ -570,8 +620,10 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BLK_STS_RESV_CONFLICT], [
|
|||
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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ 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>
|
||||
|
||||
void blk_release(struct gendisk *g) {
|
||||
static void blk_release(struct gendisk *g) {
|
||||
(void) g;
|
||||
return;
|
||||
}
|
||||
|
@ -96,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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)) = {
|
||||
|
|
|
@ -23,3 +23,28 @@ AC_DEFUN([ZFS_AC_KERNEL_IDMAP_MNT_API], [
|
|||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.8 decouples mnt_idmap from user_namespace. This is all internal
|
||||
dnl # to mnt_idmap so we can't detect it directly, but we detect a related
|
||||
dnl # change as use that as a signal.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_IDMAP_NO_USERNS], [
|
||||
ZFS_LINUX_TEST_SRC([idmap_no_userns], [
|
||||
#include <linux/uidgid.h>
|
||||
], [
|
||||
struct uid_gid_map *map = NULL;
|
||||
map_id_down(map, 0);
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_IDMAP_NO_USERNS], [
|
||||
AC_MSG_CHECKING([whether idmapped mounts have a user namespace])
|
||||
ZFS_LINUX_TEST_RESULT([idmap_no_userns], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_IDMAP_NO_USERNS, 1,
|
||||
[mnt_idmap does not have user_namespace])
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
|
|
|
@ -7,7 +7,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [
|
|||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int inode_create(struct mnt_idmap *idmap,
|
||||
static int inode_create(struct mnt_idmap *idmap,
|
||||
struct inode *inode ,struct dentry *dentry,
|
||||
umode_t umode, bool flag) { return 0; }
|
||||
|
||||
|
@ -25,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; }
|
||||
|
||||
|
@ -42,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
|
||||
|
|
|
@ -7,7 +7,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
|
|||
ZFS_LINUX_TEST_SRC([inode_operations_getattr_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int test_getattr(
|
||||
static int test_getattr(
|
||||
struct mnt_idmap *idmap,
|
||||
const struct path *p, struct kstat *k,
|
||||
u32 request_mask, unsigned int query_flags)
|
||||
|
@ -28,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)
|
||||
|
@ -47,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; }
|
||||
|
@ -61,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; }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,12 +8,12 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_PERMISSION], [
|
|||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int inode_permission(struct mnt_idmap *idmap,
|
||||
static int test_permission(struct mnt_idmap *idmap,
|
||||
struct inode *inode, int mask) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.permission = inode_permission,
|
||||
.permission = test_permission,
|
||||
};
|
||||
],[])
|
||||
|
||||
|
@ -25,12 +25,12 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_PERMISSION], [
|
|||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int inode_permission(struct user_namespace *userns,
|
||||
static int test_permission(struct user_namespace *userns,
|
||||
struct inode *inode, int mask) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.permission = inode_permission,
|
||||
.permission = test_permission,
|
||||
};
|
||||
],[])
|
||||
])
|
||||
|
|
|
@ -7,7 +7,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_SETATTR], [
|
|||
ZFS_LINUX_TEST_SRC([inode_operations_setattr_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int test_setattr(
|
||||
static int test_setattr(
|
||||
struct mnt_idmap *idmap,
|
||||
struct dentry *de, struct iattr *ia)
|
||||
{ return 0; }
|
||||
|
@ -27,7 +27,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_SETATTR], [
|
|||
ZFS_LINUX_TEST_SRC([inode_operations_setattr_userns], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int test_setattr(
|
||||
static int test_setattr(
|
||||
struct user_namespace *userns,
|
||||
struct dentry *de, struct iattr *ia)
|
||||
{ return 0; }
|
||||
|
@ -41,7 +41,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_SETATTR], [
|
|||
ZFS_LINUX_TEST_SRC([inode_operations_setattr], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int test_setattr(
|
||||
static int test_setattr(
|
||||
struct dentry *de, struct iattr *ia)
|
||||
{ return 0; }
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -9,7 +9,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [
|
|||
ZFS_LINUX_TEST_SRC([mkdir_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
|
||||
int mkdir(struct mnt_idmap *idmap,
|
||||
static int mkdir(struct mnt_idmap *idmap,
|
||||
struct inode *inode, struct dentry *dentry,
|
||||
umode_t umode) { return 0; }
|
||||
static const struct inode_operations
|
||||
|
@ -26,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; }
|
||||
|
||||
|
@ -47,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
|
||||
|
|
|
@ -7,7 +7,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_MKNOD], [
|
|||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
int tmp_mknod(struct mnt_idmap *idmap,
|
||||
static int tmp_mknod(struct mnt_idmap *idmap,
|
||||
struct inode *inode ,struct dentry *dentry,
|
||||
umode_t u, dev_t d) { return 0; }
|
||||
|
||||
|
@ -25,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; }
|
||||
|
||||
|
|
|
@ -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)) = {
|
||||
|
|
|
@ -8,7 +8,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [
|
|||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_rename2], [
|
||||
#include <linux/fs.h>
|
||||
int rename2_fn(struct inode *sip, struct dentry *sdp,
|
||||
static int rename2_fn(struct inode *sip, struct dentry *sdp,
|
||||
struct inode *tip, struct dentry *tdp,
|
||||
unsigned int flags) { return 0; }
|
||||
|
||||
|
@ -26,7 +26,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; }
|
||||
|
||||
|
@ -44,7 +44,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [
|
|||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([dir_inode_operations_wrapper_rename2], [
|
||||
#include <linux/fs.h>
|
||||
int rename2_fn(struct inode *sip, struct dentry *sdp,
|
||||
static int rename2_fn(struct inode *sip, struct dentry *sdp,
|
||||
struct inode *tip, struct dentry *tdp,
|
||||
unsigned int flags) { return 0; }
|
||||
|
||||
|
@ -62,7 +62,7 @@ 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; }
|
||||
|
||||
|
@ -77,7 +77,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [
|
|||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_rename_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
int rename_fn(struct mnt_idmap *idmap, struct inode *sip,
|
||||
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; }
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
@ -26,7 +23,7 @@ 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>
|
||||
unsigned long shrinker_cb(struct shrinker *shrink,
|
||||
static unsigned long shrinker_cb(struct shrinker *shrink,
|
||||
struct shrink_control *sc) { return 0; }
|
||||
static struct shrinker shrinker = {
|
||||
.count_objects = shrinker_cb,
|
||||
|
@ -89,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 = {
|
||||
|
@ -104,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 = {
|
||||
|
@ -116,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 = {
|
||||
|
@ -135,7 +132,7 @@ dnl #
|
|||
AC_DEFUN([ZFS_AC_KERNEL_SRC_SHRINKER_REGISTER], [
|
||||
ZFS_LINUX_TEST_SRC([shrinker_register], [
|
||||
#include <linux/shrinker.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 = {
|
||||
|
|
47
sys/contrib/openzfs/config/kernel-strlcpy.m4
Normal file
47
sys/contrib/openzfs/config/kernel-strlcpy.m4
Normal file
|
@ -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])
|
||||
])
|
||||
])
|
|
@ -6,7 +6,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SYMLINK], [
|
|||
ZFS_LINUX_TEST_SRC([symlink_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
int tmp_symlink(struct mnt_idmap *idmap,
|
||||
static int tmp_symlink(struct mnt_idmap *idmap,
|
||||
struct inode *inode ,struct dentry *dentry,
|
||||
const char *path) { return 0; }
|
||||
|
||||
|
@ -23,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; }
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -9,7 +9,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_TMPFILE], [
|
|||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_mnt_idmap], [
|
||||
#include <linux/fs.h>
|
||||
int tmpfile(struct mnt_idmap *idmap,
|
||||
static int tmpfile(struct mnt_idmap *idmap,
|
||||
struct inode *inode, struct file *file,
|
||||
umode_t mode) { return 0; }
|
||||
static struct inode_operations
|
||||
|
@ -22,7 +22,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_TMPFILE], [
|
|||
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
|
||||
|
@ -36,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
|
||||
|
@ -46,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)) = {
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,7 +6,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_WRITEPAGE_T], [
|
|||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([writepage_t_folio], [
|
||||
#include <linux/writeback.h>
|
||||
int putpage(struct folio *folio,
|
||||
static int putpage(struct folio *folio,
|
||||
struct writeback_control *wbc, void *data)
|
||||
{ return 0; }
|
||||
writepage_t func = putpage;
|
||||
|
|
|
@ -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; }
|
||||
|
@ -182,7 +182,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
|
|||
ZFS_LINUX_TEST_SRC([xattr_handler_set_mnt_idmap], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
int set(const struct xattr_handler *handler,
|
||||
static int set(const struct xattr_handler *handler,
|
||||
struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, struct inode *inode,
|
||||
const char *name, const void *buffer,
|
||||
|
@ -197,7 +197,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [
|
|||
ZFS_LINUX_TEST_SRC([xattr_handler_set_userns], [
|
||||
#include <linux/xattr.h>
|
||||
|
||||
int set(const struct xattr_handler *handler,
|
||||
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,
|
||||
|
@ -212,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)
|
||||
|
@ -226,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; }
|
||||
|
@ -239,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
|
||||
|
@ -325,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,
|
||||
|
@ -335,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
|
||||
|
@ -347,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; }
|
||||
|
|
|
@ -149,6 +149,8 @@ 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
|
||||
|
@ -156,6 +158,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
|||
ZFS_AC_KERNEL_SRC___COPY_FROM_USER_INATOMIC
|
||||
ZFS_AC_KERNEL_SRC_USER_NS_COMMON_INUM
|
||||
ZFS_AC_KERNEL_SRC_IDMAP_MNT_API
|
||||
ZFS_AC_KERNEL_SRC_IDMAP_NO_USERNS
|
||||
ZFS_AC_KERNEL_SRC_IATTR_VFSID
|
||||
ZFS_AC_KERNEL_SRC_FILEMAP
|
||||
ZFS_AC_KERNEL_SRC_WRITEPAGE_T
|
||||
|
@ -294,6 +297,8 @@ 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
|
||||
|
@ -301,6 +306,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
|||
ZFS_AC_KERNEL___COPY_FROM_USER_INATOMIC
|
||||
ZFS_AC_KERNEL_USER_NS_COMMON_INUM
|
||||
ZFS_AC_KERNEL_IDMAP_MNT_API
|
||||
ZFS_AC_KERNEL_IDMAP_NO_USERNS
|
||||
ZFS_AC_KERNEL_IATTR_VFSID
|
||||
ZFS_AC_KERNEL_FILEMAP
|
||||
ZFS_AC_KERNEL_WRITEPAGE_T
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#ifndef _LIBZUTIL_H
|
||||
#define _LIBZUTIL_H extern __attribute__((visibility("default")))
|
||||
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include <sys/nvpair.h>
|
||||
#include <sys/fs/zfs.h>
|
||||
|
||||
|
@ -267,6 +269,14 @@ int for_each_vdev_in_nvlist(nvlist_t *nvroot, pool_vdev_iter_f func,
|
|||
void update_vdevs_config_dev_sysfs_path(nvlist_t *config);
|
||||
_LIBZUTIL_H void update_vdev_config_dev_sysfs_path(nvlist_t *nv,
|
||||
const char *path, const char *key);
|
||||
|
||||
/*
|
||||
* Thread-safe strerror() for use in ZFS libraries
|
||||
*/
|
||||
static inline char *zfs_strerror(int errnum) {
|
||||
return (strerror_l(errnum, uselocale(0)));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -39,7 +39,6 @@ struct list_node {
|
|||
};
|
||||
|
||||
struct list {
|
||||
size_t list_size;
|
||||
size_t list_offset;
|
||||
struct list_node list_head;
|
||||
};
|
||||
|
|
|
@ -73,13 +73,25 @@ static inline struct user_namespace *zfs_i_user_ns(struct inode *inode)
|
|||
static inline boolean_t zfs_no_idmapping(struct user_namespace *mnt_userns,
|
||||
struct user_namespace *fs_userns)
|
||||
{
|
||||
return (zfs_is_init_userns(mnt_userns) || mnt_userns == fs_userns);
|
||||
return (zfs_is_init_userns(mnt_userns) ||
|
||||
mnt_userns == fs_userns);
|
||||
}
|
||||
|
||||
static inline uid_t zfs_uid_to_vfsuid(zidmap_t *mnt_userns,
|
||||
struct user_namespace *fs_userns, uid_t uid)
|
||||
{
|
||||
struct user_namespace *owner = idmap_owner(mnt_userns);
|
||||
struct user_namespace *owner;
|
||||
#ifdef HAVE_IOPS_CREATE_IDMAP
|
||||
if (mnt_userns == zfs_init_idmap)
|
||||
return (uid);
|
||||
#endif
|
||||
#ifdef HAVE_IDMAP_NO_USERNS
|
||||
struct user_namespace ns;
|
||||
ns.uid_map = mnt_userns->uid_map;
|
||||
owner = &ns;
|
||||
#else
|
||||
owner = idmap_owner(mnt_userns);
|
||||
#endif
|
||||
if (zfs_no_idmapping(owner, fs_userns))
|
||||
return (uid);
|
||||
if (!zfs_is_init_userns(fs_userns))
|
||||
|
@ -92,7 +104,18 @@ static inline uid_t zfs_uid_to_vfsuid(zidmap_t *mnt_userns,
|
|||
static inline gid_t zfs_gid_to_vfsgid(zidmap_t *mnt_userns,
|
||||
struct user_namespace *fs_userns, gid_t gid)
|
||||
{
|
||||
struct user_namespace *owner = idmap_owner(mnt_userns);
|
||||
struct user_namespace *owner;
|
||||
#ifdef HAVE_IOPS_CREATE_IDMAP
|
||||
if (mnt_userns == zfs_init_idmap)
|
||||
return (gid);
|
||||
#endif
|
||||
#ifdef HAVE_IDMAP_NO_USERNS
|
||||
struct user_namespace ns;
|
||||
ns.gid_map = mnt_userns->gid_map;
|
||||
owner = &ns;
|
||||
#else
|
||||
owner = idmap_owner(mnt_userns);
|
||||
#endif
|
||||
if (zfs_no_idmapping(owner, fs_userns))
|
||||
return (gid);
|
||||
if (!zfs_is_init_userns(fs_userns))
|
||||
|
@ -105,7 +128,18 @@ static inline gid_t zfs_gid_to_vfsgid(zidmap_t *mnt_userns,
|
|||
static inline uid_t zfs_vfsuid_to_uid(zidmap_t *mnt_userns,
|
||||
struct user_namespace *fs_userns, uid_t uid)
|
||||
{
|
||||
struct user_namespace *owner = idmap_owner(mnt_userns);
|
||||
struct user_namespace *owner;
|
||||
#ifdef HAVE_IOPS_CREATE_IDMAP
|
||||
if (mnt_userns == zfs_init_idmap)
|
||||
return (uid);
|
||||
#endif
|
||||
#ifdef HAVE_IDMAP_NO_USERNS
|
||||
struct user_namespace ns;
|
||||
ns.uid_map = mnt_userns->uid_map;
|
||||
owner = &ns;
|
||||
#else
|
||||
owner = idmap_owner(mnt_userns);
|
||||
#endif
|
||||
if (zfs_no_idmapping(owner, fs_userns))
|
||||
return (uid);
|
||||
uid = from_kuid(owner, KUIDT_INIT(uid));
|
||||
|
@ -119,7 +153,18 @@ static inline uid_t zfs_vfsuid_to_uid(zidmap_t *mnt_userns,
|
|||
static inline gid_t zfs_vfsgid_to_gid(zidmap_t *mnt_userns,
|
||||
struct user_namespace *fs_userns, gid_t gid)
|
||||
{
|
||||
struct user_namespace *owner = idmap_owner(mnt_userns);
|
||||
struct user_namespace *owner;
|
||||
#ifdef HAVE_IOPS_CREATE_IDMAP
|
||||
if (mnt_userns == zfs_init_idmap)
|
||||
return (gid);
|
||||
#endif
|
||||
#ifdef HAVE_IDMAP_NO_USERNS
|
||||
struct user_namespace ns;
|
||||
ns.gid_map = mnt_userns->gid_map;
|
||||
owner = &ns;
|
||||
#else
|
||||
owner = idmap_owner(mnt_userns);
|
||||
#endif
|
||||
if (zfs_no_idmapping(owner, fs_userns))
|
||||
return (gid);
|
||||
gid = from_kgid(owner, KGIDT_INIT(gid));
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
typedef struct list_head list_node_t;
|
||||
|
||||
typedef struct list {
|
||||
size_t list_size;
|
||||
size_t list_offset;
|
||||
list_node_t list_head;
|
||||
} list_t;
|
||||
|
@ -72,7 +71,8 @@ list_link_init(list_node_t *node)
|
|||
static inline void
|
||||
list_create(list_t *list, size_t size, size_t offset)
|
||||
{
|
||||
list->list_size = size;
|
||||
(void) size;
|
||||
|
||||
list->list_offset = offset;
|
||||
INIT_LIST_HEAD(&list->list_head);
|
||||
}
|
||||
|
|
|
@ -1 +1,50 @@
|
|||
/*
|
||||
* Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
|
||||
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
||||
* Written by Brian Behlendorf <behlendorf1@llnl.gov>.
|
||||
* UCRL-CODE-235197
|
||||
*
|
||||
* This file is part of the SPL, Solaris Porting Layer.
|
||||
*
|
||||
* The SPL is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* The SPL is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the SPL. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SPL_STRING_H
|
||||
#define _SPL_STRING_H
|
||||
|
||||
#include <linux/string.h>
|
||||
|
||||
/* Fallbacks for kernel missing strlcpy */
|
||||
#ifndef HAVE_KERNEL_STRLCPY
|
||||
|
||||
#if defined(HAVE_KERNEL_STRSCPY)
|
||||
/*
|
||||
* strscpy is strlcpy, but returns an error on truncation. strlcpy is defined
|
||||
* to return strlen(src), so detect error and override it.
|
||||
*/
|
||||
static inline size_t
|
||||
strlcpy(char *dest, const char *src, size_t size)
|
||||
{
|
||||
ssize_t ret = strscpy(dest, src, size);
|
||||
if (likely(ret > 0))
|
||||
return ((size_t)ret);
|
||||
return (strlen(src));
|
||||
}
|
||||
#else
|
||||
#error "no strlcpy fallback available"
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_KERNEL_STRLCPY */
|
||||
|
||||
#endif /* _SPL_STRING_H */
|
||||
|
|
|
@ -57,12 +57,23 @@ typedef int minor_t;
|
|||
struct user_namespace;
|
||||
#ifdef HAVE_IOPS_CREATE_IDMAP
|
||||
#include <linux/refcount.h>
|
||||
#ifdef HAVE_IDMAP_NO_USERNS
|
||||
#include <linux/user_namespace.h>
|
||||
struct mnt_idmap {
|
||||
struct uid_gid_map uid_map;
|
||||
struct uid_gid_map gid_map;
|
||||
refcount_t count;
|
||||
};
|
||||
typedef struct mnt_idmap zidmap_t;
|
||||
#define idmap_owner(p) (NULL)
|
||||
#else
|
||||
struct mnt_idmap {
|
||||
struct user_namespace *owner;
|
||||
refcount_t count;
|
||||
};
|
||||
typedef struct mnt_idmap zidmap_t;
|
||||
#define idmap_owner(p) (((struct mnt_idmap *)p)->owner)
|
||||
#endif
|
||||
#else
|
||||
typedef struct user_namespace zidmap_t;
|
||||
#define idmap_owner(p) ((struct user_namespace *)p)
|
||||
|
|
|
@ -383,7 +383,7 @@ nvlist_prtctl_setfmt(nvlist_prtctl_t pctl, enum nvlist_prtctl_fmt which,
|
|||
pctl->nvprt_btwnarrfmt_nl = 0;
|
||||
} else {
|
||||
pctl->nvprt_btwnarrfmt = fmt;
|
||||
pctl->nvprt_btwnarrfmt_nl = (strstr(fmt, "\n") != NULL);
|
||||
pctl->nvprt_btwnarrfmt_nl = (strchr(fmt, '\n') != NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <errno.h>
|
||||
#include <libshare.h>
|
||||
#include <unistd.h>
|
||||
#include <libzutil.h>
|
||||
#include "nfs.h"
|
||||
|
||||
|
||||
|
@ -45,7 +46,8 @@ nfs_exports_lock(const char *name, int *nfs_lock_fd)
|
|||
*nfs_lock_fd = open(name, O_RDWR | O_CREAT | O_CLOEXEC, 0600);
|
||||
if (*nfs_lock_fd == -1) {
|
||||
err = errno;
|
||||
fprintf(stderr, "failed to lock %s: %s\n", name, strerror(err));
|
||||
fprintf(stderr, "failed to lock %s: %s\n", name,
|
||||
zfs_strerror(err));
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
@ -53,7 +55,8 @@ nfs_exports_lock(const char *name, int *nfs_lock_fd)
|
|||
;
|
||||
if (err != 0) {
|
||||
err = errno;
|
||||
fprintf(stderr, "failed to lock %s: %s\n", name, strerror(err));
|
||||
fprintf(stderr, "failed to lock %s: %s\n", name,
|
||||
zfs_strerror(err));
|
||||
(void) close(*nfs_lock_fd);
|
||||
*nfs_lock_fd = -1;
|
||||
return (err);
|
||||
|
@ -69,7 +72,7 @@ nfs_exports_unlock(const char *name, int *nfs_lock_fd)
|
|||
|
||||
if (flock(*nfs_lock_fd, LOCK_UN) != 0)
|
||||
fprintf(stderr, "failed to unlock %s: %s\n",
|
||||
name, strerror(errno));
|
||||
name, zfs_strerror(errno));
|
||||
|
||||
(void) close(*nfs_lock_fd);
|
||||
*nfs_lock_fd = -1;
|
||||
|
@ -92,7 +95,7 @@ nfs_init_tmpfile(const char *prefix, const char *mdir, struct tmpfile *tmpf)
|
|||
errno != EEXIST) {
|
||||
fprintf(stderr, "failed to create %s: %s\n",
|
||||
// cppcheck-suppress uninitvar
|
||||
mdir, strerror(errno));
|
||||
mdir, zfs_strerror(errno));
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
|
@ -102,14 +105,14 @@ nfs_init_tmpfile(const char *prefix, const char *mdir, struct tmpfile *tmpf)
|
|||
int fd = mkostemp(tmpf->name, O_CLOEXEC);
|
||||
if (fd == -1) {
|
||||
fprintf(stderr, "Unable to create temporary file: %s",
|
||||
strerror(errno));
|
||||
zfs_strerror(errno));
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
tmpf->fp = fdopen(fd, "w+");
|
||||
if (tmpf->fp == NULL) {
|
||||
fprintf(stderr, "Unable to reopen temporary file: %s",
|
||||
strerror(errno));
|
||||
zfs_strerror(errno));
|
||||
close(fd);
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
@ -129,14 +132,14 @@ nfs_fini_tmpfile(const char *exports, struct tmpfile *tmpf)
|
|||
{
|
||||
if (fflush(tmpf->fp) != 0) {
|
||||
fprintf(stderr, "Failed to write to temporary file: %s\n",
|
||||
strerror(errno));
|
||||
zfs_strerror(errno));
|
||||
nfs_abort_tmpfile(tmpf);
|
||||
return (SA_SYSTEM_ERR);
|
||||
}
|
||||
|
||||
if (rename(tmpf->name, exports) == -1) {
|
||||
fprintf(stderr, "Unable to rename %s -> %s: %s\n",
|
||||
tmpf->name, exports, strerror(errno));
|
||||
tmpf->name, exports, zfs_strerror(errno));
|
||||
nfs_abort_tmpfile(tmpf);
|
||||
return (SA_SYSTEM_ERR);
|
||||
}
|
||||
|
@ -213,7 +216,7 @@ nfs_process_exports(const char *exports, const char *mountpoint,
|
|||
|
||||
if (fclose(oldfp) != 0) {
|
||||
fprintf(stderr, "Unable to close file %s: %s\n",
|
||||
exports, strerror(errno));
|
||||
exports, zfs_strerror(errno));
|
||||
error = error != SA_OK ? error : SA_SYSTEM_ERR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ struct list_node {
|
|||
};
|
||||
|
||||
struct list {
|
||||
size_t list_size;
|
||||
size_t list_offset;
|
||||
struct list_node list_head;
|
||||
};
|
||||
|
|
|
@ -65,7 +65,8 @@ list_create(list_t *list, size_t size, size_t offset)
|
|||
ASSERT(size > 0);
|
||||
ASSERT(size >= offset + sizeof (list_node_t));
|
||||
|
||||
list->list_size = size;
|
||||
(void) size;
|
||||
|
||||
list->list_offset = offset;
|
||||
list->list_head.next = list->list_head.prev = &list->list_head;
|
||||
}
|
||||
|
@ -194,7 +195,6 @@ list_move_tail(list_t *dst, list_t *src)
|
|||
list_node_t *dstnode = &dst->list_head;
|
||||
list_node_t *srcnode = &src->list_head;
|
||||
|
||||
ASSERT(dst->list_size == src->list_size);
|
||||
ASSERT(dst->list_offset == src->list_offset);
|
||||
|
||||
if (list_empty(src))
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <sys/sysmacros.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <libzutil.h>
|
||||
|
||||
int
|
||||
getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf)
|
||||
|
@ -49,13 +50,13 @@ getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf)
|
|||
|
||||
if (stat64(path, statbuf) != 0) {
|
||||
(void) fprintf(stderr, "cannot open '%s': %s\n",
|
||||
path, strerror(errno));
|
||||
path, zfs_strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (statfs(path, &sfs) != 0) {
|
||||
(void) fprintf(stderr, "%s: %s\n", path,
|
||||
strerror(errno));
|
||||
zfs_strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
statfs2mnttab(&sfs, (struct mnttab *)entry);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <sys/sysmacros.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <libzutil.h>
|
||||
|
||||
#define BUFSIZE (MNT_LINE_MAX + 2)
|
||||
|
||||
|
@ -122,7 +123,7 @@ getextmntent(const char *path, struct extmnttab *entry, struct stat64 *statbuf)
|
|||
*/
|
||||
if (stat64(path, statbuf) != 0) {
|
||||
(void) fprintf(stderr, "cannot open '%s': %s\n",
|
||||
path, strerror(errno));
|
||||
path, zfs_strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <curl/curl.h>
|
||||
#endif
|
||||
#include <libzfs.h>
|
||||
#include <libzutil.h>
|
||||
#include "libzfs_impl.h"
|
||||
#include "zfeature_common.h"
|
||||
|
||||
|
@ -493,7 +494,7 @@ get_key_material_file(libzfs_handle_t *hdl, const char *uri,
|
|||
ret = errno;
|
||||
errno = 0;
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"Failed to open key material file: %s"), strerror(ret));
|
||||
"Failed to open key material file: %s"), zfs_strerror(ret));
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
@ -595,7 +596,7 @@ get_key_material_https(libzfs_handle_t *hdl, const char *uri,
|
|||
"%s/libzfs-XXXXXXXX.https", getenv("TMPDIR") ?: "/tmp") == -1) {
|
||||
ret = ENOMEM;
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "%s"),
|
||||
strerror(ret));
|
||||
zfs_strerror(ret));
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -604,7 +605,7 @@ get_key_material_https(libzfs_handle_t *hdl, const char *uri,
|
|||
ret = errno;
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"Couldn't create temporary file %s: %s"),
|
||||
path, strerror(ret));
|
||||
path, zfs_strerror(ret));
|
||||
free(path);
|
||||
goto end;
|
||||
}
|
||||
|
@ -616,7 +617,7 @@ get_key_material_https(libzfs_handle_t *hdl, const char *uri,
|
|||
ret = errno;
|
||||
(void) close(kfd);
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"Couldn't reopen temporary file: %s"), strerror(ret));
|
||||
"Couldn't reopen temporary file: %s"), zfs_strerror(ret));
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,10 @@
|
|||
#include "libzfs_impl.h"
|
||||
#include "zfs_deleg.h"
|
||||
|
||||
static __thread struct passwd gpwd;
|
||||
static __thread struct group ggrp;
|
||||
static __thread char rpbuf[2048];
|
||||
|
||||
static int userquota_propname_decode(const char *propname, boolean_t zoned,
|
||||
zfs_userquota_prop_t *typep, char *domain, int domainlen, uint64_t *ridp);
|
||||
|
||||
|
@ -3195,11 +3199,15 @@ userquota_propname_decode(const char *propname, boolean_t zoned,
|
|||
|
||||
cp = strchr(propname, '@') + 1;
|
||||
|
||||
if (isuser && (pw = getpwnam(cp)) != NULL) {
|
||||
if (isuser &&
|
||||
getpwnam_r(cp, &gpwd, rpbuf, sizeof (rpbuf), &pw) == 0 &&
|
||||
pw != NULL) {
|
||||
if (zoned && getzoneid() == GLOBAL_ZONEID)
|
||||
return (ENOENT);
|
||||
*ridp = pw->pw_uid;
|
||||
} else if (isgroup && (gr = getgrnam(cp)) != NULL) {
|
||||
} else if (isgroup &&
|
||||
getgrnam_r(cp, &ggrp, rpbuf, sizeof (rpbuf), &gr) == 0 &&
|
||||
gr != NULL) {
|
||||
if (zoned && getzoneid() == GLOBAL_ZONEID)
|
||||
return (ENOENT);
|
||||
*ridp = gr->gr_gid;
|
||||
|
@ -5217,7 +5225,7 @@ zfs_get_fsacl(zfs_handle_t *zhp, nvlist_t **nvl)
|
|||
|
||||
nvbuf = malloc(nvsz);
|
||||
if (nvbuf == NULL) {
|
||||
err = (zfs_error(hdl, EZFS_NOMEM, strerror(errno)));
|
||||
err = (zfs_error(hdl, EZFS_NOMEM, zfs_strerror(errno)));
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ write_inuse_diffs_one(FILE *fp, differ_info_t *di, uint64_t dobj)
|
|||
fobjerr = get_stats_for_obj(di, di->fromsnap, dobj, fobjname,
|
||||
MAXPATHLEN, &fsb);
|
||||
if (fobjerr && di->zerr != ENOTSUP && di->zerr != ENOENT) {
|
||||
zfs_error_aux(di->zhp->zfs_hdl, "%s", strerror(di->zerr));
|
||||
zfs_error_aux(di->zhp->zfs_hdl, "%s", zfs_strerror(di->zerr));
|
||||
zfs_error(di->zhp->zfs_hdl, di->zerr, di->errbuf);
|
||||
/*
|
||||
* Let's not print an error for the same object more than
|
||||
|
@ -298,7 +298,7 @@ write_inuse_diffs_one(FILE *fp, differ_info_t *di, uint64_t dobj)
|
|||
if (tobjerr && di->zerr != ENOTSUP && di->zerr != ENOENT) {
|
||||
if (!already_logged) {
|
||||
zfs_error_aux(di->zhp->zfs_hdl,
|
||||
"%s", strerror(di->zerr));
|
||||
"%s", zfs_strerror(di->zerr));
|
||||
zfs_error(di->zhp->zfs_hdl, di->zerr, di->errbuf);
|
||||
}
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ differ(void *arg)
|
|||
|
||||
if ((ofp = fdopen(di->outputfd, "w")) == NULL) {
|
||||
di->zerr = errno;
|
||||
strlcpy(di->errbuf, strerror(errno), sizeof (di->errbuf));
|
||||
strlcpy(di->errbuf, zfs_strerror(errno), sizeof (di->errbuf));
|
||||
(void) close(di->datafd);
|
||||
return ((void *)-1);
|
||||
}
|
||||
|
@ -762,7 +762,7 @@ zfs_show_diffs(zfs_handle_t *zhp, int outfd, const char *fromsnap,
|
|||
}
|
||||
|
||||
if (pipe2(pipefd, O_CLOEXEC)) {
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", strerror(errno));
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", zfs_strerror(errno));
|
||||
teardown_differ_info(&di);
|
||||
return (zfs_error(zhp->zfs_hdl, EZFS_PIPEFAILED, errbuf));
|
||||
}
|
||||
|
@ -776,7 +776,7 @@ zfs_show_diffs(zfs_handle_t *zhp, int outfd, const char *fromsnap,
|
|||
di.datafd = pipefd[0];
|
||||
|
||||
if (pthread_create(&tid, NULL, differ, &di)) {
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", strerror(errno));
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", zfs_strerror(errno));
|
||||
(void) close(pipefd[0]);
|
||||
(void) close(pipefd[1]);
|
||||
teardown_differ_info(&di);
|
||||
|
@ -802,14 +802,15 @@ zfs_show_diffs(zfs_handle_t *zhp, int outfd, const char *fromsnap,
|
|||
zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
|
||||
"\n Not an earlier snapshot from the same fs"));
|
||||
} else if (errno != EPIPE || di.zerr == 0) {
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", strerror(errno));
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", zfs_strerror(errno));
|
||||
}
|
||||
(void) close(pipefd[1]);
|
||||
(void) pthread_cancel(tid);
|
||||
(void) pthread_join(tid, NULL);
|
||||
teardown_differ_info(&di);
|
||||
if (di.zerr != 0 && di.zerr != EPIPE) {
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", strerror(di.zerr));
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s",
|
||||
zfs_strerror(di.zerr));
|
||||
return (zfs_error(zhp->zfs_hdl, EZFS_DIFF, di.errbuf));
|
||||
} else {
|
||||
return (zfs_error(zhp->zfs_hdl, EZFS_DIFFDATA, errbuf));
|
||||
|
@ -820,7 +821,7 @@ zfs_show_diffs(zfs_handle_t *zhp, int outfd, const char *fromsnap,
|
|||
(void) pthread_join(tid, NULL);
|
||||
|
||||
if (di.zerr != 0) {
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", strerror(di.zerr));
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", zfs_strerror(di.zerr));
|
||||
return (zfs_error(zhp->zfs_hdl, EZFS_DIFF, di.errbuf));
|
||||
}
|
||||
teardown_differ_info(&di);
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
#include <sys/dsl_crypt.h>
|
||||
|
||||
#include <libzfs.h>
|
||||
#include <libzutil.h>
|
||||
|
||||
#include "libzfs_impl.h"
|
||||
#include <thread_pool.h>
|
||||
|
@ -466,7 +467,7 @@ zfs_mount_at(zfs_handle_t *zhp, const char *options, int flags,
|
|||
if (mkdirp(mountpoint, 0755) != 0) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"failed to create mountpoint: %s"),
|
||||
strerror(errno));
|
||||
zfs_strerror(errno));
|
||||
return (zfs_error_fmt(hdl, EZFS_MOUNTFAILED,
|
||||
dgettext(TEXT_DOMAIN, "cannot mount '%s'"),
|
||||
mountpoint));
|
||||
|
@ -524,7 +525,7 @@ zfs_mount_at(zfs_handle_t *zhp, const char *options, int flags,
|
|||
(u_longlong_t)zfs_prop_get_int(zhp,
|
||||
ZFS_PROP_VERSION), spa_version);
|
||||
} else {
|
||||
zfs_error_aux(hdl, "%s", strerror(rc));
|
||||
zfs_error_aux(hdl, "%s", zfs_strerror(rc));
|
||||
}
|
||||
return (zfs_error_fmt(hdl, EZFS_MOUNTFAILED,
|
||||
dgettext(TEXT_DOMAIN, "cannot mount '%s'"),
|
||||
|
|
|
@ -793,7 +793,7 @@ zfs_send_space(zfs_handle_t *zhp, const char *snapname, const char *from,
|
|||
case EFAULT:
|
||||
case EROFS:
|
||||
case EINVAL:
|
||||
zfs_error_aux(hdl, "%s", strerror(error));
|
||||
zfs_error_aux(hdl, "%s", zfs_strerror(error));
|
||||
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
|
||||
|
||||
default:
|
||||
|
@ -876,7 +876,7 @@ dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, uint64_t fromsnap_obj,
|
|||
case EFAULT:
|
||||
case EROFS:
|
||||
case EINVAL:
|
||||
zfs_error_aux(hdl, "%s", strerror(errno));
|
||||
zfs_error_aux(hdl, "%s", zfs_strerror(errno));
|
||||
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
|
||||
|
||||
default:
|
||||
|
@ -1632,7 +1632,7 @@ estimate_size(zfs_handle_t *zhp, const char *from, int fd, sendflags_t *flags,
|
|||
err = pthread_create(&ptid, NULL,
|
||||
send_progress_thread, &pa);
|
||||
if (err != 0) {
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", strerror(errno));
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", zfs_strerror(errno));
|
||||
return (zfs_error(zhp->zfs_hdl,
|
||||
EZFS_THREADCREATEFAILED, errbuf));
|
||||
}
|
||||
|
@ -1651,7 +1651,7 @@ estimate_size(zfs_handle_t *zhp, const char *from, int fd, sendflags_t *flags,
|
|||
return (err);
|
||||
|
||||
if (err != 0) {
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", strerror(err));
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", zfs_strerror(err));
|
||||
return (zfs_error(zhp->zfs_hdl, EZFS_BADBACKUP,
|
||||
errbuf));
|
||||
}
|
||||
|
@ -1767,7 +1767,7 @@ find_redact_book(libzfs_handle_t *hdl, const char *path,
|
|||
"dataset to be sent no longer exists"));
|
||||
} else {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"unknown error: %s"), strerror(error));
|
||||
"unknown error: %s"), zfs_strerror(error));
|
||||
}
|
||||
return (zfs_error(hdl, EZFS_BADPROP, errbuf));
|
||||
}
|
||||
|
@ -2004,7 +2004,7 @@ zfs_send_resume_impl_cb_impl(libzfs_handle_t *hdl, sendflags_t *flags,
|
|||
case ERANGE:
|
||||
case EFAULT:
|
||||
case EROFS:
|
||||
zfs_error_aux(hdl, "%s", strerror(errno));
|
||||
zfs_error_aux(hdl, "%s", zfs_strerror(errno));
|
||||
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
|
||||
|
||||
default:
|
||||
|
@ -2290,13 +2290,13 @@ send_prelim_records(zfs_handle_t *zhp, const char *from, int fd,
|
|||
err = dump_record(&drr, packbuf, buflen, &zc, fd);
|
||||
free(packbuf);
|
||||
if (err != 0) {
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", strerror(err));
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", zfs_strerror(err));
|
||||
return (zfs_error(zhp->zfs_hdl, EZFS_BADBACKUP,
|
||||
errbuf));
|
||||
}
|
||||
err = send_conclusion_record(fd, &zc);
|
||||
if (err != 0) {
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", strerror(err));
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", zfs_strerror(err));
|
||||
return (zfs_error(zhp->zfs_hdl, EZFS_BADBACKUP,
|
||||
errbuf));
|
||||
}
|
||||
|
@ -2765,7 +2765,7 @@ zfs_send_one_cb_impl(zfs_handle_t *zhp, const char *from, int fd,
|
|||
err = pthread_create(&ptid, NULL,
|
||||
send_progress_thread, &pa);
|
||||
if (err != 0) {
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", strerror(errno));
|
||||
zfs_error_aux(zhp->zfs_hdl, "%s", zfs_strerror(errno));
|
||||
return (zfs_error(zhp->zfs_hdl,
|
||||
EZFS_THREADCREATEFAILED, errbuf));
|
||||
}
|
||||
|
@ -2823,7 +2823,7 @@ zfs_send_one_cb_impl(zfs_handle_t *zhp, const char *from, int fd,
|
|||
case EPIPE:
|
||||
case ERANGE:
|
||||
case EROFS:
|
||||
zfs_error_aux(hdl, "%s", strerror(errno));
|
||||
zfs_error_aux(hdl, "%s", zfs_strerror(errno));
|
||||
return (zfs_error(hdl, EZFS_BADBACKUP, errbuf));
|
||||
|
||||
default:
|
||||
|
|
|
@ -513,7 +513,7 @@ zfs_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...)
|
|||
zfs_verror(hdl, EZFS_NOT_USER_NAMESPACE, fmt, ap);
|
||||
break;
|
||||
default:
|
||||
zfs_error_aux(hdl, "%s", strerror(error));
|
||||
zfs_error_aux(hdl, "%s", zfs_strerror(error));
|
||||
zfs_verror(hdl, EZFS_UNKNOWN, fmt, ap);
|
||||
break;
|
||||
}
|
||||
|
@ -769,7 +769,7 @@ zpool_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...)
|
|||
zfs_verror(hdl, EZFS_RAIDZ_EXPAND_IN_PROGRESS, fmt, ap);
|
||||
break;
|
||||
default:
|
||||
zfs_error_aux(hdl, "%s", strerror(error));
|
||||
zfs_error_aux(hdl, "%s", zfs_strerror(error));
|
||||
zfs_verror(hdl, EZFS_UNKNOWN, fmt, ap);
|
||||
}
|
||||
|
||||
|
@ -1968,7 +1968,7 @@ zfs_version_print(void)
|
|||
char *kver = zfs_version_kernel();
|
||||
if (kver == NULL) {
|
||||
fprintf(stderr, "zfs_version_kernel() failed: %s\n",
|
||||
strerror(errno));
|
||||
zfs_strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ libzfs_error_init(int error)
|
|||
msglen -= len;
|
||||
}
|
||||
|
||||
(void) snprintf(msg, msglen, "%s", strerror(error));
|
||||
(void) snprintf(msg, msglen, "%s", zfs_strerror(error));
|
||||
|
||||
return (errbuf);
|
||||
}
|
||||
|
|
|
@ -1290,7 +1290,7 @@ zpool_find_import_scan_dir(libpc_handle_t *hdl, pthread_mutex_t *lock,
|
|||
if (error == ENOENT)
|
||||
return (0);
|
||||
|
||||
zutil_error_aux(hdl, "%s", strerror(error));
|
||||
zutil_error_aux(hdl, "%s", zfs_strerror(error));
|
||||
(void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN,
|
||||
"cannot resolve path '%s'"), dir);
|
||||
return (error);
|
||||
|
@ -1299,7 +1299,7 @@ zpool_find_import_scan_dir(libpc_handle_t *hdl, pthread_mutex_t *lock,
|
|||
dirp = opendir(path);
|
||||
if (dirp == NULL) {
|
||||
error = errno;
|
||||
zutil_error_aux(hdl, "%s", strerror(error));
|
||||
zutil_error_aux(hdl, "%s", zfs_strerror(error));
|
||||
(void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN,
|
||||
"cannot open '%s'"), path);
|
||||
return (error);
|
||||
|
@ -1361,7 +1361,7 @@ zpool_find_import_scan_path(libpc_handle_t *hdl, pthread_mutex_t *lock,
|
|||
goto out;
|
||||
}
|
||||
|
||||
zutil_error_aux(hdl, "%s", strerror(error));
|
||||
zutil_error_aux(hdl, "%s", zfs_strerror(error));
|
||||
(void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN,
|
||||
"cannot resolve path '%s'"), dir);
|
||||
goto out;
|
||||
|
@ -1399,7 +1399,7 @@ zpool_find_import_scan(libpc_handle_t *hdl, pthread_mutex_t *lock,
|
|||
if (error == ENOENT)
|
||||
continue;
|
||||
|
||||
zutil_error_aux(hdl, "%s", strerror(error));
|
||||
zutil_error_aux(hdl, "%s", zfs_strerror(error));
|
||||
(void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(
|
||||
TEXT_DOMAIN, "cannot resolve path '%s'"), dir[i]);
|
||||
goto error;
|
||||
|
@ -1629,14 +1629,14 @@ zpool_find_import_cached(libpc_handle_t *hdl, importargs_t *iarg)
|
|||
verify(iarg->poolname == NULL || iarg->guid == 0);
|
||||
|
||||
if ((fd = open(iarg->cachefile, O_RDONLY | O_CLOEXEC)) < 0) {
|
||||
zutil_error_aux(hdl, "%s", strerror(errno));
|
||||
zutil_error_aux(hdl, "%s", zfs_strerror(errno));
|
||||
(void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN,
|
||||
"failed to open cache file"));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (fstat64(fd, &statbuf) != 0) {
|
||||
zutil_error_aux(hdl, "%s", strerror(errno));
|
||||
zutil_error_aux(hdl, "%s", zfs_strerror(errno));
|
||||
(void) close(fd);
|
||||
(void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN,
|
||||
"failed to get size of cache file"));
|
||||
|
|
|
@ -146,7 +146,7 @@ Specify
|
|||
.Sy u
|
||||
for a printed representation of the internal representation of time.
|
||||
See
|
||||
.Xr time 2 .
|
||||
.Xr time 1 .
|
||||
Specify
|
||||
.Sy d
|
||||
for standard date format.
|
||||
|
|
|
@ -95,7 +95,7 @@ Specify
|
|||
.Sy u
|
||||
for a printed representation of the internal representation of time.
|
||||
See
|
||||
.Xr time 2 .
|
||||
.Xr time 1 .
|
||||
Specify
|
||||
.Sy d
|
||||
for standard date format.
|
||||
|
|
|
@ -112,7 +112,7 @@ Specify
|
|||
.Sy u
|
||||
for a printed representation of the internal representation of time.
|
||||
See
|
||||
.Xr time 2 .
|
||||
.Xr time 1 .
|
||||
Specify
|
||||
.Sy d
|
||||
for standard date format.
|
||||
|
|
|
@ -99,7 +99,7 @@ Specify
|
|||
.Sy u
|
||||
for a printed representation of the internal representation of time.
|
||||
See
|
||||
.Xr time 2 .
|
||||
.Xr time 1 .
|
||||
Specify
|
||||
.Sy d
|
||||
for standard date format.
|
||||
|
|
|
@ -64,7 +64,8 @@ list_create(list_t *list, size_t size, size_t offset)
|
|||
ASSERT3P(list, !=, NULL);
|
||||
ASSERT3U(size, >=, offset + sizeof (list_node_t));
|
||||
|
||||
list->list_size = size;
|
||||
(void) size;
|
||||
|
||||
list->list_offset = offset;
|
||||
list->list_head.list_next = list->list_head.list_prev =
|
||||
&list->list_head;
|
||||
|
@ -194,7 +195,6 @@ list_move_tail(list_t *dst, list_t *src)
|
|||
list_node_t *dstnode = &dst->list_head;
|
||||
list_node_t *srcnode = &src->list_head;
|
||||
|
||||
ASSERT3U(dst->list_size, ==, src->list_size);
|
||||
ASSERT3U(dst->list_offset, ==, src->list_offset);
|
||||
|
||||
if (list_empty(src))
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <sys/timer.h>
|
||||
#include <sys/vmem.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/string.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/swap.h>
|
||||
#include <linux/prefetch.h>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <sys/vmem.h>
|
||||
#include <sys/cmn_err.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/string.h>
|
||||
|
||||
static kmutex_t kstat_module_lock;
|
||||
static struct list_head kstat_module_list;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <sys/thread.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/tsd.h>
|
||||
#include <sys/string.h>
|
||||
|
||||
/*
|
||||
* Thread interfaces
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <linux/file.h>
|
||||
#include <linux/magic.h>
|
||||
#include <sys/zone.h>
|
||||
#include <sys/string.h>
|
||||
|
||||
#if defined(CONFIG_USER_NS)
|
||||
#include <linux/statfs.h>
|
||||
|
|
|
@ -60,8 +60,16 @@
|
|||
#ifdef _KERNEL
|
||||
#include <linux/kmap_compat.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#endif
|
||||
|
||||
#ifdef _KERNEL
|
||||
#if defined(MAX_ORDER)
|
||||
#define ABD_MAX_ORDER (MAX_ORDER)
|
||||
#elif defined(MAX_PAGE_ORDER)
|
||||
#define ABD_MAX_ORDER (MAX_PAGE_ORDER)
|
||||
#endif
|
||||
#else
|
||||
#define MAX_ORDER 1
|
||||
#define ABD_MAX_ORDER (1)
|
||||
#endif
|
||||
|
||||
typedef struct abd_stats {
|
||||
|
@ -71,7 +79,7 @@ typedef struct abd_stats {
|
|||
kstat_named_t abdstat_scatter_cnt;
|
||||
kstat_named_t abdstat_scatter_data_size;
|
||||
kstat_named_t abdstat_scatter_chunk_waste;
|
||||
kstat_named_t abdstat_scatter_orders[MAX_ORDER];
|
||||
kstat_named_t abdstat_scatter_orders[ABD_MAX_ORDER];
|
||||
kstat_named_t abdstat_scatter_page_multi_chunk;
|
||||
kstat_named_t abdstat_scatter_page_multi_zone;
|
||||
kstat_named_t abdstat_scatter_page_alloc_retry;
|
||||
|
@ -139,7 +147,7 @@ static struct {
|
|||
wmsum_t abdstat_scatter_cnt;
|
||||
wmsum_t abdstat_scatter_data_size;
|
||||
wmsum_t abdstat_scatter_chunk_waste;
|
||||
wmsum_t abdstat_scatter_orders[MAX_ORDER];
|
||||
wmsum_t abdstat_scatter_orders[ABD_MAX_ORDER];
|
||||
wmsum_t abdstat_scatter_page_multi_chunk;
|
||||
wmsum_t abdstat_scatter_page_multi_zone;
|
||||
wmsum_t abdstat_scatter_page_alloc_retry;
|
||||
|
@ -222,7 +230,7 @@ abd_free_struct_impl(abd_t *abd)
|
|||
}
|
||||
|
||||
#ifdef _KERNEL
|
||||
static unsigned zfs_abd_scatter_max_order = MAX_ORDER - 1;
|
||||
static unsigned zfs_abd_scatter_max_order = ABD_MAX_ORDER - 1;
|
||||
|
||||
/*
|
||||
* Mark zfs data pages so they can be excluded from kernel crash dumps
|
||||
|
@ -272,7 +280,8 @@ abd_alloc_chunks(abd_t *abd, size_t size)
|
|||
struct page *page, *tmp_page = NULL;
|
||||
gfp_t gfp = __GFP_NOWARN | GFP_NOIO;
|
||||
gfp_t gfp_comp = (gfp | __GFP_NORETRY | __GFP_COMP) & ~__GFP_RECLAIM;
|
||||
unsigned int max_order = MIN(zfs_abd_scatter_max_order, MAX_ORDER - 1);
|
||||
unsigned int max_order = MIN(zfs_abd_scatter_max_order,
|
||||
ABD_MAX_ORDER - 1);
|
||||
unsigned int nr_pages = abd_chunkcnt_for_bytes(size);
|
||||
unsigned int chunks = 0, zones = 0;
|
||||
size_t remaining_size;
|
||||
|
@ -729,7 +738,7 @@ abd_kstats_update(kstat_t *ksp, int rw)
|
|||
wmsum_value(&abd_sums.abdstat_scatter_data_size);
|
||||
as->abdstat_scatter_chunk_waste.value.ui64 =
|
||||
wmsum_value(&abd_sums.abdstat_scatter_chunk_waste);
|
||||
for (int i = 0; i < MAX_ORDER; i++) {
|
||||
for (int i = 0; i < ABD_MAX_ORDER; i++) {
|
||||
as->abdstat_scatter_orders[i].value.ui64 =
|
||||
wmsum_value(&abd_sums.abdstat_scatter_orders[i]);
|
||||
}
|
||||
|
@ -758,7 +767,7 @@ abd_init(void)
|
|||
wmsum_init(&abd_sums.abdstat_scatter_cnt, 0);
|
||||
wmsum_init(&abd_sums.abdstat_scatter_data_size, 0);
|
||||
wmsum_init(&abd_sums.abdstat_scatter_chunk_waste, 0);
|
||||
for (i = 0; i < MAX_ORDER; i++)
|
||||
for (i = 0; i < ABD_MAX_ORDER; i++)
|
||||
wmsum_init(&abd_sums.abdstat_scatter_orders[i], 0);
|
||||
wmsum_init(&abd_sums.abdstat_scatter_page_multi_chunk, 0);
|
||||
wmsum_init(&abd_sums.abdstat_scatter_page_multi_zone, 0);
|
||||
|
@ -768,7 +777,7 @@ abd_init(void)
|
|||
abd_ksp = kstat_create("zfs", 0, "abdstats", "misc", KSTAT_TYPE_NAMED,
|
||||
sizeof (abd_stats) / sizeof (kstat_named_t), KSTAT_FLAG_VIRTUAL);
|
||||
if (abd_ksp != NULL) {
|
||||
for (i = 0; i < MAX_ORDER; i++) {
|
||||
for (i = 0; i < ABD_MAX_ORDER; i++) {
|
||||
snprintf(abd_stats.abdstat_scatter_orders[i].name,
|
||||
KSTAT_STRLEN, "scatter_order_%d", i);
|
||||
abd_stats.abdstat_scatter_orders[i].data_type =
|
||||
|
@ -798,7 +807,7 @@ abd_fini(void)
|
|||
wmsum_fini(&abd_sums.abdstat_scatter_cnt);
|
||||
wmsum_fini(&abd_sums.abdstat_scatter_data_size);
|
||||
wmsum_fini(&abd_sums.abdstat_scatter_chunk_waste);
|
||||
for (int i = 0; i < MAX_ORDER; i++)
|
||||
for (int i = 0; i < ABD_MAX_ORDER; i++)
|
||||
wmsum_fini(&abd_sums.abdstat_scatter_orders[i]);
|
||||
wmsum_fini(&abd_sums.abdstat_scatter_page_multi_chunk);
|
||||
wmsum_fini(&abd_sums.abdstat_scatter_page_multi_zone);
|
||||
|
|
|
@ -41,8 +41,28 @@
|
|||
#include <linux/blk-cgroup.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Linux 6.8.x uses a bdev_handle as an instance/refcount for an underlying
|
||||
* block_device. Since it carries the block_device inside, its convenient to
|
||||
* just use the handle as a proxy. For pre-6.8, we just emulate this with
|
||||
* a cast, since we don't need any of the other fields inside the handle.
|
||||
*/
|
||||
#ifdef HAVE_BDEV_OPEN_BY_PATH
|
||||
typedef struct bdev_handle zfs_bdev_handle_t;
|
||||
#define BDH_BDEV(bdh) ((bdh)->bdev)
|
||||
#define BDH_IS_ERR(bdh) (IS_ERR(bdh))
|
||||
#define BDH_PTR_ERR(bdh) (PTR_ERR(bdh))
|
||||
#define BDH_ERR_PTR(err) (ERR_PTR(err))
|
||||
#else
|
||||
typedef void zfs_bdev_handle_t;
|
||||
#define BDH_BDEV(bdh) ((struct block_device *)bdh)
|
||||
#define BDH_IS_ERR(bdh) (IS_ERR(BDH_BDEV(bdh)))
|
||||
#define BDH_PTR_ERR(bdh) (PTR_ERR(BDH_BDEV(bdh)))
|
||||
#define BDH_ERR_PTR(err) (ERR_PTR(err))
|
||||
#endif
|
||||
|
||||
typedef struct vdev_disk {
|
||||
struct block_device *vd_bdev;
|
||||
zfs_bdev_handle_t *vd_bdh;
|
||||
krwlock_t vd_lock;
|
||||
} vdev_disk_t;
|
||||
|
||||
|
@ -209,29 +229,23 @@ static void
|
|||
vdev_disk_kobj_evt_post(vdev_t *v)
|
||||
{
|
||||
vdev_disk_t *vd = v->vdev_tsd;
|
||||
if (vd && vd->vd_bdev) {
|
||||
spl_signal_kobj_evt(vd->vd_bdev);
|
||||
if (vd && vd->vd_bdh) {
|
||||
spl_signal_kobj_evt(BDH_BDEV(vd->vd_bdh));
|
||||
} else {
|
||||
vdev_dbgmsg(v, "vdev_disk_t is NULL for VDEV:%s\n",
|
||||
v->vdev_path);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(HAVE_BLKDEV_GET_BY_PATH_4ARG)
|
||||
/*
|
||||
* Define a dummy struct blk_holder_ops for kernel versions
|
||||
* prior to 6.5.
|
||||
*/
|
||||
struct blk_holder_ops {};
|
||||
#endif
|
||||
|
||||
static struct block_device *
|
||||
vdev_blkdev_get_by_path(const char *path, spa_mode_t mode, void *holder,
|
||||
const struct blk_holder_ops *hops)
|
||||
static zfs_bdev_handle_t *
|
||||
vdev_blkdev_get_by_path(const char *path, spa_mode_t mode, void *holder)
|
||||
{
|
||||
#ifdef HAVE_BLKDEV_GET_BY_PATH_4ARG
|
||||
#if defined(HAVE_BDEV_OPEN_BY_PATH)
|
||||
return (bdev_open_by_path(path,
|
||||
vdev_bdev_mode(mode, B_TRUE), holder, NULL));
|
||||
#elif defined(HAVE_BLKDEV_GET_BY_PATH_4ARG)
|
||||
return (blkdev_get_by_path(path,
|
||||
vdev_bdev_mode(mode, B_TRUE), holder, hops));
|
||||
vdev_bdev_mode(mode, B_TRUE), holder, NULL));
|
||||
#else
|
||||
return (blkdev_get_by_path(path,
|
||||
vdev_bdev_mode(mode, B_TRUE), holder));
|
||||
|
@ -239,12 +253,15 @@ vdev_blkdev_get_by_path(const char *path, spa_mode_t mode, void *holder,
|
|||
}
|
||||
|
||||
static void
|
||||
vdev_blkdev_put(struct block_device *bdev, spa_mode_t mode, void *holder)
|
||||
vdev_blkdev_put(zfs_bdev_handle_t *bdh, spa_mode_t mode, void *holder)
|
||||
{
|
||||
#ifdef HAVE_BLKDEV_PUT_HOLDER
|
||||
return (blkdev_put(bdev, holder));
|
||||
#if defined(HAVE_BDEV_RELEASE)
|
||||
return (bdev_release(bdh));
|
||||
#elif defined(HAVE_BLKDEV_PUT_HOLDER)
|
||||
return (blkdev_put(BDH_BDEV(bdh), holder));
|
||||
#else
|
||||
return (blkdev_put(bdev, vdev_bdev_mode(mode, B_TRUE)));
|
||||
return (blkdev_put(BDH_BDEV(bdh),
|
||||
vdev_bdev_mode(mode, B_TRUE)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -252,7 +269,7 @@ static int
|
|||
vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
|
||||
uint64_t *logical_ashift, uint64_t *physical_ashift)
|
||||
{
|
||||
struct block_device *bdev;
|
||||
zfs_bdev_handle_t *bdh;
|
||||
#ifdef HAVE_BLK_MODE_T
|
||||
blk_mode_t mode = vdev_bdev_mode(spa_mode(v->vdev_spa), B_FALSE);
|
||||
#else
|
||||
|
@ -282,10 +299,11 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
|
|||
boolean_t reread_part = B_FALSE;
|
||||
|
||||
rw_enter(&vd->vd_lock, RW_WRITER);
|
||||
bdev = vd->vd_bdev;
|
||||
vd->vd_bdev = NULL;
|
||||
bdh = vd->vd_bdh;
|
||||
vd->vd_bdh = NULL;
|
||||
|
||||
if (bdev) {
|
||||
if (bdh) {
|
||||
struct block_device *bdev = BDH_BDEV(bdh);
|
||||
if (v->vdev_expanding && bdev != bdev_whole(bdev)) {
|
||||
vdev_bdevname(bdev_whole(bdev), disk_name + 5);
|
||||
/*
|
||||
|
@ -307,15 +325,16 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
|
|||
reread_part = B_TRUE;
|
||||
}
|
||||
|
||||
vdev_blkdev_put(bdev, mode, zfs_vdev_holder);
|
||||
vdev_blkdev_put(bdh, mode, zfs_vdev_holder);
|
||||
}
|
||||
|
||||
if (reread_part) {
|
||||
bdev = vdev_blkdev_get_by_path(disk_name, mode,
|
||||
zfs_vdev_holder, NULL);
|
||||
if (!IS_ERR(bdev)) {
|
||||
int error = vdev_bdev_reread_part(bdev);
|
||||
vdev_blkdev_put(bdev, mode, zfs_vdev_holder);
|
||||
bdh = vdev_blkdev_get_by_path(disk_name, mode,
|
||||
zfs_vdev_holder);
|
||||
if (!BDH_IS_ERR(bdh)) {
|
||||
int error =
|
||||
vdev_bdev_reread_part(BDH_BDEV(bdh));
|
||||
vdev_blkdev_put(bdh, mode, zfs_vdev_holder);
|
||||
if (error == 0) {
|
||||
timeout = MSEC2NSEC(
|
||||
zfs_vdev_open_timeout_ms * 2);
|
||||
|
@ -358,11 +377,11 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
|
|||
* subsequent attempts are expected to eventually succeed.
|
||||
*/
|
||||
hrtime_t start = gethrtime();
|
||||
bdev = ERR_PTR(-ENXIO);
|
||||
while (IS_ERR(bdev) && ((gethrtime() - start) < timeout)) {
|
||||
bdev = vdev_blkdev_get_by_path(v->vdev_path, mode,
|
||||
zfs_vdev_holder, NULL);
|
||||
if (unlikely(PTR_ERR(bdev) == -ENOENT)) {
|
||||
bdh = BDH_ERR_PTR(-ENXIO);
|
||||
while (BDH_IS_ERR(bdh) && ((gethrtime() - start) < timeout)) {
|
||||
bdh = vdev_blkdev_get_by_path(v->vdev_path, mode,
|
||||
zfs_vdev_holder);
|
||||
if (unlikely(BDH_PTR_ERR(bdh) == -ENOENT)) {
|
||||
/*
|
||||
* There is no point of waiting since device is removed
|
||||
* explicitly
|
||||
|
@ -371,52 +390,54 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
|
|||
break;
|
||||
|
||||
schedule_timeout(MSEC_TO_TICK(10));
|
||||
} else if (unlikely(PTR_ERR(bdev) == -ERESTARTSYS)) {
|
||||
} else if (unlikely(BDH_PTR_ERR(bdh) == -ERESTARTSYS)) {
|
||||
timeout = MSEC2NSEC(zfs_vdev_open_timeout_ms * 10);
|
||||
continue;
|
||||
} else if (IS_ERR(bdev)) {
|
||||
} else if (BDH_IS_ERR(bdh)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_ERR(bdev)) {
|
||||
int error = -PTR_ERR(bdev);
|
||||
if (BDH_IS_ERR(bdh)) {
|
||||
int error = -BDH_PTR_ERR(bdh);
|
||||
vdev_dbgmsg(v, "open error=%d timeout=%llu/%llu", error,
|
||||
(u_longlong_t)(gethrtime() - start),
|
||||
(u_longlong_t)timeout);
|
||||
vd->vd_bdev = NULL;
|
||||
vd->vd_bdh = NULL;
|
||||
v->vdev_tsd = vd;
|
||||
rw_exit(&vd->vd_lock);
|
||||
return (SET_ERROR(error));
|
||||
} else {
|
||||
vd->vd_bdev = bdev;
|
||||
vd->vd_bdh = bdh;
|
||||
v->vdev_tsd = vd;
|
||||
rw_exit(&vd->vd_lock);
|
||||
}
|
||||
|
||||
struct block_device *bdev = BDH_BDEV(vd->vd_bdh);
|
||||
|
||||
/* Determine the physical block size */
|
||||
int physical_block_size = bdev_physical_block_size(vd->vd_bdev);
|
||||
int physical_block_size = bdev_physical_block_size(bdev);
|
||||
|
||||
/* Determine the logical block size */
|
||||
int logical_block_size = bdev_logical_block_size(vd->vd_bdev);
|
||||
int logical_block_size = bdev_logical_block_size(bdev);
|
||||
|
||||
/* Clear the nowritecache bit, causes vdev_reopen() to try again. */
|
||||
v->vdev_nowritecache = B_FALSE;
|
||||
|
||||
/* Set when device reports it supports TRIM. */
|
||||
v->vdev_has_trim = bdev_discard_supported(vd->vd_bdev);
|
||||
v->vdev_has_trim = bdev_discard_supported(bdev);
|
||||
|
||||
/* Set when device reports it supports secure TRIM. */
|
||||
v->vdev_has_securetrim = bdev_secure_discard_supported(vd->vd_bdev);
|
||||
v->vdev_has_securetrim = bdev_secure_discard_supported(bdev);
|
||||
|
||||
/* Inform the ZIO pipeline that we are non-rotational */
|
||||
v->vdev_nonrot = blk_queue_nonrot(bdev_get_queue(vd->vd_bdev));
|
||||
v->vdev_nonrot = blk_queue_nonrot(bdev_get_queue(bdev));
|
||||
|
||||
/* Physical volume size in bytes for the partition */
|
||||
*psize = bdev_capacity(vd->vd_bdev);
|
||||
*psize = bdev_capacity(bdev);
|
||||
|
||||
/* Physical volume size in bytes including possible expansion space */
|
||||
*max_psize = bdev_max_capacity(vd->vd_bdev, v->vdev_wholedisk);
|
||||
*max_psize = bdev_max_capacity(bdev, v->vdev_wholedisk);
|
||||
|
||||
/* Based on the minimum sector size set the block size */
|
||||
*physical_ashift = highbit64(MAX(physical_block_size,
|
||||
|
@ -436,8 +457,8 @@ vdev_disk_close(vdev_t *v)
|
|||
if (v->vdev_reopening || vd == NULL)
|
||||
return;
|
||||
|
||||
if (vd->vd_bdev != NULL) {
|
||||
vdev_blkdev_put(vd->vd_bdev, spa_mode(v->vdev_spa),
|
||||
if (vd->vd_bdh != NULL) {
|
||||
vdev_blkdev_put(vd->vd_bdh, spa_mode(v->vdev_spa),
|
||||
zfs_vdev_holder);
|
||||
}
|
||||
|
||||
|
@ -849,10 +870,10 @@ vdev_disk_io_trim(zio_t *zio)
|
|||
|
||||
#if defined(HAVE_BLKDEV_ISSUE_SECURE_ERASE)
|
||||
if (zio->io_trim_flags & ZIO_TRIM_SECURE) {
|
||||
return (-blkdev_issue_secure_erase(vd->vd_bdev,
|
||||
return (-blkdev_issue_secure_erase(BDH_BDEV(vd->vd_bdh),
|
||||
zio->io_offset >> 9, zio->io_size >> 9, GFP_NOFS));
|
||||
} else {
|
||||
return (-blkdev_issue_discard(vd->vd_bdev,
|
||||
return (-blkdev_issue_discard(BDH_BDEV(vd->vd_bdh),
|
||||
zio->io_offset >> 9, zio->io_size >> 9, GFP_NOFS));
|
||||
}
|
||||
#elif defined(HAVE_BLKDEV_ISSUE_DISCARD)
|
||||
|
@ -861,7 +882,7 @@ vdev_disk_io_trim(zio_t *zio)
|
|||
if (zio->io_trim_flags & ZIO_TRIM_SECURE)
|
||||
trim_flags |= BLKDEV_DISCARD_SECURE;
|
||||
#endif
|
||||
return (-blkdev_issue_discard(vd->vd_bdev,
|
||||
return (-blkdev_issue_discard(BDH_BDEV(vd->vd_bdh),
|
||||
zio->io_offset >> 9, zio->io_size >> 9, GFP_NOFS, trim_flags));
|
||||
#else
|
||||
#error "Unsupported kernel"
|
||||
|
@ -891,7 +912,7 @@ vdev_disk_io_start(zio_t *zio)
|
|||
* If the vdev is closed, it's likely due to a failed reopen and is
|
||||
* in the UNAVAIL state. Nothing to be done here but return failure.
|
||||
*/
|
||||
if (vd->vd_bdev == NULL) {
|
||||
if (vd->vd_bdh == NULL) {
|
||||
rw_exit(&vd->vd_lock);
|
||||
zio->io_error = ENXIO;
|
||||
zio_interrupt(zio);
|
||||
|
@ -919,7 +940,7 @@ vdev_disk_io_start(zio_t *zio)
|
|||
break;
|
||||
}
|
||||
|
||||
error = vdev_disk_io_flush(vd->vd_bdev, zio);
|
||||
error = vdev_disk_io_flush(BDH_BDEV(vd->vd_bdh), zio);
|
||||
if (error == 0) {
|
||||
rw_exit(&vd->vd_lock);
|
||||
return;
|
||||
|
@ -958,7 +979,7 @@ vdev_disk_io_start(zio_t *zio)
|
|||
}
|
||||
|
||||
zio->io_target_timestamp = zio_handle_io_delay(zio);
|
||||
error = __vdev_disk_physio(vd->vd_bdev, zio,
|
||||
error = __vdev_disk_physio(BDH_BDEV(vd->vd_bdh), zio,
|
||||
zio->io_size, zio->io_offset, rw, 0);
|
||||
rw_exit(&vd->vd_lock);
|
||||
|
||||
|
@ -981,8 +1002,8 @@ vdev_disk_io_done(zio_t *zio)
|
|||
vdev_t *v = zio->io_vd;
|
||||
vdev_disk_t *vd = v->vdev_tsd;
|
||||
|
||||
if (!zfs_check_disk_status(vd->vd_bdev)) {
|
||||
invalidate_bdev(vd->vd_bdev);
|
||||
if (!zfs_check_disk_status(BDH_BDEV(vd->vd_bdh))) {
|
||||
invalidate_bdev(BDH_BDEV(vd->vd_bdh));
|
||||
v->vdev_remove_wanted = B_TRUE;
|
||||
spa_async_request(zio->io_spa, SPA_ASYNC_REMOVE);
|
||||
}
|
||||
|
|
|
@ -5105,7 +5105,6 @@ metaslab_group_alloc(metaslab_group_t *mg, zio_alloc_list_t *zal,
|
|||
int allocator, boolean_t try_hard)
|
||||
{
|
||||
uint64_t offset;
|
||||
ASSERT(mg->mg_initialized);
|
||||
|
||||
offset = metaslab_group_alloc_normal(mg, zal, asize, txg, want_unique,
|
||||
dva, d, allocator, try_hard);
|
||||
|
@ -5256,8 +5255,6 @@ metaslab_alloc_dva(spa_t *spa, metaslab_class_t *mc, uint64_t psize,
|
|||
goto next;
|
||||
}
|
||||
|
||||
ASSERT(mg->mg_initialized);
|
||||
|
||||
/*
|
||||
* Avoid writing single-copy data to an unhealthy,
|
||||
* non-redundant vdev, unless we've already tried all
|
||||
|
|
|
@ -2492,23 +2492,37 @@ vdev_validate(vdev_t *vd)
|
|||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
vdev_update_path(const char *prefix, char *svd, char **dvd, uint64_t guid)
|
||||
{
|
||||
if (svd != NULL && *dvd != NULL) {
|
||||
if (strcmp(svd, *dvd) != 0) {
|
||||
zfs_dbgmsg("vdev_copy_path: vdev %llu: %s changed "
|
||||
"from '%s' to '%s'", (u_longlong_t)guid, prefix,
|
||||
*dvd, svd);
|
||||
spa_strfree(*dvd);
|
||||
*dvd = spa_strdup(svd);
|
||||
}
|
||||
} else if (svd != NULL) {
|
||||
*dvd = spa_strdup(svd);
|
||||
zfs_dbgmsg("vdev_copy_path: vdev %llu: path set to '%s'",
|
||||
(u_longlong_t)guid, *dvd);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vdev_copy_path_impl(vdev_t *svd, vdev_t *dvd)
|
||||
{
|
||||
char *old, *new;
|
||||
if (svd->vdev_path != NULL && dvd->vdev_path != NULL) {
|
||||
if (strcmp(svd->vdev_path, dvd->vdev_path) != 0) {
|
||||
zfs_dbgmsg("vdev_copy_path: vdev %llu: path changed "
|
||||
"from '%s' to '%s'", (u_longlong_t)dvd->vdev_guid,
|
||||
dvd->vdev_path, svd->vdev_path);
|
||||
spa_strfree(dvd->vdev_path);
|
||||
dvd->vdev_path = spa_strdup(svd->vdev_path);
|
||||
}
|
||||
} else if (svd->vdev_path != NULL) {
|
||||
dvd->vdev_path = spa_strdup(svd->vdev_path);
|
||||
zfs_dbgmsg("vdev_copy_path: vdev %llu: path set to '%s'",
|
||||
(u_longlong_t)dvd->vdev_guid, dvd->vdev_path);
|
||||
}
|
||||
|
||||
vdev_update_path("vdev_path", svd->vdev_path, &dvd->vdev_path,
|
||||
dvd->vdev_guid);
|
||||
|
||||
vdev_update_path("vdev_devid", svd->vdev_devid, &dvd->vdev_devid,
|
||||
dvd->vdev_guid);
|
||||
|
||||
vdev_update_path("vdev_physpath", svd->vdev_physpath,
|
||||
&dvd->vdev_physpath, dvd->vdev_guid);
|
||||
|
||||
/*
|
||||
* Our enclosure sysfs path may have changed between imports
|
||||
|
|
|
@ -163,6 +163,7 @@ tests = ['zdb_002_pos', 'zdb_003_pos', 'zdb_004_pos', 'zdb_005_pos',
|
|||
pre =
|
||||
post =
|
||||
tags = ['functional', 'cli_root', 'zdb']
|
||||
timeout = 1200
|
||||
|
||||
[tests/functional/cli_root/zfs]
|
||||
tests = ['zfs_001_neg', 'zfs_002_pos']
|
||||
|
|
|
@ -108,6 +108,12 @@
|
|||
/* bdev_max_secure_erase_sectors() is available */
|
||||
/* #undef HAVE_BDEV_MAX_SECURE_ERASE_SECTORS */
|
||||
|
||||
/* bdev_open_by_path() exists */
|
||||
/* #undef HAVE_BDEV_OPEN_BY_PATH */
|
||||
|
||||
/* bdev_release() exists */
|
||||
/* #undef HAVE_BDEV_RELEASE */
|
||||
|
||||
/* block_device_operations->submit_bio() returns void */
|
||||
/* #undef HAVE_BDEV_SUBMIT_BIO_RETURNS_VOID */
|
||||
|
||||
|
@ -427,6 +433,9 @@
|
|||
/* APIs for idmapped mount are present */
|
||||
/* #undef HAVE_IDMAP_MNT_API */
|
||||
|
||||
/* mnt_idmap does not have user_namespace */
|
||||
/* #undef HAVE_IDMAP_NO_USERNS */
|
||||
|
||||
/* Define if compiler supports -Wimplicit-fallthrough */
|
||||
/* #undef HAVE_IMPLICIT_FALLTHROUGH */
|
||||
|
||||
|
@ -577,6 +586,12 @@
|
|||
/* kernel_read() take loff_t pointer */
|
||||
/* #undef HAVE_KERNEL_READ_PPOS */
|
||||
|
||||
/* strlcpy() exists */
|
||||
/* #undef HAVE_KERNEL_STRLCPY */
|
||||
|
||||
/* strscpy() exists */
|
||||
/* #undef HAVE_KERNEL_STRSCPY */
|
||||
|
||||
/* timer_list.function gets a timer_list */
|
||||
/* #undef HAVE_KERNEL_TIMER_FUNCTION_TIMER_LIST */
|
||||
|
||||
|
@ -1137,7 +1152,7 @@
|
|||
/* #undef ZFS_IS_GPL_COMPATIBLE */
|
||||
|
||||
/* Define the project alias string. */
|
||||
#define ZFS_META_ALIAS "zfs-2.2.99-313-FreeBSD_ga4bf6baae"
|
||||
#define ZFS_META_ALIAS "zfs-2.2.99-333-FreeBSD_g2e6b3c4d9"
|
||||
|
||||
/* Define the project author. */
|
||||
#define ZFS_META_AUTHOR "OpenZFS"
|
||||
|
@ -1146,7 +1161,7 @@
|
|||
/* #undef ZFS_META_DATA */
|
||||
|
||||
/* Define the maximum compatible kernel version. */
|
||||
#define ZFS_META_KVER_MAX "6.6"
|
||||
#define ZFS_META_KVER_MAX "6.7"
|
||||
|
||||
/* Define the minimum compatible kernel version. */
|
||||
#define ZFS_META_KVER_MIN "3.10"
|
||||
|
@ -1167,7 +1182,7 @@
|
|||
#define ZFS_META_NAME "zfs"
|
||||
|
||||
/* Define the project release. */
|
||||
#define ZFS_META_RELEASE "313-FreeBSD_ga4bf6baae"
|
||||
#define ZFS_META_RELEASE "333-FreeBSD_g2e6b3c4d9"
|
||||
|
||||
/* Define the project version. */
|
||||
#define ZFS_META_VERSION "2.2.99"
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define ZFS_META_GITREV "zfs-2.2.99-313-ga4bf6baae"
|
||||
#define ZFS_META_GITREV "zfs-2.2.99-333-g2e6b3c4d9"
|
||||
|
|
Loading…
Reference in a new issue