Re: [PATCH v3] scsi: target: fix recursive locking in __configfs_open_file()

From: Al Viro

Date: Thu Feb 05 2026 - 14:25:07 EST


On Thu, Feb 05, 2026 at 09:56:24PM +0530, Prithvi Tambewagh wrote:

> + r = kern_path(db_root_stage, LOOKUP_FOLLOW, &path);
> + if (r) {
> pr_err("db_root: cannot open: %s\n", db_root_stage);
> goto unlock;
> }
> - if (!S_ISDIR(file_inode(fp)->i_mode)) {
> - filp_close(fp, NULL);
> + if (!d_is_dir(path.dentry)) {
> + path_put(&path);
> pr_err("db_root: not a directory: %s\n", db_root_stage);
> + r = -ENOTDIR;
> goto unlock;
> }
> - filp_close(fp, NULL);
> + path_put(&path);

Just pass it LOOKUP_FOLLOW | LOOKUP_DIRECTORY and be done with the manual
"is it a directory" tests in any form...