LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* linux-next: manual merge of the scsi tree with the block tree
@ 2021-08-24  6:32 Stephen Rothwell
  2021-08-24  6:39 ` Christoph Hellwig
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Rothwell @ 2021-08-24  6:32 UTC (permalink / raw)
  To: James Bottomley, Jens Axboe
  Cc: Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List, Martin K. Petersen

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

Hi all,

Today's linux-next merge of the scsi tree got a conflict in:

  drivers/scsi/st.c

between commit:

  45938335d0a9 ("st: do not allocate a gendisk")

from the block tree and commits:

  dba7688fc903 ("scsi: st: Simplify ioctl handling")
  2e27f576abc6 ("scsi: scsi_ioctl: Call scsi_cmd_ioctl() from scsi_ioctl()")

from the scsi tree.

I fixed it up (I think, see below) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging.  You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/scsi/st.c
index d1abc020f3c0,2d1b0594af69..000000000000
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@@ -3815,35 -3821,24 +3816,24 @@@ static long st_ioctl(struct file *file
  		goto out;
  	}
  	mutex_unlock(&STp->lock);
- 	switch (cmd_in) {
- 		case SCSI_IOCTL_STOP_UNIT:
- 			/* unload */
- 			retval = scsi_ioctl(STp->device, cmd_in, p);
- 			if (!retval) {
- 				STp->rew_at_close = 0;
- 				STp->ready = ST_NO_TAPE;
- 			}
- 			return retval;
  
- 		case SCSI_IOCTL_GET_IDLUN:
- 		case SCSI_IOCTL_GET_BUS_NUMBER:
- 			break;
+ 	switch (cmd_in) {
+ 	case SG_IO:
+ 	case SCSI_IOCTL_SEND_COMMAND:
+ 	case CDROM_SEND_PACKET:
+ 		if (!capable(CAP_SYS_RAWIO))
+ 			return -EPERM;
+ 	default:
+ 		break;
+ 	}
  
- 		default:
- 			if ((cmd_in == SG_IO ||
- 			     cmd_in == SCSI_IOCTL_SEND_COMMAND ||
- 			     cmd_in == CDROM_SEND_PACKET) &&
- 			    !capable(CAP_SYS_RAWIO))
- 				i = -EPERM;
- 			else
- 				i = scsi_cmd_ioctl(STp->device->request_queue,
- 						   NULL, file->f_mode, cmd_in,
- 						   p);
- 			if (i != -ENOTTY)
- 				return i;
- 			break;
 -	retval = scsi_ioctl(STp->device, STp->disk, file->f_mode, cmd_in, p);
++	retval = scsi_ioctl(STp->device, NULL, file->f_mode, cmd_in, p);
+ 	if (!retval && cmd_in == SCSI_IOCTL_STOP_UNIT) {
+ 		/* unload */
+ 		STp->rew_at_close = 0;
+ 		STp->ready = ST_NO_TAPE;
  	}
- 	return -ENOTTY;
+ 	return retval;
  
   out:
  	mutex_unlock(&STp->lock);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: linux-next: manual merge of the scsi tree with the block tree
  2021-08-24  6:32 linux-next: manual merge of the scsi tree with the block tree Stephen Rothwell
@ 2021-08-24  6:39 ` Christoph Hellwig
  0 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2021-08-24  6:39 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: James Bottomley, Jens Axboe, Christoph Hellwig,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Martin K. Petersen

Thanks Stephen,

the resolution looks good to me.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* linux-next: manual merge of the scsi tree with the block tree
@ 2022-03-07  4:18 Stephen Rothwell
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Rothwell @ 2022-03-07  4:18 UTC (permalink / raw)
  To: James Bottomley, Jens Axboe
  Cc: Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List, Martin K. Petersen

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

Hi all,

Today's linux-next merge of the scsi tree got a conflict in:

  drivers/block/drbd/drbd_worker.c

between commit:

  472278508dce ("drbd: use bvec_kmap_local in drbd_csum_bio")

from the block tree and commit:

  a34592ff6b78 ("scsi: drbd: Remove WRITE_SAME support")

