linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: James Bottomley <james.bottomley@hansenpartnership.com>
Cc: Christoph Hellwig <hch@lst.de>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Mike Snitzer <snitzer@redhat.com>,
	linux-scsi@vger.kernel.org
Subject: [PATCH 08/10] scsi_dh: don't allow to detach device handlers at runtime
Date: Thu, 27 Aug 2015 14:17:01 +0200	[thread overview]
Message-ID: <1440677823-11695-9-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1440677823-11695-1-git-send-email-hare@suse.de>

From: Christoph Hellwig <hch@lst.de>

The I/O submission and completion pathes call into the device handler
without any synchronization agains detachment.  So disallow detaching
device handlers at runtime.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/scsi_dh.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c
index 489083c..954ca5e 100644
--- a/drivers/scsi/scsi_dh.c
+++ b/drivers/scsi/scsi_dh.c
@@ -180,8 +180,10 @@ store_dh_state(struct device *dev, struct device_attribute *attr,
 			/*
 			 * Detach from a device handler
 			 */
-			scsi_dh_handler_detach(sdev);
-			err = 0;
+			sdev_printk(KERN_WARNING, sdev,
+				    "can't detach handler %s.\n",
+				    sdev->handler->name);
+			err = -EINVAL;
 		} else if (!strncmp(buf, "activate", 8)) {
 			/*
 			 * Activate a device handler
-- 
1.8.5.6


  parent reply	other threads:[~2015-08-27 12:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27 12:16 [PATCH 00/10] Integrate scsi_dh better into the scsi core V4 Hannes Reinecke
2015-08-27 12:16 ` [PATCH 01/10] dm-mpath, scsi_dh: don't let dm detach device handlers Hannes Reinecke
2015-08-27 12:16 ` [PATCH 02/10] dm-mpath, scsi_dh: request scsi_dh modules in scsi_dh, not dm-mpath Hannes Reinecke
2015-08-28 19:53   ` James Bottomley
2015-08-31  6:39     ` Hannes Reinecke
2015-08-27 12:16 ` [PATCH 03/10] scsi_dh: move to drivers/scsi Hannes Reinecke
2015-08-27 12:16 ` [PATCH 04/10] scsi_dh: integrate into the core SCSI code Hannes Reinecke
2015-08-27 12:16 ` [PATCH 05/10] scsi_dh: move device matching to the core code Hannes Reinecke
2015-08-27 12:16 ` [PATCH 06/10] scsi_dh: kill struct scsi_dh_data Hannes Reinecke
2015-08-27 12:17 ` [PATCH 07/10] scsi_dh: add a common helper to get a scsi_device from a request_queue Hannes Reinecke
2015-08-27 12:17 ` Hannes Reinecke [this message]
2015-08-27 12:17 ` [PATCH 09/10] scsi_dh: return SCSI_DH_NOTCONN in scsi_dh_activate() Hannes Reinecke
2015-08-27 12:17 ` [PATCH 10/10] scsi_dh: move 'dh_state' sysfs attribute to generic code Hannes Reinecke
2015-08-28 20:14   ` James Bottomley
2015-09-01  9:35   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2015-07-08  8:30 [PATCH 00/10] Integrate scsi_dh better into the scsi core V4 Hannes Reinecke
2015-07-08  8:30 ` [PATCH 08/10] scsi_dh: don't allow to detach device handlers at runtime Hannes Reinecke

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=1440677823-11695-9-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=snitzer@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).