[PATCH] zfcp: updates for -bk

2005-01-24 Thread Heiko Carstens
Hi James,

could you please apply the patch below?

Thanks,
Heiko

From: Heiko Carstens [EMAIL PROTECTED]
From: Andreas Herrmann [EMAIL PROTECTED]
From: Maxim Shchetynin [EMAIL PROTECTED]

zfcp changes:
 - revert kfree patch leftovers
 - don't call del_timer_sync() in interrupt context
 - correct residual count handling for data underruns
 - mark LUN as ACCESS_DENIED on status LUN_SHARING_VIOLATION

Signed-off-by: Heiko Carstens [EMAIL PROTECTED]

diffstat:
 drivers/s390/scsi/zfcp_aux.c|   37 ++--
 drivers/s390/scsi/zfcp_def.h|   13 +---
 drivers/s390/scsi/zfcp_erp.c|6 ++---
 drivers/s390/scsi/zfcp_ext.h|2 -
 drivers/s390/scsi/zfcp_fsf.c|   31 --
 drivers/s390/scsi/zfcp_sysfs_port.c |7 --
 drivers/s390/scsi/zfcp_sysfs_unit.c |7 --
 7 files changed, 56 insertions(+), 47 deletions(-)

diff -urN a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
--- a/drivers/s390/scsi/zfcp_aux.c  2004-12-24 22:35:49.0 +0100
+++ b/drivers/s390/scsi/zfcp_aux.c  2005-01-24 09:45:48.0 +0100
@@ -29,7 +29,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define ZFCP_AUX_REVISION $Revision: 1.145 $
+#define ZFCP_AUX_REVISION $Revision: 1.147 $
 
 #include zfcp_ext.h
 
@@ -1099,9 +1099,9 @@
 }
 
 void
-zfcp_dummy_release(struct device *dev)
+zfcp_generic_services_release(struct device *dev)
 {
-   return;
+   kfree(dev);
 }
 
 /*
@@ -1119,6 +1119,7 @@
 {
int retval = 0;
struct zfcp_adapter *adapter;
+   struct device *gs;
 
/*
 * Note: It is safe to release the list_lock, as any list changes 
@@ -1195,13 +1196,19 @@
if (zfcp_sysfs_adapter_create_files(ccw_device-dev))
goto sysfs_failed;
 
-   adapter-generic_services.parent = adapter-ccw_device-dev;
-   adapter-generic_services.release = zfcp_dummy_release;
-   snprintf(adapter-generic_services.bus_id, BUS_ID_SIZE,
-generic_services);
+   gs = kmalloc(sizeof(struct device), GFP_KERNEL);
+   if (!gs)
+   goto gs_failed;
+   memset(gs, 0, sizeof(struct device));
+
+   gs-parent = adapter-ccw_device-dev;
+   gs-release = zfcp_generic_services_release;
+   snprintf(gs-bus_id, BUS_ID_SIZE, generic_services);
+
+   if (device_register(gs))
+   goto gs_free;
 
-   if (device_register(adapter-generic_services))
-   goto generic_services_failed;
+   adapter-generic_services = gs;
 
/* put allocated adapter at list tail */
write_lock_irq(zfcp_data.config_lock);
@@ -1213,7 +1220,9 @@
 
goto out;
 
- generic_services_failed:
+ gs_free:
+   kfree(gs);
+ gs_failed:
zfcp_sysfs_adapter_remove_files(adapter-ccw_device-dev);
  sysfs_failed:
dev_set_drvdata(ccw_device-dev, NULL);
@@ -1245,7 +1254,7 @@
int retval = 0;
unsigned long flags;
 
-   device_unregister(adapter-generic_services);
+   device_unregister(adapter-generic_services);
zfcp_sysfs_adapter_remove_files(adapter-ccw_device-dev);
dev_set_drvdata(adapter-ccw_device-dev, NULL);
/* sanity check: no pending FSF requests */
@@ -1370,13 +1379,13 @@
return NULL;
}
port-d_id = d_id;
-   port-sysfs_device.parent = adapter-generic_services;
+   port-sysfs_device.parent = adapter-generic_services;
} else {
snprintf(port-sysfs_device.bus_id,
 BUS_ID_SIZE, 0x%016llx, wwpn);
-   port-sysfs_device.parent = adapter-ccw_device-dev;
+   port-sysfs_device.parent = adapter-ccw_device-dev;
}
-   port-sysfs_device.release = zfcp_sysfs_port_release;
+   port-sysfs_device.release = zfcp_sysfs_port_release;
dev_set_drvdata(port-sysfs_device, port);
 
