git-scsi-misc: fix SCSI_DH build errors
Subsystems (3)
PATCH 4/16 git-scsi-misc: fix SCSI_DH build errors
From: Chandra Seetharaman <[email protected]>
Do not automatically "select" SCSI_DH for dm-multipath. If SCSI_DH doesn't exist, just do not allow hardware handlers to be used.
Handle SCSI_DH being a module also. Make sure it doesn't allow DM_MULTIPATH to be compiled in when SCSI_DH is a module.
---
drivers/md/Kconfig | 2 +- drivers/md/dm-mpath.c | 2 ++ include/scsi/scsi_dh.h | 12 +++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-)
drivers/md/Kconfig renamed from drivers/md/Kconfig~git-scsi-misc-fix-scsi_dh-build-errors +1 -1
@@ -252,7 +252,7 @@ config DM_ZERO config DM_MULTIPATH tristate "Multipath target" depends on BLK_DEV_DM - select SCSI_DH + depends on SCSI_DH || !SCSI_DH ---help--- Allow volume managers to support multipath hardware.
drivers/md/dm-mpath.c renamed from drivers/md/dm-mpath.c~git-scsi-misc-fix-scsi_dh-build-errors +2 -0
@@ -664,6 +664,8 @@ static int parse_hw_handler(struct arg_srequest_module ("scsi_dh_%s" , m->hw_handler_name);if (scsi_dh_handler_exist (m->hw_handler_name) ==0 ) { ti->error ="unknown hardware handler type" ; +kfree (m->hw_handler_name); + m->hw_handler_name =NULL ;return -EINVAL ; }consume (as, hw_argc -1 );
include/scsi/scsi_dh.h renamed from include/scsi/scsi_dh.h~git-scsi-misc-fix-scsi_dh-build-errors +11 -1
@@ -54,6 +54,16 @@ enum {SCSI_DH_NOSYS , SCSI_DH_DRIVER_MAX, }; - +#if defined(CONFIG_SCSI_DH ) || defined(CONFIG_SCSI_DH_MODULE )extern int scsi_dh_activate (struct request_queue *);extern int scsi_dh_handler_exist (const char *); +#else +static inline int scsi_dh_activate (struct request_queue *req) +{ +return 0 ; +} +static inline int scsi_dh_handler_exist (const char *name) +{ +return 0 ; +} +#endif
_
James Bottomley
maintainerQuoted 28 lines · On Thu, 2008-07-03 at 23:47 -0700, [email protected] wrote:
From: Chandra Seetharaman <[email protected]>
Do not automatically "select"
SCSI_DHfor dm-multipath. IfSCSI_DHdoesn't exist, just do not allow hardware handlers to be used.Handle
SCSI_DHbeing a module also. Make sure it doesn't allowDM_MULTIPATHto be compiled in whenSCSI_DHis a module.Signed-off-by Chandra Seetharaman <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by Andrew Morton <[email protected]>Cc James Bottomley <[email protected]>Cc Alasdair G Kergon <[email protected]>Cc Mike Christie <[email protected]>Cc Mike Anderson <[email protected]>Cc Hannes Reinecke <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/md/Kconfig | 2 +- drivers/md/dm-mpath.c | 2 ++ include/scsi/scsi_dh.h | 12 +++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-)diff -puN
drivers/md/Kconfig~git-scsi-misc-fix-scsi_dh-build-errorsdrivers/md/Kconfig
drivers/md/Kconfig config DM_ZERO · line 255
Quoted 5 lines
drivers/md/Kconfig renamed from drivers/md/Kconfig~git-scsi-misc-fix-scsi_dh-build-errors +1
-1@@ -252,7 +252,7 @@ config DM_ZERO config DM_MULTIPATH tristate "Multipath target" depends on BLK_DEV_DM - select SCSI_DH + depends on SCSI_DH || !SCSI_DH
This is a bit horrible. It's not very obvious what it means and it critically depends on the current !m == m behaviour.
drivers/md/dm-mpath.c static int parse_hw_handler(struct arg_s · line 668
Quoted 12 lines
drivers/md/Kconfig renamed from drivers/md/Kconfig~git-scsi-misc-fix-scsi_dh-build-errors +0
-0---help--- Allow volume managers to support multipath hardware.diff -puN
drivers/md/dm-mpath.c~git-scsi-misc-fix-scsi_dh-build-errorsdrivers/md/dm-mpath.cdrivers/md/dm-mpath.c renamed from drivers/md/dm-mpath.c~git-scsi-misc-fix-scsi_dh-build-errors +2
-0@@ -664,6 +664,8 @@ static int parse_hw_handler(struct arg_srequest_module ("scsi_dh_%s" , m->hw_handler_name);if (scsi_dh_handler_exist (m->hw_handler_name) ==0 ) { ti->error ="unknown hardware handler type" ; +kfree (m->hw_handler_name); + m->hw_handler_name =NULL ;
This looks like some type of separate bug fix ... it's certainly not mentioned in the change log and has nothing to do with modular compile problems.
James
Quoted 25 lines · James Bottomley
Quoted 24 lines · On Thu, 2008-07-03 at 23:47 -0700, [email protected] wrote:
From: Chandra Seetharaman <[email protected]>
Do not automatically "select"
SCSI_DHfor dm-multipath. IfSCSI_DHdoesn't exist, just do not allow hardware handlers to be used.Handle
SCSI_DHbeing a module also. Make sure it doesn't allowDM_MULTIPATHto be compiled in whenSCSI_DHis a module.Signed-off-by Chandra Seetharaman <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by Andrew Morton <[email protected]>Cc James Bottomley <[email protected]>Cc Alasdair G Kergon <[email protected]>Cc Mike Christie <[email protected]>Cc Mike Anderson <[email protected]>Cc Hannes Reinecke <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/md/Kconfig | 2 +- drivers/md/dm-mpath.c | 2 ++ include/scsi/scsi_dh.h | 12 +++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-)
Quoted 12 lines
drivers/md/Kconfig config DM_ZERO · line 255
Quoted 9 lines
diff -puN
drivers/md/Kconfig~git-scsi-misc-fix-scsi_dh-build-errorsdrivers/md/Kconfigdrivers/md/Kconfig renamed from drivers/md/Kconfig~git-scsi-misc-fix-scsi_dh-build-errors +1
-1@@ -252,7 +252,7 @@ config DM_ZERO config DM_MULTIPATH tristate "Multipath target" depends on BLK_DEV_DM - select SCSI_DH + depends on SCSI_DH || !SCSI_DHThis is a bit horrible. It's not very obvious what it means and it critically depends on the current !m == m behaviour.
I couldn't find other way to solve this dependency. Will look into that again.
Quoted 4 lines
Quoted 4 lines
drivers/md/Kconfig renamed from drivers/md/Kconfig~git-scsi-misc-fix-scsi_dh-build-errors +0
-0---help--- Allow volume managers to support multipath hardware.
Quoted 13 lines
drivers/md/dm-mpath.c static int parse_hw_handler(struct arg_s · line 668
Quoted 9 lines
diff -puN
drivers/md/dm-mpath.c~git-scsi-misc-fix-scsi_dh-build-errorsdrivers/md/dm-mpath.cdrivers/md/dm-mpath.c renamed from drivers/md/dm-mpath.c~git-scsi-misc-fix-scsi_dh-build-errors +2
-0@@ -664,6 +664,8 @@ static int parse_hw_handler(struct arg_srequest_module ("scsi_dh_%s" , m->hw_handler_name);if (scsi_dh_handler_exist (m->hw_handler_name) ==0 ) { ti->error ="unknown hardware handler type" ; +kfree (m->hw_handler_name); + m->hw_handler_name =NULL ;This looks like some type of separate bug fix ... it's certainly not mentioned in the change log and has nothing to do with modular compile problems.
That is true. I can create a separate patch for this.
Quoted 8 lines
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
James, Andrew,
I couldn't find a way to remove that weird "depends" line by just working with Kconfig rules.
Attached is a patch that removes the weird depends with some code movements and Makefile changes. Let me know if you think it is worth.
regards,
chandra
Quoted 55 lines · James Bottomley
Quoted 28 lines · On Thu, 2008-07-03 at 23:47 -0700, [email protected] wrote:
From: Chandra Seetharaman <[email protected]>
Do not automatically "select"
SCSI_DHfor dm-multipath. IfSCSI_DHdoesn't exist, just do not allow hardware handlers to be used.Handle
SCSI_DHbeing a module also. Make sure it doesn't allowDM_MULTIPATHto be compiled in whenSCSI_DHis a module.Signed-off-by Chandra Seetharaman <[email protected]>Reported-by Randy Dunlap <[email protected]>Reported-by Andrew Morton <[email protected]>Cc James Bottomley <[email protected]>Cc Alasdair G Kergon <[email protected]>Cc Mike Christie <[email protected]>Cc Mike Anderson <[email protected]>Cc Hannes Reinecke <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/md/Kconfig | 2 +- drivers/md/dm-mpath.c | 2 ++ include/scsi/scsi_dh.h | 12 +++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-)diff -puN
drivers/md/Kconfig~git-scsi-misc-fix-scsi_dh-build-errorsdrivers/md/Kconfigdrivers/md/Kconfig config DM_ZERO · line 255
Quoted 5 lines
drivers/md/Kconfig renamed from drivers/md/Kconfig~git-scsi-misc-fix-scsi_dh-build-errors +1
-1@@ -252,7 +252,7 @@ config DM_ZERO config DM_MULTIPATH tristate "Multipath target" depends on BLK_DEV_DM - select SCSI_DH + depends on SCSI_DH || !SCSI_DHThis is a bit horrible. It's not very obvious what it means and it critically depends on the current !m == m behaviour.
drivers/md/dm-mpath.c static int parse_hw_handler(struct arg_s · line 668
Quoted 12 lines
drivers/md/Kconfig renamed from drivers/md/Kconfig~git-scsi-misc-fix-scsi_dh-build-errors +0
-0---help--- Allow volume managers to support multipath hardware.diff -puN
drivers/md/dm-mpath.c~git-scsi-misc-fix-scsi_dh-build-errorsdrivers/md/dm-mpath.cdrivers/md/dm-mpath.c renamed from drivers/md/dm-mpath.c~git-scsi-misc-fix-scsi_dh-build-errors +2
-0@@ -664,6 +664,8 @@ static int parse_hw_handler(struct arg_srequest_module ("scsi_dh_%s" , m->hw_handler_name);if (scsi_dh_handler_exist (m->hw_handler_name) ==0 ) { ti->error ="unknown hardware handler type" ; +kfree (m->hw_handler_name); + m->hw_handler_name =NULL ;This looks like some type of separate bug fix ... it's certainly not mentioned in the change log and has nothing to do with modular compile problems.
Quoted 7 lines
James
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Remove the wierd depends line for DM_MULTIPATH, and move the scsi_dh interfaces to a dummpy file.
--- drivers/Makefile | 2 drivers/md/Kconfig | 1 drivers/scsi/Makefile | 2 drivers/scsi/device_handler/Makefile | 1 drivers/scsi/device_handler/scsi_dh.c | 32 +++++++++++---- drivers/scsi/device_handler/scsi_dh_dummy.c | 57 ++++++++++++++++++++++++++++ include/scsi/scsi_dh.h | 8 +++ 7 files changed, 91 insertions(+), 12 deletions(-)
drivers/md/Kconfig +0 -1
@@ -252,7 +252,6 @@ config DM_ZERO config DM_MULTIPATH tristate "Multipath target" depends on BLK_DEV_DM - depends on SCSI_DH || !SCSI_DH ---help--- Allow volume managers to support multipath hardware.
drivers/scsi/device_handler/Makefile +1 -0
@@ -1,6 +1,7 @@ # # SCSI Device Handler # +obj-y += scsi_dh_dummy.o obj-$(CONFIG_SCSI_DH) += scsi_dh.o obj-$(CONFIG_SCSI_DH_RDAC) += scsi_dh_rdac.o obj-$(CONFIG_SCSI_DH_HP_SW) += scsi_dh_hp_sw.o
drivers/scsi/device_handler/scsi_dh.c +23 -9
@@ -116,12 +116,12 @@ done:EXPORT_SYMBOL_GPL (scsi_unregister_device_handler);/* -* scsi_dh_activate - activate the path associated with the scsi_device +* __scsi_dh_activate - activate the path associated with the scsi_device * corresponding to the given request queue. -* @q - Request queue that is associated with the scsi_device to be -* activated. +* q - Request queue that is associated with the scsi_device to be +* activated. */ -int scsi_dh_activate (struct request_queue *q) +static int __scsi_dh_activate (struct request_queue *q) {int err =0 ;unsigned long flags;
@@ -144,18 +144,32 @@ int scsi_dh_activate(struct request_queuput_device (&sdev->sdev_gendev);return err; } -EXPORT_SYMBOL_GPL (scsi_dh_activate);/* -* scsi_dh_handler_exist - Return TRUE(1) if a device handler exists for +* __scsi_dh_handler_exist - Return TRUE(1) if a device handler exists for * the given name. FALSE(0) otherwise. -* @name - name of the device handler. +* name - name of the device handler. */ -int scsi_dh_handler_exist (const char *name) +static int __scsi_dh_handler_exist (const char *name) {return (get_device_handler (name) !=NULL ); } -EXPORT_SYMBOL_GPL (scsi_dh_handler_exist); + +static int __init scsi_dh_init (void ) +{ + ops.activate = __scsi_dh_activate; + ops.handler_exist = __scsi_dh_handler_exist; +return 0 ; +} + +static void __init scsi_dh_exit (void ) +{ + ops.activate =NULL ; + ops.handler_exist =NULL ; +} + +module_init (scsi_dh_init); +module_exit (scsi_dh_exit);MODULE_DESCRIPTION ("SCSI device handler" );MODULE_AUTHOR ("Chandra Seetharaman <[email protected]>" );
drivers/scsi/device_handler/scsi_dh_dummy.c new file +57 -0
57 lines not on this page · raw message
include/scsi/scsi_dh.h +8 -0
@@ -54,7 +54,15 @@ enum {SCSI_DH_NOSYS , SCSI_DH_DRIVER_MAX, }; +#if defined(CONFIG_SCSI_DH ) || defined(CONFIG_SCSI_DH_MODULE ) +struct scsi_dh_ops { +int (*activate) (struct request_queue *); +int (*handler_exist) (const char *); +}; + +extern struct scsi_dh_ops ops; +extern int scsi_dh_activate (struct request_queue *);extern int scsi_dh_handler_exist (const char *);#else
drivers/scsi/Makefile +1 -1
@@ -34,7 +34,7 @@ obj-$(CONFIG_SCSI_ISCSI_ATTRS) += scsi_t obj-$(CONFIG_SCSI_SAS_ATTRS) += scsi_transport_sas.o obj-$(CONFIG_SCSI_SAS_LIBSAS) += libsas/ obj-$(CONFIG_SCSI_SRP_ATTRS) += scsi_transport_srp.o -obj-$(CONFIG_SCSI_DH) += device_handler/ +obj-y += device_handler/ obj-$(CONFIG_ISCSI_TCP) += libiscsi.o iscsi_tcp.o obj-$(CONFIG_INFINIBAND_ISER) += libiscsi.o
drivers/Makefile +1 -1
@@ -35,7 +35,7 @@ obj-$(CONFIG_NUBUS) += nubus/ obj-$(CONFIG_ATM) += atm/ obj-y += macintosh/ obj-$(CONFIG_IDE) += ide/ -obj-$(CONFIG_SCSI) += scsi/ +obj-y += scsi/ obj-$(CONFIG_ATA) += ata/ obj-$(CONFIG_FUSION) += message/ obj-$(CONFIG_FIREWIRE) += firewire/