dm mpath: rdac fix init race

2007-10-19 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c7ac86de6a1bcb1b59c83e19b0d0d64a59604ade
Commit: c7ac86de6a1bcb1b59c83e19b0d0d64a59604ade
Parent: 60812a4a99b796d894d2522dc63cb0fafc3be25e
Author: Bryn M. Reeves [EMAIL PROTECTED]
AuthorDate: Fri Oct 19 22:29:32 2007 +0100
Committer:  Alasdair G Kergon [EMAIL PROTECTED]
CommitDate: Sat Oct 20 02:00:57 2007 +0100

dm mpath: rdac fix init race

Re-order the initialisation of dm-rdac to avoid registering the hw
handler before the workqueue has been initialised. Closes a race
that would potentially give an oops.

Signed-off-by: Bryn M. Reeves [EMAIL PROTECTED]
Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED]
---
 drivers/md/dm-mpath-rdac.c |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-mpath-rdac.c b/drivers/md/dm-mpath-rdac.c
index 16b1613..e04eb5c 100644
--- a/drivers/md/dm-mpath-rdac.c
+++ b/drivers/md/dm-mpath-rdac.c
@@ -664,20 +664,21 @@ static struct hw_handler_type rdac_handler = {
 
 static int __init rdac_init(void)
 {
-   int r = dm_register_hw_handler(rdac_handler);
-
-   if (r  0) {
-   DMERR(%s: register failed %d, RDAC_DM_HWH_NAME, r);
-   return r;
-   }
+   int r;
 
rdac_wkqd = create_singlethread_workqueue(rdac_wkqd);
if (!rdac_wkqd) {
DMERR(Failed to create workqueue rdac_wkqd.);
-   dm_unregister_hw_handler(rdac_handler);
return -ENOMEM;
}
 
+   r = dm_register_hw_handler(rdac_handler);
+   if (r  0) {
+   DMERR(%s: register failed %d, RDAC_DM_HWH_NAME, r);
+   destroy_workqueue(rdac_wkqd);
+   return r;
+   }
+
DMINFO(%s: version %s loaded, RDAC_DM_HWH_NAME, RDAC_DM_HWH_VER);
return 0;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


dm mpath: rdac

2007-07-12 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dd172d72addefd89795e819cc2cc3eb1b9d12a7f
Commit: dd172d72addefd89795e819cc2cc3eb1b9d12a7f
Parent: fc1ff9588a6d56258ff9576a31aa34f17757c666
Author: Chandra Seetharaman [EMAIL PROTECTED]
AuthorDate: Thu Jul 12 17:30:05 2007 +0100
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Thu Jul 12 15:01:23 2007 -0700

dm mpath: rdac

This patch supports LSI/Engenio devices in RDAC mode. Like dm-emc
it requires userspace support. In your multipath.conf file you must have:

path_checkerrdac
hardware_handler1 rdac
prio_callout/sbin/mpath_prio_tpc /dev/%n

And you also then must have a updated multipath tools release which
has rdac support.

Signed-off-by: Chandra Seetharaman [EMAIL PROTECTED]
Signed-off-by: Mike Christie [EMAIL PROTECTED]
Signed-off-by: Alasdair G Kergon [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/md/Kconfig |6 +
 drivers/md/Makefile|2 +
 drivers/md/dm-mpath-rdac.c |  700 
 3 files changed, 708 insertions(+), 0 deletions(-)

diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
index 7df934d..466909f 100644
--- a/drivers/md/Kconfig
+++ b/drivers/md/Kconfig
@@ -262,6 +262,12 @@ config DM_MULTIPATH_EMC
---help---
  Multipath support for EMC CX/AX series hardware.
 
+config DM_MULTIPATH_RDAC
+   tristate LSI/Engenio RDAC multipath support (EXPERIMENTAL)
+   depends on DM_MULTIPATH  BLK_DEV_DM  EXPERIMENTAL
+   ---help---
+ Multipath support for LSI/Engenio RDAC.
+
 config DM_DELAY
tristate I/O delaying target (EXPERIMENTAL)
depends on BLK_DEV_DM  EXPERIMENTAL
diff --git a/drivers/md/Makefile b/drivers/md/Makefile
index 3875408..2c45d76 100644
--- a/drivers/md/Makefile
+++ b/drivers/md/Makefile
@@ -7,6 +7,7 @@ dm-mod-objs := dm.o dm-table.o dm-target.o dm-linear.o 
dm-stripe.o \
 dm-multipath-objs := dm-hw-handler.o dm-path-selector.o dm-mpath.o
 dm-snapshot-objs := dm-snap.o dm-exception-store.o
 dm-mirror-objs := dm-log.o dm-raid1.o
+dm-rdac-objs   := dm-mpath-rdac.o
 md-mod-objs := md.o bitmap.o
 raid456-objs   := raid5.o raid6algos.o raid6recov.o raid6tables.o \
   raid6int1.o raid6int2.o raid6int4.o \
@@ -34,6 +35,7 @@ obj-$(CONFIG_DM_CRYPT)+= dm-crypt.o
 obj-$(CONFIG_DM_DELAY) += dm-delay.o
 obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o
 obj-$(CONFIG_DM_MULTIPATH_EMC) += dm-emc.o
+obj-$(CONFIG_DM_MULTIPATH_RDAC)+= dm-rdac.o
 obj-$(CONFIG_DM_SNAPSHOT)  += dm-snapshot.o
 obj-$(CONFIG_DM_MIRROR)+= dm-mirror.o
 obj-$(CONFIG_DM_ZERO)  += dm-zero.o
diff --git a/drivers/md/dm-mpath-rdac.c b/drivers/md/dm-mpath-rdac.c
new file mode 100644
index 000..8b776b8
--- /dev/null
+++ b/drivers/md/dm-mpath-rdac.c
@@ -0,0 +1,700 @@
+/*
+ * Engenio/LSI RDAC DM HW handler
+ *
+ * Copyright (C) 2005 Mike Christie. All rights reserved.
+ * Copyright (C) Chandra Seetharaman, IBM Corp. 2007
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+#include scsi/scsi.h
+#include scsi/scsi_cmnd.h
+#include scsi/scsi_eh.h
+
+#define DM_MSG_PREFIX multipath rdac
+
+#include dm.h
+#include dm-hw-handler.h
+
+#define RDAC_DM_HWH_NAME rdac
+#define RDAC_DM_HWH_VER 0.4
+
+/*
+ * LSI mode page stuff
+ *
+ * These struct definitions and the forming of the
+ * mode page were taken from the LSI RDAC 2.4 GPL'd
+ * driver, and then converted to Linux conventions.
+ */
+#define RDAC_QUIESCENCE_TIME 20;
+/*
+ * Page Codes
+ */
+#define RDAC_PAGE_CODE_REDUNDANT_CONTROLLER 0x2c
+
+/*
+ * Controller modes definitions
+ */
+#define RDAC_MODE_TRANSFER_ALL_LUNS0x01
+#define RDAC_MODE_TRANSFER_SPECIFIED_LUNS  0x02
+
+/*
+ * RDAC Options field
+ */
+#define RDAC_FORCED_QUIESENCE 0x02
+
+#define RDAC_FAILOVER_TIMEOUT (60 * HZ)
+
+struct rdac_mode_6_hdr {
+   u8  data_len;
+   u8  medium_type;
+   u8  device_params;
+   u8  block_desc_len;
+};
+
+struct rdac_mode_10_hdr {
+   u16 data_len;
+   u8  medium_type;
+   u8  device_params;
+   u16