from the scsi tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/block/drbd/drbd_worker.c
index 1b48c8172a07,934bfb5d98d0..000000000000
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@@ -326,14 -326,9 +326,9 @@@ void drbd_csum_bio(struct crypto_shash 
  	bio_for_each_segment(bvec, bio, iter) {
  		u8 *src;
  
 -		src = kmap_atomic(bvec.bv_page);
 -		crypto_shash_update(desc, src + bvec.bv_offset, bvec.bv_len);
 -		kunmap_atomic(src);
 +		src = bvec_kmap_local(&bvec);
 +		crypto_shash_update(desc, src, bvec.bv_len);
 +		kunmap_local(src);
- 
- 		/* REQ_OP_WRITE_SAME has only one segment,
- 		 * checksum the payload only once. */
- 		if (bio_op(bio) == REQ_OP_WRITE_SAME)
- 			break;
  	}
  	crypto_shash_final(desc, digest);
  	shash_desc_zero(desc);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* linux-next: manual merge of the scsi tree with the block tree
@ 2022-03-07  4:14 Stephen Rothwell
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Rothwell @ 2022-03-07  4:14 UTC (permalink / raw)
  To: James Bottomley, Jens Axboe
  Cc: Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List, Martin K. Petersen

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

Hi all,

Today's linux-next merge of the scsi tree got a conflict in:

  block/blk-merge.c

between commit:

  6928b8f7eafa ("block: remove the per-bio/request write hint")

from the block tree and commit:

  73bd66d9c834 ("scsi: block: Remove REQ_OP_WRITE_SAME support")

from the scsi tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc block/blk-merge.c
index 0e871d4e7cb8,87cee7e82ae1..000000000000
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@@ -778,10 -749,13 +747,6 @@@ static struct request *attempt_merge(st
  	if (rq_data_dir(req) != rq_data_dir(next))
  		return NULL;
  
- 	if (req_op(req) == REQ_OP_WRITE_SAME &&
- 	    !blk_write_same_mergeable(req->bio, next->bio))
 -	/*
 -	 * Don't allow merge of different write hints, or for a hint with
 -	 * non-hint IO.
 -	 */
 -	if (req->write_hint != next->write_hint)
--		return NULL;
--
  	if (req->ioprio != next->ioprio)
  		return NULL;
  
@@@ -903,11 -877,13 +868,6 @@@ bool blk_rq_merge_ok(struct request *rq
  	if (!bio_crypt_rq_ctx_compatible(rq, bio))
  		return false;
  
- 	/* must be using the same buffer */
- 	if (req_op(rq) == REQ_OP_WRITE_SAME &&
- 	    !blk_write_same_mergeable(rq->bio, bio))
 -	/*
 -	 * Don't allow merge of different write hints, or for a hint with
 -	 * non-hint IO.
 -	 */
 -	if (rq->write_hint != bio->bi_write_hint)
--		return false;
--
  	if (rq->ioprio != bio_prio(bio))
  		return false;
  

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* linux-next: manual merge of the scsi tree with the block tree
@ 2021-11-01  5:08 Stephen Rothwell
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Rothwell @ 2021-11-01  5:08 UTC (permalink / raw)
  To: James Bottomley, Jens Axboe
  Cc: Bart Van Assche, Christoph Hellwig, Jaegeuk Kim,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Martin K. Petersen

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

Hi all,

Today's linux-next merge of the scsi tree got a conflict in:

  drivers/scsi/ufs/ufshcd.c

between commit:

  0bf6d96cb829 ("block: remove blk_{get,put}_request")

from the block tree and commit:

  edc0596cc04b ("scsi: ufs: core: Stop clearing UNIT ATTENTIONS")

from the scsi tree.

I fixed it up (the latter removed some of the code modified by the former)
and can carry the fix as necessary. This is now fixed as far as linux-next
is concerned, but any non trivial conflicts should be mentioned to your
upstream maintainer when your tree is submitted for merging.  You may
also want to consider cooperating with the maintainer of the conflicting
tree to minimise any particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* linux-next: manual merge of the scsi tree with the block tree
@ 2020-03-25  5:04 Stephen Rothwell
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Rothwell @ 2020-03-25  5:04 UTC (permalink / raw)
  To: James Bottomley, Jens Axboe
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Christoph Hellwig, Mauro Carvalho Chehab

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

Hi all,

Today's linux-next merge of the scsi tree got a conflict in:

  Documentation/scsi/scsi_mid_low_api.txt

between commit:

  a10183d744fb ("scsi: simplify scsi_partsize")

from the block tree and commit:

  ce5c5d6503c9 ("scsi: docs: convert scsi_mid_low_api.txt to ReST")

from the scsi tree.

I fixed it up (I deleted that file and added the following merge fix
patch) and can carry the fix as necessary. This is now fixed as far as
linux-next is concerned, but any non trivial conflicts should be
mentioned to your upstream maintainer when your tree is submitted for
merging.  You may also want to consider cooperating with the maintainer
of the conflicting tree to minimise any particularly complex conflicts.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 25 Mar 2020 16:00:39 +1100
Subject: [PATCH] scsi: fix up for "scsi: simplify scsi_partsize"

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 Documentation/scsi/scsi_mid_low_api.rst | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/Documentation/scsi/scsi_mid_low_api.rst b/Documentation/scsi/scsi_mid_low_api.rst
index 37ee63b147e9..5358bc10689e 100644
--- a/Documentation/scsi/scsi_mid_low_api.rst
+++ b/Documentation/scsi/scsi_mid_low_api.rst
@@ -308,7 +308,6 @@ Summary:
   - scsi_host_alloc - return a new scsi_host instance whose refcount==1
   - scsi_host_get - increments Scsi_Host instance's refcount
   - scsi_host_put - decrements Scsi_Host instance's refcount (free if 0)
-  - scsi_partsize - parse partition table into cylinders, heads + sectors
   - scsi_register - create and register a scsi host adapter instance.
   - scsi_remove_device - detach and remove a SCSI device
   - scsi_remove_host - detach and remove all SCSI devices owned by host
@@ -481,26 +480,6 @@ Details::
     void scsi_host_put(struct Scsi_Host *shost)
 
 
-    /**
-    * scsi_partsize - parse partition table into cylinders, heads + sectors
-    * @buf: pointer to partition table
-    * @capacity: size of (total) disk in 512 byte sectors
-    * @cyls: outputs number of cylinders calculated via this pointer
-    * @hds: outputs number of heads calculated via this pointer
-    * @secs: outputs number of sectors calculated via this pointer
-    *
-    *      Returns 0 on success, -1 on failure
-    *
-    *      Might block: no
-    *
-    *      Notes: Caller owns memory returned (free with kfree() )
-    *
-    *      Defined in: drivers/scsi/scsicam.c
-    **/
-    int scsi_partsize(unsigned char *buf, unsigned long capacity,
-		    unsigned int *cyls, unsigned int *hds, unsigned int *secs)
-
-
     /**
     * scsi_register - create and register a scsi host adapter instance.
     * @sht:        pointer to scsi host template
-- 
2.25.0

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: linux-next: manual merge of the scsi tree with the block tree
  2019-04-15 13:48 ` Bart Van Assche
@ 2019-04-17 19:11   ` Martin Wilck
  0 siblings, 0 replies; 14+ messages in thread
From: Martin Wilck @ 2019-04-17 19:11 UTC (permalink / raw)
  To: Bart Van Assche, Stephen Rothwell, James Bottomley, Jens Axboe
  Cc: Christoph Hellwig, Martin K. Petersen, Linux Kernel Mailing List,
	Linux Next Mailing List

On Mon, 2019-04-15 at 06:48 -0700, Bart Van Assche wrote:
> On 4/14/19 10:59 PM, Stephen Rothwell wrote:
> > Hi all,
> > 
> > Today's linux-next merge of the scsi tree got a conflict in:
> > 
> >   drivers/scsi/sd.c
> > 
> > between commit:
> > 
> >   c92e2f04b359 ("block: disk_events: introduce event flags")
> > 
> > from the block tree and commit:
> > 
> >   21e6ba3f0e02 ("scsi: sd: Rely on the driver core for asynchronous
> > probing")
> >   d16ece577bf2 ("scsi: sd: Inline sd_probe_part2()")
> > 
> > from the scsi tree.
> > 
> > I fixed it up (see below) and can carry the fix as necessary. This
> > is now fixed as far as linux-next is concerned, but any non trivial
> > conflicts should be mentioned to your upstream maintainer when your
> > tree
> > is submitted for merging.  You may also want to consider
> > cooperating
> > with the maintainer of the conflicting tree to minimise any
> > particularly
> > complex conflicts.
> 
> Thanks Stephen for having resolved this conflict. The conflict
> resolution
> looks good to me.

Yes, it looks good to me as well.

Thanks,
Martin



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: linux-next: manual merge of the scsi tree with the block tree
  2019-04-15  5:59 Stephen Rothwell
@ 2019-04-15 13:48 ` Bart Van Assche
  2019-04-17 19:11   ` Martin Wilck
  0 siblings, 1 reply; 14+ messages in thread
From: Bart Van Assche @ 2019-04-15 13:48 UTC (permalink / raw)
  To: Stephen Rothwell, James Bottomley, Jens Axboe
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Martin K. Petersen, Martin Wilck, Christoph Hellwig

On 4/14/19 10:59 PM, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the scsi tree got a conflict in:
> 
>   drivers/scsi/sd.c
> 
> between commit:
> 
>   c92e2f04b359 ("block: disk_events: introduce event flags")
> 
> from the block tree and commit:
> 
>   21e6ba3f0e02 ("scsi: sd: Rely on the driver core for asynchronous probing")
>   d16ece577bf2 ("scsi: sd: Inline sd_probe_part2()")
> 
> from the scsi tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.

Thanks Stephen for having resolved this conflict. The conflict resolution
looks good to me.

Bart.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* linux-next: manual merge of the scsi tree with the block tree
@ 2019-04-15  5:59 Stephen Rothwell
  2019-04-15 13:48 ` Bart Van Assche
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Rothwell @ 2019-04-15  5:59 UTC (permalink / raw)
  To: James Bottomley, Jens Axboe
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Bart Van Assche, Martin K. Petersen, Martin Wilck,
	Christoph Hellwig

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

Hi all,

Today's linux-next merge of the scsi tree got a conflict in:

  drivers/scsi/sd.c

between commit:

  c92e2f04b359 ("block: disk_events: introduce event flags")

from the block tree and commit:

  21e6ba3f0e02 ("scsi: sd: Rely on the driver core for asynchronous probing")
  d16ece577bf2 ("scsi: sd: Inline sd_probe_part2()")

from the scsi tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/scsi/sd.c
index ebc80354714c,e610b393809b..000000000000
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@@ -3404,8 -3374,49 +3342,50 @@@ static int sd_probe(struct device *dev
  	get_device(dev);
  	dev_set_drvdata(dev, sdkp);
  
- 	get_device(&sdkp->dev);	/* prevent release before async_schedule */
- 	async_schedule_domain(sd_probe_async, sdkp, &scsi_sd_probe_domain);
+ 	gd->major = sd_major((index & 0xf0) >> 4);
+ 	gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
+ 
+ 	gd->fops = &sd_fops;
+ 	gd->private_data = &sdkp->driver;
+ 	gd->queue = sdkp->device->request_queue;
+ 
+ 	/* defaults, until the device tells us otherwise */
+ 	sdp->sector_size = 512;
+ 	sdkp->capacity = 0;
+ 	sdkp->media_present = 1;
+ 	sdkp->write_prot = 0;
+ 	sdkp->cache_override = 0;
+ 	sdkp->WCE = 0;
+ 	sdkp->RCD = 0;
+ 	sdkp->ATO = 0;
+ 	sdkp->first_scan = 1;
+ 	sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS;
+ 
+ 	sd_revalidate_disk(gd);
+ 
+ 	gd->flags = GENHD_FL_EXT_DEVT;
+ 	if (sdp->removable) {
+ 		gd->flags |= GENHD_FL_REMOVABLE;
+ 		gd->events |= DISK_EVENT_MEDIA_CHANGE;
++		gd->event_flags = DISK_EVENT_FLAG_POLL | DISK_EVENT_FLAG_UEVENT;
+ 	}
+ 
+ 	blk_pm_runtime_init(sdp->request_queue, dev);
+ 	device_add_disk(dev, gd, NULL);
+ 	if (sdkp->capacity)
+ 		sd_dif_config_host(sdkp);
+ 
+ 	sd_revalidate_disk(gd);
+ 
+ 	if (sdkp->security) {
+ 		sdkp->opal_dev = init_opal_dev(sdp, &sd_sec_submit);
+ 		if (sdkp->opal_dev)
+ 			sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n");
+ 	}
+ 
+ 	sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
+ 		  sdp->removable ? "removable " : "");
+ 	scsi_autopm_put_device(sdp);
  
  	return 0;
  

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* linux-next: manual merge of the scsi tree with the block tree
@ 2019-02-18  5:10 Stephen Rothwell
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Rothwell @ 2019-02-18  5:10 UTC (permalink / raw)
  To: James Bottomley, Jens Axboe
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Ming Lei,
	Christoph Hellwig, Martin K. Petersen

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

Hi all,

Today's linux-next merge of the scsi tree got conflicts in:

  fs/exofs/ore.c
  fs/exofs/ore_raid.c

between commit:

  6dc4f100c175 ("block: allow bio_for_each_segment_all() to iterate over multi-page bvec")

from the block tree and commit:

  80f2121380ca ("scsi: fs: remove exofs")

from the scsi tree.

I fixed it up (I just removed the files) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging.  You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.



-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* linux-next: manual merge of the scsi tree with the block tree
@ 2017-06-21  5:55 Stephen Rothwell
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Rothwell @ 2017-06-21  5:55 UTC (permalink / raw)
  To: James Bottomley, Jens Axboe
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
	Bart Van Assche, Martin K. Petersen

Hi all,

Today's linux-next merge of the scsi tree got a conflict in:

  drivers/scsi/scsi_lib.c

between commit:

  ca18d6f769d2 ("block: Make most scsi_req_init() calls implicit")

from the block tree and commit:

  2dd6fb5957a7 ("scsi: Only add commands to the device command list if required by the LLD")

from the scsi tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/scsi/scsi_lib.c
index 550e29f903b7,41c19c75dab4..000000000000
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@@ -1116,20 -1124,35 +1106,49 @@@ err_exit
  }
  EXPORT_SYMBOL(scsi_init_io);
  
+ /* Add a command to the list used by the aacraid and dpt_i2o drivers */
+ void scsi_add_cmd_to_list(struct scsi_cmnd *cmd)
+ {
+ 	struct scsi_device *sdev = cmd->device;
+ 	struct Scsi_Host *shost = sdev->host;
+ 	unsigned long flags;
+ 
+ 	if (shost->use_cmd_list) {
+ 		spin_lock_irqsave(&sdev->list_lock, flags);
+ 		list_add_tail(&cmd->list, &sdev->cmd_list);
+ 		spin_unlock_irqrestore(&sdev->list_lock, flags);
+ 	}
+ }
+ 
+ /* Remove a command from the list used by the aacraid and dpt_i2o drivers */
+ void scsi_del_cmd_from_list(struct scsi_cmnd *cmd)
+ {
+ 	struct scsi_device *sdev = cmd->device;
+ 	struct Scsi_Host *shost = sdev->host;
+ 	unsigned long flags;
+ 
+ 	if (shost->use_cmd_list) {
+ 		spin_lock_irqsave(&sdev->list_lock, flags);
+ 		BUG_ON(list_empty(&cmd->list));
+ 		list_del_init(&cmd->list);
+ 		spin_unlock_irqrestore(&sdev->list_lock, flags);
+ 	}
+ }
+ 
 +/**
 + * scsi_initialize_rq - initialize struct scsi_cmnd.req
 + *
 + * Called from inside blk_get_request().
 + */
 +void scsi_initialize_rq(struct request *rq)
 +{
 +	struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq);
 +
 +	scsi_req_init(&cmd->req);
 +}
 +EXPORT_SYMBOL(scsi_initialize_rq);
 +
 +/* Called after a request has been started. */
  void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
  {
  	void *buf = cmd->sense_buffer;
@@@ -2974,10 -2989,7 +2989,7 @@@ int scsi_internal_device_block_nowait(s
  	 * request queue. 
  	 */
  	if (q->mq_ops) {
- 		if (wait)
- 			blk_mq_quiesce_queue(q);
- 		else
- 			blk_mq_quiesce_queue_nowait(q);
 -		blk_mq_stop_hw_queues(q);
++		blk_mq_quiesce_queue_nowait(q);
  	} else {
  		spin_lock_irqsave(q->queue_lock, flags);
  		blk_stop_queue(q);
@@@ -2988,31 -2998,77 +2998,77 @@@
  
  	return 0;
  }
- EXPORT_SYMBOL_GPL(scsi_internal_device_block);
-  
+ EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait);
+ 
  /**
-  * scsi_internal_device_unblock - resume a device after a block request
-  * @sdev:	device to resume
-  * @new_state:	state to set devices to after unblocking
+  * scsi_internal_device_block - try to transition to the SDEV_BLOCK state
+  * @sdev: device to block
+  *
+  * Pause SCSI command processing on the specified device and wait until all
+  * ongoing scsi_request_fn() / scsi_queue_rq() calls have finished. May sleep.
   *
-  * Called by scsi lld's or the midlayer to restart the device queue
-  * for the previously suspended scsi device.  Called from interrupt or
-  * normal process context.
+  * Returns zero if successful or a negative error code upon failure.
   *
-  * Returns zero if successful or error if not.
+  * Note:
+  * This routine transitions the device to the SDEV_BLOCK state (which must be
+  * a legal transition). When the device is in this state, command processing
+  * is paused until the device leaves the SDEV_BLOCK state. See also
+  * scsi_internal_device_unblock().
   *
-  * Notes:       
-  *	This routine transitions the device to the SDEV_RUNNING state
-  *	or to one of the offline states (which must be a legal transition)
-  *	allowing the midlayer to goose the queue for this device.
+  * To do: avoid that scsi_send_eh_cmnd() calls queuecommand() after
+  * scsi_internal_device_block() has blocked a SCSI device and also
+  * remove the rport mutex lock and unlock calls from srp_queuecommand().
   */
- int
- scsi_internal_device_unblock(struct scsi_device *sdev,
- 			     enum scsi_device_state new_state)
+ static int scsi_internal_device_block(struct scsi_device *sdev)
  {
- 	struct request_queue *q = sdev->request_queue; 
+ 	struct request_queue *q = sdev->request_queue;
+ 	int err;
+ 
+ 	mutex_lock(&sdev->state_mutex);
+ 	err = scsi_internal_device_block_nowait(sdev);
+ 	if (err == 0) {
+ 		if (q->mq_ops)
+ 			blk_mq_quiesce_queue(q);
+ 		else
+ 			scsi_wait_for_queuecommand(sdev);
+ 	}
+ 	mutex_unlock(&sdev->state_mutex);
+ 
+ 	return err;
+ }
+  
+ void scsi_start_queue(struct scsi_device *sdev)
+ {
+ 	struct request_queue *q = sdev->request_queue;
  	unsigned long flags;
  
+ 	if (q->mq_ops) {
 -		blk_mq_start_stopped_hw_queues(q, false);
++		blk_mq_unquiesce_queue(q);
+ 	} else {
+ 		spin_lock_irqsave(q->queue_lock, flags);
+ 		blk_start_queue(q);
+ 		spin_unlock_irqrestore(q->queue_lock, flags);
+ 	}
+ }
+ 
+ /**
+  * scsi_internal_device_unblock_nowait - resume a device after a block request
+  * @sdev:	device to resume
+  * @new_state:	state to set the device to after unblocking
+  *
+  * Restart the device queue for a previously suspended SCSI device. Does not
+  * sleep.
+  *
+  * Returns zero if successful or a negative error code upon failure.
+  *
+  * Notes:
+  * This routine transitions the device to the SDEV_RUNNING state or to one of
+  * the offline states (which must be a legal transition) allowing the midlayer
+  * to goose the queue for this device.
+  */
+ int scsi_internal_device_unblock_nowait(struct scsi_device *sdev,
+ 					enum scsi_device_state new_state)
+ {
  	/*
  	 * Try to transition the scsi device to SDEV_RUNNING or one of the
  	 * offlined states and goose the device queue if successful.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* linux-next: manual merge of the scsi tree with the block tree
@ 2017-06-19  5:35 Stephen Rothwell
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Rothwell @ 2017-06-19  5:35 UTC (permalink / raw)
  To: James Bottomley, Jens Axboe
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Ming Lei,
	Bart Van Assche, Martin K. Petersen

Hi all,

Today's linux-next merge of the scsi tree got a conflict in:

  drivers/scsi/scsi_lib.c

between commit:

  f660174e8bcd ("blk-mq: use the introduced blk_mq_unquiesce_queue()")

from the block tree and commits:

  551eb598e5ea ("scsi: Split scsi_internal_device_block()")
  66483a4a9f34 ("scsi: Introduce scsi_start_queue()")

from the scsi tree.

I fixed it up (I think - see below) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging.  You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/scsi/scsi_lib.c
index fb18ed284e55,41c19c75dab4..000000000000
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@@ -2959,10 -2989,7 +2974,7 @@@ int scsi_internal_device_block_nowait(s
  	 * request queue. 
  	 */
  	if (q->mq_ops) {
- 		if (wait)
- 			blk_mq_quiesce_queue(q);
- 		else
- 			blk_mq_quiesce_queue_nowait(q);
 -		blk_mq_stop_hw_queues(q);
++		blk_mq_quiesce_queue_nowait(q);
  	} else {
  		spin_lock_irqsave(q->queue_lock, flags);
  		blk_stop_queue(q);
@@@ -2973,31 -2998,77 +2983,77 @@@
  
  	return 0;
  }
- EXPORT_SYMBOL_GPL(scsi_internal_device_block);
-  
+ EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait);
+ 
  /**
-  * scsi_internal_device_unblock - resume a device after a block request
-  * @sdev:	device to resume
-  * @new_state:	state to set devices to after unblocking
+  * scsi_internal_device_block - try to transition to the SDEV_BLOCK state
+  * @sdev: device to block
+  *
+  * Pause SCSI command processing on the specified device and wait until all
+  * ongoing scsi_request_fn() / scsi_queue_rq() calls have finished. May sleep.
   *
-  * Called by scsi lld's or the midlayer to restart the device queue
-  * for the previously suspended scsi device.  Called from interrupt or
-  * normal process context.
+  * Returns zero if successful or a negative error code upon failure.
   *
-  * Returns zero if successful or error if not.
+  * Note:
+  * This routine transitions the device to the SDEV_BLOCK state (which must be
+  * a legal transition). When the device is in this state, command processing
+  * is paused until the device leaves the SDEV_BLOCK state. See also
+  * scsi_internal_device_unblock().
   *
-  * Notes:       
-  *	This routine transitions the device to the SDEV_RUNNING state
-  *	or to one of the offline states (which must be a legal transition)
-  *	allowing the midlayer to goose the queue for this device.
+  * To do: avoid that scsi_send_eh_cmnd() calls queuecommand() after
+  * scsi_internal_device_block() has blocked a SCSI device and also
+  * remove the rport mutex lock and unlock calls from srp_queuecommand().
   */
- int
- scsi_internal_device_unblock(struct scsi_device *sdev,
- 			     enum scsi_device_state new_state)
+ static int scsi_internal_device_block(struct scsi_device *sdev)
  {
- 	struct request_queue *q = sdev->request_queue; 
+ 	struct request_queue *q = sdev->request_queue;
+ 	int err;
+ 
+ 	mutex_lock(&sdev->state_mutex);
+ 	err = scsi_internal_device_block_nowait(sdev);
+ 	if (err == 0) {
+ 		if (q->mq_ops)
+ 			blk_mq_quiesce_queue(q);
+ 		else
+ 			scsi_wait_for_queuecommand(sdev);
+ 	}
+ 	mutex_unlock(&sdev->state_mutex);
+ 
+ 	return err;
+ }
+  
+ void scsi_start_queue(struct scsi_device *sdev)
+ {
+ 	struct request_queue *q = sdev->request_queue;
  	unsigned long flags;
  
+ 	if (q->mq_ops) {
 -		blk_mq_start_stopped_hw_queues(q, false);
++		blk_mq_unquiesce_queue(q);
+ 	} else {
+ 		spin_lock_irqsave(q->queue_lock, flags);
+ 		blk_start_queue(q);
+ 		spin_unlock_irqrestore(q->queue_lock, flags);
+ 	}
+ }
+ 
+ /**
+  * scsi_internal_device_unblock_nowait - resume a device after a block request
+  * @sdev:	device to resume
+  * @new_state:	state to set the device to after unblocking
+  *
+  * Restart the device queue for a previously suspended SCSI device. Does not
+  * sleep.
+  *
+  * Returns zero if successful or a negative error code upon failure.
+  *
+  * Notes:
+  * This routine transitions the device to the SDEV_RUNNING state or to one of
+  * the offline states (which must be a legal transition) allowing the midlayer
+  * to goose the queue for this device.
+  */
+ int scsi_internal_device_unblock_nowait(struct scsi_device *sdev,
+ 					enum scsi_device_state new_state)
+ {
  	/*
  	 * Try to transition the scsi device to SDEV_RUNNING or one of the
  	 * offlined states and goose the device queue if successful.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: linux-next: manual merge of the scsi tree with the block tree
  2016-11-08  5:48 Stephen Rothwell
@ 2016-11-08 16:17 ` James Bottomley
  0 siblings, 0 replies; 14+ messages in thread
From: James Bottomley @ 2016-11-08 16:17 UTC (permalink / raw)
  To: Stephen Rothwell, Jens Axboe
  Cc: linux-next, linux-kernel, Christoph Hellwig, Gilad Broner,
	Martin K. Petersen, Subhash Jadavani

On Tue, 2016-11-08 at 16:48 +1100, Stephen Rothwell wrote:
> Hi James,
> 
> Today's linux-next merge of the scsi tree got a conflict in:
> 
>   drivers/scsi/ufs/ufshcd.c
> 
> between commit:
> 
>   e806402130c9 ("block: split out request-only flags into a new
> namespace")
> 
> from the block tree and commit:
> 
>   2266d5678ad1 ("scsi: ufs: fix sense buffer size to 18 bytes")
> 
> from the scsi tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your 
> tree is submitted for merging.  You may also want to consider 
> cooperating with the maintainer of the conflicting tree to minimise 
> any particularly complex conflicts.

Thanks for doing this.  I think this is exactly the type of easily
resolvable conflict Linus likes to fix himself, so keeping the trees
separate seems the best options.

Regards,

James

^ permalink raw reply	[flat|nested] 14+ messages in thread

* linux-next: manual merge of the scsi tree with the block tree
@ 2016-11-08  5:48 Stephen Rothwell
  2016-11-08 16:17 ` James Bottomley
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Rothwell @ 2016-11-08  5:48 UTC (permalink / raw)
  To: James Bottomley, Jens Axboe
  Cc: linux-next, linux-kernel, Christoph Hellwig, Gilad Broner,
	Martin K. Petersen, Subhash Jadavani

Hi James,

Today's linux-next merge of the scsi tree got a conflict in:

  drivers/scsi/ufs/ufshcd.c

between commit:

  e806402130c9 ("block: split out request-only flags into a new namespace")

from the block tree and commit:

  2266d5678ad1 ("scsi: ufs: fix sense buffer size to 18 bytes")

from the scsi tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/scsi/ufs/ufshcd.c
index cf549871c1ee,304adce3bdbe..000000000000
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@@ -5589,8 -5642,8 +5642,8 @@@ ufshcd_send_request_sense(struct ufs_hb
  	}
  
  	ret = scsi_execute_req_flags(sdp, cmd, DMA_FROM_DEVICE, buffer,
- 				SCSI_SENSE_BUFFERSIZE, NULL,
+ 				UFSHCD_REQ_SENSE_SIZE, NULL,
 -				msecs_to_jiffies(1000), 3, NULL, REQ_PM);
 +				msecs_to_jiffies(1000), 3, NULL, 0, RQF_PM);
  	if (ret)
  		pr_err("%s: failed with err %d\n", __func__, ret);
  

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-03-07  4:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  6:32 linux-next: manual merge of the scsi tree with the block tree Stephen Rothwell
2021-08-24  6:39 ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2022-03-07  4:18 Stephen Rothwell
2022-03-07  4:14 Stephen Rothwell
2021-11-01  5:08 Stephen Rothwell
2020-03-25  5:04 Stephen Rothwell
2019-04-15  5:59 Stephen Rothwell
2019-04-15 13:48 ` Bart Van Assche
2019-04-17 19:11   ` Martin Wilck
2019-02-18  5:10 Stephen Rothwell
2017-06-21  5:55 Stephen Rothwell
2017-06-19  5:35 Stephen Rothwell
2016-11-08  5:48 Stephen Rothwell
2016-11-08 16:17 ` James Bottomley

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).