/* mark port unusable as long as sysfs registration is not complete */
diff -urN a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
--- a/drivers/s390/scsi/zfcp_def.h  2004-12-24 22:34:58.0 +0100
+++ b/drivers/s390/scsi/zfcp_def.h  2005-01-24 09:47:52.0 +0100
@@ -34,7 +34,7 @@
 #ifndef ZFCP_DEF_H
 #define ZFCP_DEF_H
 
-#define ZFCP_DEF_REVISION $Revision: 1.111 $
+#define ZFCP_DEF_REVISION $Revision: 1.115 $
 
 /*** INCLUDES 
*/
 
@@ -903,14 +903,9 @@
spinlock_t  dbf_lock;
struct zfcp_adapter_mempool pool;  /* Adapter memory pools */
struct qdio_initialize  qdio_init_data;/* for qdio_establish */
-   struct device   generic_services;  /* directory for WKA ports */
+   struct device   *generic_services; /* directory for WKA ports */
 };
 
-/*
- * the struct device sysfs_device must be at the beginning of this structure.
- * pointer 

[PATCH] add iSCSI session creation sysfs attributes

2005-01-24 Thread Mike Christie
The attached patch built against scsi-misc-2.6 moves the
target iSCSI attributes to a new structure representing
a iSCSI session. The reason for doing this is to
create a interface that allows the Sourceforge iSCSI driver
to create and setup a session through sysfs (no more
IOCTL at all in our driver), display session info, and at the same
time share code and use the same interface HW iSCSI drivers would
use.
Here is an example using the interface. There is
one LLD specifc attribute that was placed
on our own class, becuase I was not sure if I could
put it on the transport class (it could be stuck
on the iscsi_host class in future patches). It is the
initial /sys/class/iscsi_sfnet/add_host that is used to
add a scsi host, since we do not have a pci_driver and probe
function like normal HW drivers. The rest of the
attrs are on the iSCSI transport classes and are used
for both read and write operations, so the interface
can be used for session creation and info passing.
[EMAIL PROTECTED] class]# echo 1  iscsi_sfnet/add_host
[EMAIL PROTECTED] host11]# ls
add_session  device  initiator_alias  initiator_name
[EMAIL PROTECTED] host11]# echo -n iqn.1987-05.com.ibm  
iscsi_host/host11/initiator_name
[EMAIL PROTECTED] iscsi_host]# echo 1  host11/add_session
[EMAIL PROTECTED] host11]# ls
add_session  device  initiator_alias  initiator_name  session2
[EMAIL PROTECTED] class]# ls -l iscsi_session/session2/
total 0
--w---  1 root root 4096 Jan 24 00:40 close_session
-rw-r--r--  1 root root 4096 Jan 24 00:40 data_digest
--w---  1 root root 4096 Jan 24 00:40 establish_session
-rw-r--r--  1 root root 4096 Jan 24 00:40 first_burst_len
-rw-r--r--  1 root root 4096 Jan 24 00:40 header_digest
-rw-r--r--  1 root root 4096 Jan 24 00:40 immediate_data
-rw-r--r--  1 root root 4096 Jan 24 00:40 initial_r2t
-rw-r--r--  1 root root 4096 Jan 24 00:40 ip_address
-rw-r--r--  1 root root 4096 Jan 24 00:40 isid
-rw-r--r--  1 root root 4096 Jan 24 00:40 max_burst_len
-rw-r--r--  1 root root 4096 Jan 24 00:40 max_recv_data_segment_len
-rw-r--r--  1 root root 4096 Jan 24 00:40 port
--w---  1 root root 4096 Jan 24 00:40 remove_session
lrwxrwxrwx  1 root root0 Jan 24 00:40 host11 - 
../../../class/iscsi_host/host11
-r--r--r--  1 root root 4096 Jan 24 00:40 target_alias
-rw-r--r--  1 root root 4096 Jan 24 00:40 target_name
-rw-r--r--  1 root root 4096 Jan 24 00:40 tpgt
-rw-r--r--  1 root root 4096 Jan 24 00:40 tsih
[EMAIL PROTECTED] class]# echo -n iqn.1992-08.com.netapp:sn.99918398  
iscsi_session/session2/target_name
[EMAIL PROTECTED] class]# echo -n 192.168.1.3  
iscsi_session/session2/ip_address
[EMAIL PROTECTED] class]# echo 1  iscsi_session/session2/establish_session
[EMAIL PROTECTED] class]# echo 1  iscsi_session/session2/remove_session
[EMAIL PROTECTED] class]# echo 1  scsi_host/host11/remove
Chap and update are temporarily disabled, but
will be added soon if this interface is ok. Also
there are no userspace tools yet... You have to
set things up by hand until I get some time :(
The Sourceforge iSCSI driver to use with the attached patch is here
http://www.cs.wisc.edu/~michaelc/iscsi/current/1-24-2005-scsi-misc/iscsi-sfnet-4.0.1.11-1.patch.gz
and was also built against scsi-misc-2.6. This patch removes the IOCTL
and removes the driver's session list.
diff -aurp scsi-misc-2.6/drivers/scsi/scsi_transport_iscsi.c scsi-misc-2.6.test/drivers/scsi/scsi_transport_iscsi.c
--- scsi-misc-2.6/drivers/scsi/scsi_transport_iscsi.c	2005-01-24 01:59:29.0 -0800
+++ scsi-misc-2.6.test/drivers/scsi/scsi_transport_iscsi.c	2005-01-24 02:11:45.0 -0800
@@ -19,14 +19,15 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 #include linux/module.h
+#include linux/inet.h
 #include scsi/scsi.h
 #include scsi/scsi_host.h
 #include scsi/scsi_device.h
 #include scsi/scsi_transport.h
 #include scsi/scsi_transport_iscsi.h
 
-#define ISCSI_SESSION_ATTRS 20
-#define ISCSI_HOST_ATTRS 2
+#define ISCSI_SESSION_ATTRS 24
+#define ISCSI_HOST_ATTRS 3
 
 struct iscsi_internal {
 	struct scsi_transport_template t;
@@ -34,21 +35,61 @@ struct iscsi_internal {
 	/*
 	 * We do not have any private or other attrs.
 	 */
