All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche@wdc.com>
To: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Damien Le Moal <Damien.LeMoal@wdc.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "hch@lst.de" <hch@lst.de>, "hare@suse.de" <hare@suse.de>
Subject: Re: [PATCH 2/2] sd_zbc: Write unlock zones from sd_uninit_cmnd()
Date: Fri, 4 Aug 2017 15:47:23 +0000	[thread overview]
Message-ID: <1501861640.2757.9.camel@wdc.com> (raw)
In-Reply-To: <20170804075237.2089-3-damien.lemoal@wdc.com>

On Fri, 2017-08-04 at 16:52 +0900, Damien Le Moal wrote:
> Releasing the write lock of a zone when the write commnand that
> acquired the lock completes can cause deadlocks with scsi-mq due to
> potential queue reordering if the lock owning request is requeued and
> not executed.
> 
> Since sd_uninit_cmnd() is always called when a request is requeued,
> call sd_zbc_write_unlock_zone() from that function for write requests
> that acquired a zone lock. Acquisition of a zone lock by a write command
> is indicated using the new command flag SCMD_ZONE_WRITE_LOCK.
> 
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>

Hello Damien,

Should "Cc: <stable@vger.kernel.org>" be added to this patch?

> diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
> index 96855df9f49d..6423ae70477e 100644
> --- a/drivers/scsi/sd_zbc.c
> +++ b/drivers/scsi/sd_zbc.c
> @@ -294,6 +294,9 @@ int sd_zbc_write_lock_zone(struct scsi_cmnd *cmd)
>  	    test_and_set_bit(zno, sdkp->zones_wlock))
>  		return BLKPREP_DEFER;
>  
> +	WARN_ON(cmd->flags & SCMD_ZONE_WRITE_LOCK);
> +	cmd->flags |= SCMD_ZONE_WRITE_LOCK;
> +
>  	return BLKPREP_OK;
>  }

Did you perhaps intend WARN_ON_ONCE() instead of WARN_ON()?

Thanks,

Bart.

  reply	other threads:[~2017-08-04 15:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04  7:52 [PATCH 0/2 V2] Zoned block device support fixes Damien Le Moal
2017-08-04  7:52 ` [PATCH 1/2] block: Zoned block device single-threaded submission Damien Le Moal
2017-08-04 15:54   ` Bart Van Assche
2017-08-05 11:34   ` Christoph Hellwig
2017-08-07  6:15     ` Damien Le Moal
2017-08-04  7:52 ` [PATCH 2/2] sd_zbc: Write unlock zones from sd_uninit_cmnd() Damien Le Moal
2017-08-04 15:47   ` Bart Van Assche [this message]
2017-08-05 11:34   ` 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=1501861640.2757.9.camel@wdc.com \
    --to=bart.vanassche@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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.