mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@redhat.com>
To: Ben Collins <bcollins@debian.org>, marcelo.tosatti@cyclades.com.br
Cc: linux1394-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, James Goodwin <jamesg@filanet.com>
Subject: patch for 2.4.22 sbp2 hang when loaded with devices already connected
Date: 20 Oct 2003 22:40:23 -0200	[thread overview]
Message-ID: <orbrsba0eg.fsf@free.redhat.lsd.ic.unicamp.br> (raw)
In-Reply-To: <ord6csra7h.fsf@free.redhat.lsd.ic.unicamp.br>

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

We were free()ing a packet before sbp2_agent_reset() had a chance to
wake up on its semaphore, which would often cause sbp2 to hang in
`initializing' state if it was loaded when firewire devices were
already connected to the host.  Details of the symptoms at
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=103821

This patch fixes it.  I guess Ben likes it because he sent me a very
similar patch to test just as I was finishing testing this one :-)

Thanks, Ben, for helping me figure out what was going on!

Please Cc: me on replies, as I'm not subscribed.  In fact, I'm not
even sure my posting will make it to the lists.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sbp2-init.patch --]
[-- Type: text/x-patch, Size: 2285 bytes --]

--- /usr/src/linux-2.4/drivers/ieee1394/sbp2.c	2003-08-25 08:44:42.000000000 -0300
+++ drivers/ieee1394/sbp2.c	2003-10-20 22:16:17.000000000 -0200
@@ -372,8 +372,10 @@ static int sbp2util_down_timeout(atomic_
 }
 
 /* Free's an allocated packet */
-static void sbp2_free_packet(struct hpsb_packet *packet)
+static void sbp2_free_packet(void *packet_)
 {
+	struct hpsb_packet *packet = packet_;
+
 	hpsb_free_tlabel(packet);
 	free_hpsb_packet(packet);
 }
@@ -389,7 +391,8 @@ static struct hpsb_packet *
 sbp2util_allocate_write_packet(struct sbp2scsi_host_info *hi,
 			       struct node_entry *ne, u64 addr,
 			       size_t data_size,
-			       quadlet_t *data)
+			       quadlet_t *data,
+			       int keep)
 {
 	struct hpsb_packet *packet;
 
@@ -399,8 +402,10 @@ sbp2util_allocate_write_packet(struct sb
         if (!packet)
                 return NULL;
 
-	hpsb_set_packet_complete_task(packet, (void (*)(void*))sbp2_free_packet,
-				      packet);
+	if (!keep)
+		hpsb_set_packet_complete_task(packet,
+					      sbp2_free_packet,
+					      packet);
 
 	hpsb_node_fill_packet(ne, packet);
 
@@ -1763,7 +1768,7 @@ static int sbp2_agent_reset(struct scsi_
 	packet = sbp2util_allocate_write_packet(hi, scsi_id->ne,
 						scsi_id->sbp2_command_block_agent_addr +
 						SBP2_AGENT_RESET_OFFSET,
-						4, &data);
+						4, &data, wait);
 
 	if (!packet) {
 		SBP2_ERR("sbp2util_allocate_write_packet failed");
@@ -1779,6 +1784,7 @@ static int sbp2_agent_reset(struct scsi_
 	if (wait) {
 		down(&packet->state_change);
 		down(&packet->state_change);
+		sbp2_free_packet(packet); 
 	}
 
 	/*
@@ -2073,7 +2079,7 @@ static int sbp2_link_orb_command(struct 
 
 			packet = sbp2util_allocate_write_packet(hi, scsi_id->ne,
 								scsi_id->sbp2_command_block_agent_addr +
-								SBP2_ORB_POINTER_OFFSET, 8, NULL);
+								SBP2_ORB_POINTER_OFFSET, 8, NULL, 0);
 		
 			if (!packet) {
 				SBP2_ERR("sbp2util_allocate_write_packet failed");
@@ -2123,7 +2129,7 @@ static int sbp2_link_orb_command(struct 
 
 			packet = sbp2util_allocate_write_packet(hi, scsi_id->ne,
 					scsi_id->sbp2_command_block_agent_addr +
-					SBP2_DOORBELL_OFFSET, 4, &data);
+					SBP2_DOORBELL_OFFSET, 4, &data, 0);
 	
 			if (!packet) {
 				SBP2_ERR("sbp2util_allocate_write_packet failed");

[-- Attachment #3: Type: text/plain, Size: 289 bytes --]


-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

       reply	other threads:[~2003-10-21  0:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ord6csra7h.fsf@free.redhat.lsd.ic.unicamp.br>
2003-10-21  0:40 ` Alexandre Oliva [this message]
2003-10-21  1:06   ` Ben Collins
2003-10-21  1:37     ` Alexandre Oliva
2003-10-21  1:46       ` Ben Collins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=orbrsba0eg.fsf@free.redhat.lsd.ic.unicamp.br \
    --to=aoliva@redhat.com \
    --cc=bcollins@debian.org \
    --cc=jamesg@filanet.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=marcelo.tosatti@cyclades.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome