All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	Martin Petermann <martin@linux.vnet.ibm.com>,
	Christof Schmitt <christof.schmitt@de.ibm.com>
Subject: [patch 08/15] zfcp: remove unit will fail if add unit is not finished
Date: Fri, 17 Apr 2009 15:08:08 +0200	[thread overview]
Message-ID: <20090417131122.870131000@de.ibm.com> (raw)
In-Reply-To: 20090417130800.923944000@de.ibm.com

[-- Attachment #1: 708-zfcp-remove-unit.diff --]
[-- Type: text/plain, Size: 1379 bytes --]

From: Martin Petermann <martin@linux.vnet.ibm.com>

On some hardware it can take some time to add a unit. If
some remove this unit during this process the remove will
fail.

Signed-off-by: Martin Petermann <martin@linux.vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
---

 drivers/s390/scsi/zfcp_sysfs.c |   21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

--- a/drivers/s390/scsi/zfcp_sysfs.c	2009-04-17 15:03:20.000000000 +0200
+++ b/drivers/s390/scsi/zfcp_sysfs.c	2009-04-17 15:03:42.000000000 +0200
@@ -254,12 +254,21 @@ static ssize_t zfcp_sysfs_unit_remove_st
 
 	write_lock_irq(&zfcp_data.config_lock);
 	unit = zfcp_get_unit_by_lun(port, fcp_lun);
-	if (unit && (atomic_read(&unit->refcount) == 0)) {
-		zfcp_unit_get(unit);
-		atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status);
-		list_move(&unit->list, &unit_remove_lh);
-	} else
-		unit = NULL;
+	if (unit) {
+		write_unlock_irq(&zfcp_data.config_lock);
+		/* wait for possible timeout during SCSI probe */
+		flush_work(&unit->scsi_work);
+		write_lock_irq(&zfcp_data.config_lock);
+
+		if (atomic_read(&unit->refcount) == 0) {
+			zfcp_unit_get(unit);
+			atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE,
+					&unit->status);
+			list_move(&unit->list, &unit_remove_lh);
+		} else {
+			unit = NULL;
+		}
+	}
 
 	write_unlock_irq(&zfcp_data.config_lock);
 

  parent reply	other threads:[~2009-04-17 13:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17 13:08 [patch 00/15] zfcp fixes for 2.6.30-rc2 Christof Schmitt
2009-04-17 13:08 ` [patch 01/15] zfcp: Avoid referencing freed memory in req send Christof Schmitt
2009-04-17 13:08 ` [patch 02/15] zfcp: Enable auto-port discovery for NPIV Christof Schmitt
2009-04-17 13:08 ` [patch 03/15] zfcp: Dont call zfcp_fsf_req_free on NULL pointer Christof Schmitt
2009-04-17 13:08 ` [patch 04/15] zfcp: Dont block zfcp_wq with scan Christof Schmitt
2009-04-17 13:08 ` [patch 05/15] zfcp: Set WKA-port to offline on adapter deactivation Christof Schmitt
2009-04-17 13:08 ` [patch 06/15] zfcp: avoid false ERP complete due to sema race Christof Schmitt
2009-04-17 13:08 ` [patch 07/15] zfcp: no port recovery after storage side error inject Christof Schmitt
2009-04-17 13:08 ` Christof Schmitt [this message]
2009-04-17 13:08 ` [patch 09/15] zfcp: Let actcli handle control file errors Christof Schmitt
2009-04-17 13:08 ` [patch 10/15] zfcp: no port recovery after ADISC request timeout Christof Schmitt
2009-04-17 13:08 ` [patch 11/15] zfcp: Fix abort handler for completions in progress Christof Schmitt
2009-04-17 13:08 ` [patch 12/15] zfcp: revert previous patch for sbal counting Christof Schmitt
2009-04-17 13:08 ` [patch 13/15] zfcp: Fix port reference counting Christof Schmitt
2009-04-17 13:08 ` [patch 14/15] zfcp: Reference counting for cfdc requests Christof Schmitt
2009-04-17 13:08 ` [patch 15/15] zfcp: Fix oops when port disappears Christof Schmitt

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=20090417131122.870131000@de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin@linux.vnet.ibm.com \
    --cc=schwidefsky@de.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.