Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: target: reject configfs db_root for ALUA metadata
@ 2026-08-18  4:27 Runyu Xiao
  2026-08-18  4:40 ` sashiko-bot
  2026-08-18  5:14 ` [PATCH v2] scsi: target: pin db_root for metadata writes Runyu Xiao
  0 siblings, 2 replies; 5+ messages in thread
From: Runyu Xiao @ 2026-08-18  4:27 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: Nicholas Bellinger, Lee Duncan, linux-scsi, target-devel,
	linux-kernel, stable, Runyu Xiao, Jianhao Xu

The db_root configfs attribute only validates that the supplied path
resolves to a directory. Later ALUA metadata writes build file names
under db_root and open them with filp_open().

If db_root itself points at a configfs mount, an ALUA transition that
updates metadata can re-enter configfs through that filp_open() path
while configfs is still servicing the original store. That makes the
metadata path recurse back into the same frag_sem.

Reject configfs-backed db_root values in target_core_item_dbroot_store()
so later metadata users keep running on a normal filesystem instead of
re-entering configfs.

Fixes: a96e9783e058 ("target: make target db location configurable")
Cc: stable@vger.kernel.org
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
 drivers/target/target_core_configfs.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index a2bd2e8..5ee6f9c 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -138,8 +138,16 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
 			pr_err("db_root: not a directory: %s\n", db_root_stage);
 		goto unlock;
 	}
+	if (!strcmp(path.dentry->d_sb->s_type->name, "configfs")) {
+		pr_err("db_root: configfs is not a valid target database root: %s\n",
+		       db_root_stage);
+		r = -EINVAL;
+	}
 	path_put(&path);

+	if (r)
+		goto unlock;
+
 	strscpy(db_root, db_root_stage);
 	pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);

-- 
2.34.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-23 11:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18  4:27 [PATCH] scsi: target: reject configfs db_root for ALUA metadata Runyu Xiao
2026-08-18  4:40 ` sashiko-bot
2026-08-18  5:14 ` [PATCH v2] scsi: target: pin db_root for metadata writes Runyu Xiao
2026-08-21 12:20   ` kernel test robot
2026-08-23 11:43   ` lkp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox