Several configfs store callbacks open user-configured paths while holding
the item's frag_sem. If a configured path resolves into configfs, the open
can re-enter __configfs_open_file() and try to acquire the same
non-recursive semaphore again.
Add helpers in configfs for opening non-configfs paths, then use them in the
nvmet file-backed namespace and passthru paths. The series also pins the
target-core db_root path and uses the root-relative helper for ALUA and APTPL
metadata, with a dedicated lock protecting the path and its configuration.
Changes since v6:
- Honor O_NOFOLLOW when resolving paths in configfs_file_open().
- Protect db_root and db_root_path against concurrent metadata writes and
configfs updates.
- Return an error when a db_root update races with target device creation.
Checks:
- scripts/checkpatch.pl --strict: all 4 patches pass.
- Built the affected configfs, nvmet, and target-core objects.
- Applied the complete series to the stated base commit with git am.
Runyu Xiao (4):
fs: configfs: add helpers for opening non-configfs paths
nvmet: avoid recursive configfs open for file-backed namespaces
nvmet: avoid recursive configfs open for passthru
scsi: target: pin db_root for metadata writes
drivers/nvme/target/io-cmd-file.c | 3 +-
drivers/nvme/target/passthru.c | 3 +-
drivers/target/target_core_alua.c | 42 ++++----
drivers/target/target_core_configfs.c | 142 +++++++++++++++++++++-----
drivers/target/target_core_internal.h | 5 +
drivers/target/target_core_pr.c | 19 ++--
fs/configfs/mount.c | 57 +++++++++++
include/linux/configfs.h | 5 +
8 files changed, 219 insertions(+), 57 deletions(-)
base-commit: f741eaa40d2a8e199a31ceb683f30867537def70
--
2.34.1