From 553e6e909e6d867c46972ed4558d9de5d4650997 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 20 Jan 2026 11:46:18 -0800 Subject: [PATCH 1/4] Scratch mount test helpers. Adds basic mkfs/mount/umount helpers that handle all the basics for making, mounting and unmounting scratch devices. The mount/unmount create "$T_MSCR", which lives in "$T_TMPDIR". Signed-off-by: Auke Kok --- tests/funcs/fs.sh | 24 ++++++++++++++++++++++++ tests/run-tests.sh | 3 +++ 2 files changed, 27 insertions(+) diff --git a/tests/funcs/fs.sh b/tests/funcs/fs.sh index 5fe53ed4..9d90b296 100644 --- a/tests/funcs/fs.sh +++ b/tests/funcs/fs.sh @@ -283,6 +283,30 @@ t_reinsert_remount_all() t_quiet t_mount_all || t_fail "mounting all failed" } +# +# scratch helpers +# +t_scratch_mkfs() +{ + scoutfs mkfs -f -Q 0,127.0.0.1,$T_SCRATCH_PORT "$T_EX_META_DEV" "$T_EX_DATA_DEV" "$@" > $T_TMP.mkfs.out 2>&1 || \ + t_fail "scratch mkfs failed" +} + +t_scratch_mount() +{ + mkdir -p "$T_MSCR" + mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$@" "$T_EX_DATA_DEV" "$T_MSCR" || \ + t_fail "scratch mount failed" +} + +t_scratch_umount() +{ + umount "$T_MSCR" || \ + t_fail "scratch umount failed" + rmdir "$T_MSCR" +} + + t_trigger_path() { local nr="$1" diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 814c4de7..f6c506ec 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -628,6 +628,9 @@ for t in $tests; do cmd rm -rf "$T_TMPDIR" cmd mkdir -p "$T_TMPDIR" + # assign scratch mount point in temporary dir + T_MSCR="$T_TMPDIR/scratch" + # create a test name dir in the fs, clean up old data as needed T_DS="" for i in $(seq 0 $((T_NR_MOUNTS - 1))); do From 85ffba53290a5119891fb04bc3f1d1a8cf2d1410 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 20 Jan 2026 11:50:16 -0800 Subject: [PATCH 2/4] Update existing tests to use scratch helpers. Signed-off-by: Auke Kok --- tests/tests/basic-bad-mounts.sh | 15 +++---- tests/tests/change-devices.sh | 45 ++++++++++--------- tests/tests/enospc.sh | 20 +++------ tests/tests/resize-devices.sh | 77 +++++++++++++++------------------ 4 files changed, 70 insertions(+), 87 deletions(-) diff --git a/tests/tests/basic-bad-mounts.sh b/tests/tests/basic-bad-mounts.sh index d8bc13ef..a20f36b6 100644 --- a/tests/tests/basic-bad-mounts.sh +++ b/tests/tests/basic-bad-mounts.sh @@ -12,25 +12,22 @@ mount_fail() } echo "== prepare devices, mount point, and logs" -SCR="$T_TMPDIR/mnt.scratch" -mkdir -p "$SCR" +t_scratch_mkfs > $T_TMP.mount.out -scoutfs mkfs -f -Q 0,127.0.0.1,$T_SCRATCH_PORT "$T_EX_META_DEV" "$T_EX_DATA_DEV" > $T_TMP.mkfs.out 2>&1 \ - || t_fail "mkfs failed" echo "== bad devices, bad options" -mount_fail -o _bad /dev/null /dev/null "$SCR" +mount_fail -o _bad /dev/null /dev/null "$T_MSCR" echo "== swapped devices" -mount_fail -o metadev_path=$T_EX_DATA_DEV,quorum_slot_nr=0 "$T_EX_META_DEV" "$SCR" +mount_fail -o metadev_path=$T_EX_DATA_DEV,quorum_slot_nr=0 "$T_EX_META_DEV" "$T_MSCR" echo "== both meta devices" -mount_fail -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_META_DEV" "$SCR" +mount_fail -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_META_DEV" "$T_MSCR" echo "== both data devices" -mount_fail -o metadev_path=$T_EX_DATA_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR" +mount_fail -o metadev_path=$T_EX_DATA_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR" echo "== good volume, bad option and good options" -mount_fail -o _bad,metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR" +mount_fail -o _bad,metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR" t_pass diff --git a/tests/tests/change-devices.sh b/tests/tests/change-devices.sh index 2436c5fa..7f021919 100644 --- a/tests/tests/change-devices.sh +++ b/tests/tests/change-devices.sh @@ -11,9 +11,8 @@ truncate -s $sz "$T_TMP.equal" truncate -s $large_sz "$T_TMP.large" echo "== make scratch fs" -t_quiet scoutfs mkfs -f -Q 0,127.0.0.1,$T_SCRATCH_PORT "$T_EX_META_DEV" "$T_EX_DATA_DEV" -SCR="$T_TMPDIR/mnt.scratch" -mkdir -p "$SCR" +t_scratch_mkfs +mkdir -p "$T_MSCR" echo "== small new data device fails" t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.small" @@ -23,13 +22,13 @@ t_rc scoutfs prepare-empty-data-device --check "$T_EX_META_DEV" "$T_TMP.small" t_rc scoutfs prepare-empty-data-device --check "$T_EX_META_DEV" echo "== preparing while mounted fails" -mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR" +mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR" t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.equal" -umount "$SCR" +umount "$T_MSCR" echo "== preparing without recovery fails" -mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR" -umount -f "$SCR" +mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR" +umount -f "$T_MSCR" t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.equal" echo "== check sees metadata errors" @@ -37,16 +36,16 @@ t_rc scoutfs prepare-empty-data-device --check "$T_EX_META_DEV" t_rc scoutfs prepare-empty-data-device --check "$T_EX_META_DEV" "$T_TMP.equal" echo "== preparing with file data fails" -mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR" -echo hi > "$SCR"/file -umount "$SCR" +mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR" +echo hi > "$T_MSCR"/file +umount "$T_MSCR" scoutfs print "$T_EX_META_DEV" > "$T_TMP.print" t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.equal" echo "== preparing after emptied" -mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR" -rm -f "$SCR"/file -umount "$SCR" +mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR" +rm -f "$T_MSCR"/file +umount "$T_MSCR" t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.equal" echo "== checks pass" @@ -55,22 +54,22 @@ t_rc scoutfs prepare-empty-data-device --check "$T_EX_META_DEV" "$T_TMP.equal" echo "== using prepared" scr_loop=$(losetup --find --show "$T_TMP.equal") -mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$scr_loop" "$SCR" -touch "$SCR"/equal_prepared -equal_tot=$(scoutfs statfs -s total_data_blocks -p "$SCR") -umount "$SCR" +mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$scr_loop" "$T_MSCR" +touch "$T_MSCR"/equal_prepared +equal_tot=$(scoutfs statfs -s total_data_blocks -p "$T_MSCR") +umount "$T_MSCR" losetup -d "$scr_loop" echo "== preparing larger and resizing" t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.large" scr_loop=$(losetup --find --show "$T_TMP.large") -mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$scr_loop" "$SCR" -touch "$SCR"/large_prepared -ls "$SCR" -scoutfs resize-devices -p "$SCR" -d $large_sz -large_tot=$(scoutfs statfs -s total_data_blocks -p "$SCR") +mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$scr_loop" "$T_MSCR" +touch "$T_MSCR"/large_prepared +ls "$T_MSCR" +scoutfs resize-devices -p "$T_MSCR" -d $large_sz +large_tot=$(scoutfs statfs -s total_data_blocks -p "$T_MSCR") test "$large_tot" -gt "$equal_tot" ; echo "resized larger test rc: $?" -umount "$SCR" +umount "$T_MSCR" losetup -d "$scr_loop" echo "== cleanup" diff --git a/tests/tests/enospc.sh b/tests/tests/enospc.sh index 3f4cc1cd..b84b6ae4 100644 --- a/tests/tests/enospc.sh +++ b/tests/tests/enospc.sh @@ -54,21 +54,16 @@ after=$(free_blocks Data "$T_M0") test "$before" == "$after" || \ t_fail "$after free data blocks after rm, expected $before" -# XXX this is all pretty manual, would be nice to have helpers echo "== make small meta fs" # meta device just big enough for reserves and the metadata we'll fill -scoutfs mkfs -A -f -Q 0,127.0.0.1,$T_SCRATCH_PORT -m 10G "$T_EX_META_DEV" "$T_EX_DATA_DEV" > $T_TMP.mkfs.out 2>&1 || \ - t_fail "mkfs failed" -SCR="$T_TMPDIR/mnt.scratch" -mkdir -p "$SCR" -mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 \ - "$T_EX_DATA_DEV" "$SCR" +t_scratch_mkfs -A -m 10G +t_scratch_mount echo "== create large xattrs until we fill up metadata" -mkdir -p "$SCR/xattrs" +mkdir -p "$T_MSCR/xattrs" for f in $(seq 1 100000); do - file="$SCR/xattrs/file-$f" + file="$T_MSCR/xattrs/file-$f" touch "$file" LC_ALL=C create_xattr_loop -c 1000 -n user.scoutfs-enospc -p "$file" -s 65535 > $T_TMP.cxl 2>&1 @@ -84,10 +79,10 @@ for f in $(seq 1 100000); do done echo "== remove files with xattrs after enospc" -rm -rf "$SCR/xattrs" +rm -rf "$T_MSCR/xattrs" echo "== make sure we can create again" -file="$SCR/file-after" +file="$T_MSCR/file-after" C=120 while (( C-- )); do touch $file 2> /dev/null && break @@ -99,7 +94,6 @@ sync rm -f "$file" echo "== cleanup small meta fs" -umount "$SCR" -rmdir "$SCR" +t_scratch_umount t_pass diff --git a/tests/tests/resize-devices.sh b/tests/tests/resize-devices.sh index cceda43c..f3649e3a 100644 --- a/tests/tests/resize-devices.sh +++ b/tests/tests/resize-devices.sh @@ -19,8 +19,8 @@ df_free() { } same_totals() { - cur_meta_tot=$(statfs_total meta "$SCR") - cur_data_tot=$(statfs_total data "$SCR") + cur_meta_tot=$(statfs_total meta "$T_MSCR") + cur_data_tot=$(statfs_total data "$T_MSCR") test "$cur_meta_tot" == "$exp_meta_tot" || \ t_fail "cur total_meta_blocks $cur_meta_tot != expected $exp_meta_tot" @@ -34,10 +34,10 @@ same_totals() { # some slop to account for reserved blocks and concurrent allocation. # devices_grew() { - cur_meta_tot=$(statfs_total meta "$SCR") - cur_data_tot=$(statfs_total data "$SCR") - cur_meta_df=$(df_free MetaData "$SCR") - cur_data_df=$(df_free Data "$SCR") + cur_meta_tot=$(statfs_total meta "$T_MSCR") + cur_data_tot=$(statfs_total data "$T_MSCR") + cur_meta_df=$(df_free MetaData "$T_MSCR") + cur_data_df=$(df_free Data "$T_MSCR") local grow_meta_tot=$(echo "$exp_meta_tot * 2" | bc) local grow_data_tot=$(echo "$exp_data_tot * 2" | bc) @@ -70,19 +70,13 @@ size_data=$(blockdev --getsize64 "$T_EX_DATA_DEV") quarter_meta=$(echo "$size_meta / 4" | bc) quarter_data=$(echo "$size_data / 4" | bc) -# XXX this is all pretty manual, would be nice to have helpers echo "== make initial small fs" -scoutfs mkfs -A -f -Q 0,127.0.0.1,$T_SCRATCH_PORT -m $quarter_meta -d $quarter_data \ - "$T_EX_META_DEV" "$T_EX_DATA_DEV" > $T_TMP.mkfs.out 2>&1 || \ - t_fail "mkfs failed" -SCR="$T_TMPDIR/mnt.scratch" -mkdir -p "$SCR" -mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 \ - "$T_EX_DATA_DEV" "$SCR" +t_scratch_mkfs -A -m $quarter_meta -d $quarter_data +t_scratch_mount # then calculate sizes based on blocks that mkfs used -quarter_meta=$(echo "$(statfs_total meta "$SCR") * 64 * 1024" | bc) -quarter_data=$(echo "$(statfs_total data "$SCR") * 4 * 1024" | bc) +quarter_meta=$(echo "$(statfs_total meta "$T_MSCR") * 64 * 1024" | bc) +quarter_data=$(echo "$(statfs_total data "$T_MSCR") * 4 * 1024" | bc) whole_meta=$(echo "$quarter_meta * 4" | bc) whole_data=$(echo "$quarter_data * 4" | bc) outsize_meta=$(echo "$whole_meta * 2" | bc) @@ -93,59 +87,58 @@ shrink_meta=$(echo "$quarter_meta / 2" | bc) shrink_data=$(echo "$quarter_data / 2" | bc) # and save expected values for checks -exp_meta_tot=$(statfs_total meta "$SCR") -exp_meta_df=$(df_free MetaData "$SCR") -exp_data_tot=$(statfs_total data "$SCR") -exp_data_df=$(df_free Data "$SCR") +exp_meta_tot=$(statfs_total meta "$T_MSCR") +exp_meta_df=$(df_free MetaData "$T_MSCR") +exp_data_tot=$(statfs_total data "$T_MSCR") +exp_data_df=$(df_free Data "$T_MSCR") echo "== 0s do nothing" -scoutfs resize-devices -p "$SCR" -scoutfs resize-devices -p "$SCR" -m 0 -scoutfs resize-devices -p "$SCR" -d 0 -scoutfs resize-devices -p "$SCR" -m 0 -d 0 +scoutfs resize-devices -p "$T_MSCR" +scoutfs resize-devices -p "$T_MSCR" -m 0 +scoutfs resize-devices -p "$T_MSCR" -d 0 +scoutfs resize-devices -p "$T_MSCR" -m 0 -d 0 echo "== shrinking fails" -scoutfs resize-devices -p "$SCR" -m $shrink_meta -scoutfs resize-devices -p "$SCR" -d $shrink_data -scoutfs resize-devices -p "$SCR" -m $shrink_meta -d $shrink_data +scoutfs resize-devices -p "$T_MSCR" -m $shrink_meta +scoutfs resize-devices -p "$T_MSCR" -d $shrink_data +scoutfs resize-devices -p "$T_MSCR" -m $shrink_meta -d $shrink_data same_totals echo "== existing sizes do nothing" -scoutfs resize-devices -p "$SCR" -m $quarter_meta -scoutfs resize-devices -p "$SCR" -d $quarter_data -scoutfs resize-devices -p "$SCR" -m $quarter_meta -d $quarter_data +scoutfs resize-devices -p "$T_MSCR" -m $quarter_meta +scoutfs resize-devices -p "$T_MSCR" -d $quarter_data +scoutfs resize-devices -p "$T_MSCR" -m $quarter_meta -d $quarter_data same_totals echo "== growing outside device fails" -scoutfs resize-devices -p "$SCR" -m $outsize_meta -scoutfs resize-devices -p "$SCR" -d $outsize_data -scoutfs resize-devices -p "$SCR" -m $outsize_meta -d $outsize_data +scoutfs resize-devices -p "$T_MSCR" -m $outsize_meta +scoutfs resize-devices -p "$T_MSCR" -d $outsize_data +scoutfs resize-devices -p "$T_MSCR" -m $outsize_meta -d $outsize_data same_totals echo "== resizing meta works" -scoutfs resize-devices -p "$SCR" -m $half_meta +scoutfs resize-devices -p "$T_MSCR" -m $half_meta devices_grew meta echo "== resizing data works" -scoutfs resize-devices -p "$SCR" -d $half_data +scoutfs resize-devices -p "$T_MSCR" -d $half_data devices_grew data echo "== shrinking back fails" -scoutfs resize-devices -p "$SCR" -m $quarter_meta -scoutfs resize-devices -p "$SCR" -m $quarter_data +scoutfs resize-devices -p "$T_MSCR" -m $quarter_meta +scoutfs resize-devices -p "$T_MSCR" -m $quarter_data same_totals echo "== resizing again does nothing" -scoutfs resize-devices -p "$SCR" -m $half_meta -scoutfs resize-devices -p "$SCR" -m $half_data +scoutfs resize-devices -p "$T_MSCR" -m $half_meta +scoutfs resize-devices -p "$T_MSCR" -m $half_data same_totals echo "== resizing to full works" -scoutfs resize-devices -p "$SCR" -m $whole_meta -d $whole_data +scoutfs resize-devices -p "$T_MSCR" -m $whole_meta -d $whole_data devices_grew meta data echo "== cleanup extra fs" -umount "$SCR" -rmdir "$SCR" +t_scratch_umount t_pass From 0ef22b3c44599f9e1586ec00c3c5e7637c4235df Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 20 Jan 2026 12:31:15 -0800 Subject: [PATCH 3/4] Add basic ACL consistency test case. This test case is used to detect and reproduce a customer issue we're seeing where the new .get_acl() method API and underlying changes in el9_6+ are causing ACL cache fetching to return inconsistent results, which shows as missing ACLs on directories. This particular sequence is consistent enough that it warrants making it into a specific test. Signed-off-by: Auke Kok --- tests/golden/basic-acl-consistency | 6 ++ tests/sequence | 1 + tests/tests/basic-acl-consistency.sh | 117 +++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 tests/golden/basic-acl-consistency create mode 100644 tests/tests/basic-acl-consistency.sh diff --git a/tests/golden/basic-acl-consistency b/tests/golden/basic-acl-consistency new file mode 100644 index 00000000..c890c104 --- /dev/null +++ b/tests/golden/basic-acl-consistency @@ -0,0 +1,6 @@ +== make scratch fs +== create uid/gids +== set acls and permissions +== compare output +== drop caches and compare again +== cleanup scratch fs diff --git a/tests/sequence b/tests/sequence index 18eff7cf..8091b1b1 100644 --- a/tests/sequence +++ b/tests/sequence @@ -2,6 +2,7 @@ export-get-name-parent.sh basic-block-counts.sh basic-bad-mounts.sh basic-posix-acl.sh +basic-acl-consistency.sh inode-items-updated.sh simple-inode-index.sh simple-staging.sh diff --git a/tests/tests/basic-acl-consistency.sh b/tests/tests/basic-acl-consistency.sh new file mode 100644 index 00000000..b8355caa --- /dev/null +++ b/tests/tests/basic-acl-consistency.sh @@ -0,0 +1,117 @@ + +# +# Test basic clustered posix acl consistency. +# + +t_require_commands getfacl setfacl + +GETFACL="getfacl --absolute-names" + +filter_scratch() { + sed "s@$T_MSCR@t_mscr@g" +} + +acl_compare() +{ + diff -u - <($GETFACL $T_MSCR/data/dir_a/dir_b | filter_scratch) < /dev/null 2>&1 +useradd -g 7101 -u 7101 t_usr_1 > /dev/null 2>&1 +groupadd -g 7102 t_grp_2 > /dev/null 2>&1 +groupadd -g 7103 t_grp_3 > /dev/null 2>&1 +useradd -g 7103 -u 7103 t_usr_3 > /dev/null 2>&1 + +echo "== set acls and permissions" +mkdir -p $T_MSCR/data/dir_a/dir_b +chown t_usr_3:t_grp_3 $T_MSCR/data/dir_a/dir_b +chmod 2770 $T_MSCR/data/dir_a/dir_b +setfacl -m g:t_grp_2:rx $T_MSCR/data/dir_a/dir_b +setfacl -m d:g:t_grp_2:rx $T_MSCR/data/dir_a/dir_b +setfacl -m d:g:t_grp_3:rwx $T_MSCR/data/dir_a/dir_b + +mkdir -p $T_MSCR/data/dir_a/dir_b/dir_c +chown t_usr_3:t_grp_2 $T_MSCR/data/dir_a/dir_b/dir_c +setfacl -x g:t_grp_3 $T_MSCR/data/dir_a/dir_b/dir_c + +mkdir -p $T_MSCR/data/dir_a/dir_b/dir_c/dir_d +chown t_usr_1:t_grp_1 $T_MSCR/data/dir_a/dir_b/dir_c/dir_d +setfacl -x g:t_grp_3 $T_MSCR/data/dir_a/dir_b/dir_c/dir_d + +echo "== compare output" +acl_compare + +echo "== drop caches and compare again" +sync +echo 3 > /proc/sys/vm/drop_caches +acl_compare + +echo "== cleanup scratch fs" +t_scratch_umount + +t_pass From 533f309aece60b554b3c7dfddf898833781a4577 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 22 Jan 2026 12:21:15 -0800 Subject: [PATCH 4/4] Switch to .get_inode_acl() to avoid rcu corruption. In el9.6, the kernel VFS no longer goes through xattr handlers to retreive ACLs, but instead calls the FS drivers' .get_{inode_}acl method. In the initial compat version we hooked up to .get_acl given the identical name that was used in the past. However, this results in caching issues, as was encountered by customers and exposed in the added test case `basic-acl-consistency`. The result is that some group ACL entries may appear randomly missing. Dropping caches may temporarily fix the issue. The root cause of the issue is that the VFS now has 2 separate paths to retreive ACL's from the FS driver, and, they have conflicting implications for caching. `.get_acl` is purely meant for filesystems like overlay/ecryptfs where no caching should ever go on as they are fully passthrough only. Filesystems with dentries (i.e. all normal filesystems should not expose this interface, and instead expose the .get_inode_acl method. And indeed, in introducing the new interface, the upstream kernel converts all but a few fs's to use .get_inode_acl(). The functional change in the driver is to detach KC_GET_ACL_DENTRY and introduce KC_GET_INODE_ACL to handle the new (and required) interface. KC_SET_ACL_DENTRY is detached due to it being a different changeset in the kernel and we should separate these for good measure now. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 20 +++++++++++++++----- kmod/src/acl.c | 23 ++++++++++++----------- kmod/src/acl.h | 12 ++++++++---- kmod/src/dir.c | 10 +++++++++- kmod/src/inode.c | 12 ++++++++++-- 5 files changed, 54 insertions(+), 23 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 25a6dd5c..81dc8a58 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -479,10 +479,20 @@ ifneq (,$(shell grep '^unsigned int stack_trace_save' include/linux/stacktrace.h ccflags-y += -DKC_STACK_TRACE_SAVE endif -# v6.1-rc1-4-g7420332a6ff4 # -# .get_acl() method now has dentry arg (and mnt_idmap). The old get_acl has been renamed -# to get_inode_acl() and is still available as well, but has an extra rcu param. -ifneq (,$(shell grep 'struct posix_acl ...get_acl..struct mnt_idmap ., struct dentry' include/linux/fs.h)) -ccflags-y += -DKC_GET_ACL_DENTRY +# v6.1-rc1-2-g138060ba92b3 +# +# set_acl now passed a struct dentry instead of inode. +# +ifneq (,$(shell grep 'int ..set_acl.*struct dentry' include/linux/fs.h)) +ccflags-y += -DKC_SET_ACL_DENTRY +endif + +# +# v6.1-rc1-3-gcac2f8b8d8b5 +# +# get_acl renamed to get_inode_acl. +# +ifneq (,$(shell grep 'struct posix_acl.*get_inode_acl' include/linux/fs.h)) +ccflags-y += -DKC_GET_INODE_ACL endif diff --git a/kmod/src/acl.c b/kmod/src/acl.c index a9a25416..356e3107 100644 --- a/kmod/src/acl.c +++ b/kmod/src/acl.c @@ -107,20 +107,22 @@ struct posix_acl *scoutfs_get_acl_locked(struct inode *inode, int type, struct s return acl; } -#ifdef KC_GET_ACL_DENTRY -struct posix_acl *scoutfs_get_acl(KC_VFS_NS_DEF - struct dentry *dentry, int type) -{ - struct inode *inode = dentry->d_inode; +#ifdef KC_GET_INODE_ACL +struct posix_acl *scoutfs_get_acl(struct inode *inode, int type, bool rcu) #else struct posix_acl *scoutfs_get_acl(struct inode *inode, int type) -{ #endif +{ struct super_block *sb = inode->i_sb; struct scoutfs_lock *lock = NULL; struct posix_acl *acl; int ret; +#ifdef KC_GET_INODE_ACL + if (rcu) + return ERR_PTR(-ECHILD); +#endif + #ifndef KC___POSIX_ACL_CREATE if (!IS_POSIXACL(inode)) return NULL; @@ -208,7 +210,7 @@ out: return ret; } -#ifdef KC_GET_ACL_DENTRY +#ifdef KC_SET_ACL_DENTRY int scoutfs_set_acl(KC_VFS_NS_DEF struct dentry *dentry, struct posix_acl *acl, int type) { @@ -254,9 +256,8 @@ int scoutfs_acl_get_xattr(struct dentry *dentry, const char *name, void *value, if (!IS_POSIXACL(dentry->d_inode)) return -EOPNOTSUPP; -#ifdef KC_GET_ACL_DENTRY - acl = scoutfs_get_acl(KC_VFS_INIT_NS - dentry, type); +#ifdef KC_GET_INODE_ACL + acl = scoutfs_get_acl(dentry->d_inode, type, false); #else acl = scoutfs_get_acl(dentry->d_inode, type); #endif @@ -305,7 +306,7 @@ int scoutfs_acl_set_xattr(struct dentry *dentry, const char *name, const void *v } } -#ifdef KC_GET_ACL_DENTRY +#ifdef KC_SET_ACL_DENTRY ret = scoutfs_set_acl(KC_VFS_INIT_NS dentry, acl, type); #else ret = scoutfs_set_acl(dentry->d_inode, acl, type); diff --git a/kmod/src/acl.h b/kmod/src/acl.h index 09b7b65c..a5bf21d6 100644 --- a/kmod/src/acl.h +++ b/kmod/src/acl.h @@ -1,12 +1,16 @@ #ifndef _SCOUTFS_ACL_H_ #define _SCOUTFS_ACL_H_ -#ifdef KC_GET_ACL_DENTRY -struct posix_acl *scoutfs_get_acl(KC_VFS_NS_DEF struct dentry *dentry, int type); -int scoutfs_set_acl(KC_VFS_NS_DEF struct dentry *dentry, struct posix_acl *acl, int type); +#ifdef KC_SET_ACL_DENTRY +int scoutfs_set_acl(KC_VFS_NS_DEF + struct dentry *dentry, struct posix_acl *acl, int type); +#else +int scoutfs_set_acl(struct inode *inode, struct posix_acl *acl, int type); +#endif +#ifdef KC_GET_INODE_ACL +struct posix_acl *scoutfs_get_acl(struct inode *inode, int type, bool rcu); #else struct posix_acl *scoutfs_get_acl(struct inode *inode, int type); -int scoutfs_set_acl(struct inode *inode, struct posix_acl *acl, int type); #endif struct posix_acl *scoutfs_get_acl_locked(struct inode *inode, int type, struct scoutfs_lock *lock); int scoutfs_set_acl_locked(struct inode *inode, struct posix_acl *acl, int type, diff --git a/kmod/src/dir.c b/kmod/src/dir.c index 09952bf1..d2343e58 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -2006,7 +2006,11 @@ const struct inode_operations scoutfs_symlink_iops = { #ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER .removexattr = generic_removexattr, #endif +#ifdef KC_GET_INODE_ACL + .get_inode_acl = scoutfs_get_acl, +#else .get_acl = scoutfs_get_acl, +#endif #ifndef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER .tmpfile = scoutfs_tmpfile, .rename = scoutfs_rename_common, @@ -2052,8 +2056,12 @@ const struct inode_operations scoutfs_dir_iops = { .removexattr = generic_removexattr, #endif .listxattr = scoutfs_listxattr, +#ifdef KC_GET_INODE_ACL + .get_inode_acl = scoutfs_get_acl, +#else .get_acl = scoutfs_get_acl, -#ifdef KC_GET_ACL_DENTRY +#endif +#ifdef KC_SET_ACL_DENTRY .set_acl = scoutfs_set_acl, #endif .symlink = scoutfs_symlink, diff --git a/kmod/src/inode.c b/kmod/src/inode.c index 740aba5f..a4d118f1 100644 --- a/kmod/src/inode.c +++ b/kmod/src/inode.c @@ -149,8 +149,12 @@ static const struct inode_operations scoutfs_file_iops = { .removexattr = generic_removexattr, #endif .listxattr = scoutfs_listxattr, +#ifdef KC_GET_INODE_ACL + .get_inode_acl = scoutfs_get_acl, +#else .get_acl = scoutfs_get_acl, -#ifdef KC_GET_ACL_DENTRY +#endif +#ifdef KC_SET_ACL_DENTRY .set_acl = scoutfs_set_acl, #endif .fiemap = scoutfs_data_fiemap, @@ -165,8 +169,12 @@ static const struct inode_operations scoutfs_special_iops = { .removexattr = generic_removexattr, #endif .listxattr = scoutfs_listxattr, +#ifdef KC_GET_INODE_ACL + .get_inode_acl = scoutfs_get_acl, +#else .get_acl = scoutfs_get_acl, -#ifdef KC_GET_ACL_DENTRY +#endif +#ifdef KC_SET_ACL_DENTRY .set_acl = scoutfs_set_acl, #endif };