Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-10-16 07:12:09 +0200
committerTakashi Iwai <tiwai@suse.de>2018-10-16 07:12:09 +0200
commitd0d5beed5a7d5479faa7f96b74e58cb175c39ee4 (patch)
tree3466438192ac9b57580df3d97decac22e8cb1c65
parent73c344c298033ded83771d310e3dcbd7dceba409 (diff)
parent90cccba399e5e4c4bfb81d989ce0042fd877a3e1 (diff)
Merge branch 'users/lduncan/SLE15/for-next' into SLE15
Pull scsi fix from Lee Duncan
-rw-r--r--patches.drivers/scsi-target-prefer-dbroot-of-etc-target-over-var-target84
-rw-r--r--series.conf1
2 files changed, 85 insertions, 0 deletions
diff --git a/patches.drivers/scsi-target-prefer-dbroot-of-etc-target-over-var-target b/patches.drivers/scsi-target-prefer-dbroot-of-etc-target-over-var-target
new file mode 100644
index 0000000000..6065e7d69f
--- /dev/null
+++ b/patches.drivers/scsi-target-prefer-dbroot-of-etc-target-over-var-target
@@ -0,0 +1,84 @@
+From: Lee Duncan <lduncan@suse.com>
+Date: Fri, 6 Apr 2018 11:31:41 -0700
+Subject: scsi: target: prefer dbroot of /etc/target over /var/target
+Git-commit: 78a6295c71cb276f8ab0bfc786f3543a4e756a8f
+Patch-mainline: v4.18-rc1
+References: bsc#1111928
+
+The target database root directory, dbroot, has defaulted to /var/target
+for a while, but its main client, targetcli-fb, has been moving it to
+/etc/target for quite some time. With the plethora of target drivers now
+appearing, it has become more difficult to initialize this attribute
+before use by any child drivers.
+
+If the directory /etc/target exists, use that as the DB root. Otherwise,
+fall back to using /var/target.
+
+The ability to override this dbroot attribute still exists via sysfs.
+
+Signed-off-by: Lee Duncan <lduncan@suse.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+---
+ drivers/target/target_core_configfs.c | 25 +++++++++++++++++++++++++
+ drivers/target/target_core_internal.h | 1 +
+ 2 files changed, 26 insertions(+)
+
+--- a/drivers/target/target_core_configfs.c
++++ b/drivers/target/target_core_configfs.c
+@@ -155,6 +155,8 @@ static ssize_t target_core_item_dbroot_s
+
+ mutex_unlock(&g_tf_lock);
+
++ pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);
++
+ return read_bytes;
+ }
+
+@@ -3207,6 +3209,27 @@ void target_setup_backend_cits(struct ta
+ target_core_setup_dev_stat_cit(tb);
+ }
+
++static void target_init_dbroot(void)
++{
++ struct file *fp;
++
++ snprintf(db_root_stage, DB_ROOT_LEN, DB_ROOT_PREFERRED);
++ fp = filp_open(db_root_stage, O_RDONLY, 0);
++ if (IS_ERR(fp)) {
++ pr_err("db_root: cannot open: %s\n", db_root_stage);
++ return;
++ }
++ if (!S_ISDIR(file_inode(fp)->i_mode)) {
++ filp_close(fp, NULL);
++ pr_err("db_root: not a valid directory: %s\n", db_root_stage);
++ return;
++ }
++ filp_close(fp, NULL);
++
++ strncpy(db_root, db_root_stage, DB_ROOT_LEN);
++ pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);
++}
++
+ static int __init target_core_init_configfs(void)
+ {
+ struct configfs_subsystem *subsys = &target_core_fabrics;
+@@ -3287,6 +3310,8 @@ static int __init target_core_init_confi
+ if (ret < 0)
+ goto out;
+
++ target_init_dbroot();
++
+ return 0;
+
+ out:
+--- a/drivers/target/target_core_internal.h
++++ b/drivers/target/target_core_internal.h
+@@ -164,6 +164,7 @@ extern struct se_portal_group xcopy_pt_t
+ /* target_core_configfs.c */
+ #define DB_ROOT_LEN 4096
+ #define DB_ROOT_DEFAULT "/var/target"
++#define DB_ROOT_PREFERRED "/etc/target"
+
+ extern char db_root[];
+
diff --git a/series.conf b/series.conf
index 058c7878ef..7d378ffe44 100644
--- a/series.conf
+++ b/series.conf
@@ -16365,6 +16365,7 @@
patches.drivers/scsi-lpfc-fix-null-pointer-reference-when-resetting-adapter.patch
patches.drivers/scsi-lpfc-correct-missing-remoteport-registration-during-link-bounces.patch
patches.drivers/scsi-lpfc-update-driver-version-to-12-0-0-2.patch
+ patches.drivers/scsi-target-prefer-dbroot-of-etc-target-over-var-target
patches.drivers/scsi-mpt3sas-fix-spelling-mistake-disbale-disable.patch
patches.drivers/scsi-mpt3sas-Bug-fix-for-big-endian-systems.patch
patches.drivers/scsi-mpt3sas-Pre-allocate-RDPQ-Array-at-driver-boot-.patch