OpenAFS Master Repository branch, master, updated. openafs-devel-1_9_2-317-g84534b5
Gerrit Code Review
gerrit@openafs.org
Wed, 10 Sep 2025 01:00:22 -0400
The following commit has been merged in the master branch:
commit 84534b5cf468f93ff1e83c8148af90b011124815
Author: Cheyenne Wills <cwills@sinenomine.net>
Date: Thu Aug 28 09:58:11 2025 -0600
Linux: Use a stable dentry name in d_revalidate
Accessing a stable dentry name (dentry.d_name) directly requires taking
the d_lock, which can only be held for a short periods of time and
cannot be easily used in d_revalidate
The Linux 4.13 commit:
dentry name snapshots (49d31c2f389ac)
provides a utility function, take_dentry_name_snapshot(), that creates a
safe copy of the dentry name.
Update the d_revalidate function to obtain a stable dentry name instead
of making multiple accesses to the dentry name directly in an unsafe
manner.
Create wrapper functions get_stable_dentry_name() and
release_stable_dentry_name() for take_dentry_name_snapshot() and
release_dentry_name_snapshot() to help deal with backward compatibility
with Linux versions prior to the 49d31c2f389ac commit.
For Linux versions where take_dentry_name_snapshot is available, use the
take_dentry_sname_snapshot but also return a pointer to the name that
was obtained (name_snapshot.name).
For Linux versions prior that do not have the take_dentry_name_snapshot
the wrapper function simply returns a pointer to the dentry's
d_name.name, so the existing behavior of accessing the d_name remains
the same.
Add configure checks to determine if take_dentry_name_snapshot exists,
and if so check the datatype used within the name_snapshot structure
to see if it is a qstr or not. (Some distributions backported the
49d31c2f389ac commit for older Linux kernels, but the name_snapshot
structure uses a char * instead of a qstr).
Add a compile time check to ensure that Linux provides
take_dentry_name_snapshot() after 4.13 so errors during 'configure'
don't cause us to silently use the unsafe code path by mistake.
Note: This commit doesn't address the issues of using an unstable d_name
for Linux versions that do not provide the take_dentry_name_snapshot().
For these versions of Linux, there are problems within the Linux code
base itself surrounding the use of the dentry's name.
Change-Id: Ic99b1e5d7667f6841feea78ccf94db43ede40356
Reviewed-on: https://gerrit.openafs.org/16528
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/LINUX/osi_vnodeops.c | 60 +++++++++++++++++++++++++++++++++++++----
src/cf/linux-kernel-assorted.m4 | 7 ++++-
src/cf/linux-kernel-func.m4 | 7 +++++
src/cf/linux-test4.m4 | 14 ++++++++++
4 files changed, 82 insertions(+), 6 deletions(-)
--
OpenAFS Master Repository