-	struct class_device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1];
+	struct attribute *session_attrs[ISCSI_SESSION_ATTRS + 1];
+	struct attribute_group session_attr_group;
 	struct class_device_attribute *host_attrs[ISCSI_HOST_ATTRS + 1];
+
+	struct list_head shosts;
+	struct semaphore sem;
 };
 
 #define to_iscsi_internal(tmpl) container_of(tmpl, struct iscsi_internal, t)
 
-static void iscsi_transport_class_release(struct class_device *class_dev)
+static void iscsi_session_class_release(struct class_device *cdev)
 {
-	struct scsi_target *starget = transport_class_to_starget(class_dev);
-	put_device(starget-dev);
-}
+	struct iscsi_class_session *session = transport_class_to_session(cdev);
+	struct Scsi_Host *shost = session-shost;
+	struct iscsi_internal *i = 

Re: [PATCH] zfcp: updates for -bk

2005-01-24 Thread Matthew Wilcox
On Mon, Jan 24, 2005 at 10:46:29AM +0100, Heiko Carstens wrote:
 @@ -1099,9 +1099,9 @@
  }
  
  void
 -zfcp_dummy_release(struct device *dev)
 +zfcp_generic_services_release(struct device *dev)
  {
 - return;
 + kfree(dev);
  }
  
  /*

I thought that having release methods that just called kfree() were
also verboten?

-- 
Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception. -- Mark Twain
-
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


Re: [PATCH] zfcp: updates for -bk

2005-01-24 Thread James Bottomley
On Mon, 2005-01-24 at 15:48 +0100, Heiko Carstens wrote:
  I thought that having release methods that just called kfree() were
  also verboten?
 
 We do a kmalloc(sizeof(struce device),...) somewhere and this 
 is how we get rid of it again.
 How are we supposed to free this object otherwise? The release
 function gets called when there is no more reference to this
 object and that's the earliest point we may free it.

Right, but we've said before this is the wrong way to do it.

Originally this generic device was part of your adapter structure.  Now
you're trying to separate it and causing these problems.  What it's
apparently telling us is that you have some problem with the object
lifetime rules in your code.

Why should this generic_services device have different lifetime rules
from the object in which it used to reside?

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


Re: [PATCH] add iSCSI session creation sysfs attributes

2005-01-24 Thread James Bottomley
On Mon, 2005-01-24 at 02:39 -0800, Mike Christie wrote:
 The attached patch built against scsi-misc-2.6 moves the
 target iSCSI attributes to a new structure representing
 a iSCSI session. The reason for doing this is to
 create a interface that allows the Sourceforge iSCSI driver
 to create and setup a session through sysfs (no more
 IOCTL at all in our driver), display session info, and at the same
 time share code and use the same interface HW iSCSI drivers would
 use.

This no longer applies to the iscsi transport class because I converted
it over to the generic framework.  Could you look at the code in

bk://linux-scsi.bkbits.net/scsi-rc-fixes-2.6 (or the patch on
www.parisc-linux.org/~jejb/scsi_diffs)

and reroll your patch against that?

Thanks,

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


mptfusion: delete watchdogs timers from mptctl and mptscsih

2005-01-24 Thread Moore, Eric Dean
Here is a patch for mpt fusion drivers, which
removes the watchdog timers from mptctl/mptscsih.
The patch and changelog follows.

Pls note, this patch should be applied against
a recent patch from Andi Kleen Add compat_ioctl to mptctl 
before applying this patch. Andi's patch was applied against.
bk://linux-scsi.bkbits.net/scsi-misc-2.6 

Change log:

1) mptscsih.c: I have changed task management 
requests so they complete in same thread before returning
to os.  I removed the TMtimer code.  
 
(2) mptctl.c: I have deleted both TMtimer and timer code. Replaced
with wait_event_interruptible_timeout.  So commands are now
completed in same thread.  
 
(3) mptctl_do_fw_download - nasty polling of global parameters
that are set in contents of interrupt handler(mptctl_reply), now using
wait_event_interruptible_timeout. 
 
(4) I have cleaned up mptctl_reply.

Signed-off-by: Eric Moore [EMAIL PROTECTED]






mptlinux-3.01.19.patch
Description: Binary data


Re: [PATCH] zfcp: updates for -bk

2005-01-24 Thread Heiko Carstens
   I thought that having release methods that just called kfree() were
   also verboten?
  We do a kmalloc(sizeof(struce device),...) somewhere and this 
  is how we get rid of it again.
  How are we supposed to free this object otherwise? The release
  function gets called when there is no more reference to this
  object and that's the earliest point we may free it.
 Right, but we've said before this is the wrong way to do it.

I think I missed something. What Greg objected to was that we had used
kfree as the release function. Also he objected to the point that we
were using the pointer to the struct device, which gets passed to the
release function, to free different (larger) objects by using the simple
hack to place the struct device at the beginning of other structs.
This patch does nothing like this. Actually it cleans just all those
things and leftovers up.

 Originally this generic device was part of your adapter structure.  Now
 you're trying to separate it and causing these problems.  What it's

Could you please elaborate where this patch does cause a problem?

 apparently telling us is that you have some problem with the object
 lifetime rules in your code.
 Why should this generic_services device have different lifetime rules
 from the object in which it used to reside?

It doesn't. And this was not supposed to fix anything. It's just that
Andreas liked the code better with allocating the generic_services
struct device seperately. Please note that the lifetime of the adapter
device this struct device was embedded into is always longer than the
lifetime of the generic_services device.
Therefore I can't see why you complain about this piece of code.

Since I didn't get an answer to this:
http://marc.theaimsgroup.com/?l=linux-scsim=110551973013105w=2
my assumption was that it's that obvious to everyone else that I'm
wrong that it isn't even worth writing an answer.
Now I follow Greg's rules and still get complaints...

Thanks,
Heiko

-
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