All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: James Bottomley <jejb@linux.vnet.ibm.com>
Cc: Wei Fang <fangwei1@huawei.com>,
	tj@kernel.org, martin.petersen@oracle.com,
	linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: fix race between simultaneous decrements of ->host_failed
Date: Sun, 29 May 2016 11:06:49 -0700	[thread overview]
Message-ID: <20160529180649.GA6486@infradead.org> (raw)
In-Reply-To: <1464536473.2287.6.camel@linux.vnet.ibm.com>

On Sun, May 29, 2016 at 08:41:13AM -0700, James Bottomley wrote:
> Actually, it doesn't look fine at all.  The same mechanism that's
> supposed to protect the host_failed decrement is also supposed to
> protect the list_move_tail().  If there's a problem with the former
> then we're also in danger of corrupting the list.

No, that's not the case.  eh_entry is used for two things:

 a) shost->eh_cmd_q, which is used to queue up command for the EH
    thread, and is locked using the host lock.
 b) various on-stack lists in the EH thread

scsi_eh_finish_cmd is only called for case b) as all EH thread
implementations move the commands from eh_cmd_q to a local list
as the very first thing.

host_fail on the other hand is incremented under the host_lock
in scsi_eh_scmd_add, but decremented without any lock from the
EH thread.

  reply	other threads:[~2016-05-29 18:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-28  3:51 [PATCH] scsi: fix race between simultaneous decrements of ->host_failed Wei Fang
2016-05-29  6:54 ` Christoph Hellwig
2016-05-29 15:41   ` James Bottomley
2016-05-29 18:06     ` Christoph Hellwig [this message]
2016-05-29 19:15       ` James Bottomley
2016-05-30  7:27     ` Wei Fang
2016-05-30 16:04       ` James Bottomley
2016-05-30  7:43   ` Wei Fang
2016-05-30 19:10     ` Christoph Hellwig

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=20160529180649.GA6486@infradead.org \
    --to=hch@infradead.org \
    --cc=fangwei1@huawei.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=tj@kernel.org \
    /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.