Re: [PATCH] bnx2fc: Fix locking requirements in bnx2fc_init_tgt

2016-04-05 Thread James Bottomley
On Tue, 2016-04-05 at 13:50 -0400, Bastien Bastien Philbert wrote:
> On Tue, Apr 5, 2016 at 1:43 PM, Chad Dupuis 
> wrote:
> > 
> > 
> > On Tue, 5 Apr 2016, Bastien Philbert wrote:
> > 
> > > This fixes the locking around the call to bnx2fc_alloc_id to
> > > comply
> > > with the comments about this particular function's definition
> > > about
> > > requiring the need to hold the hba mutex before and after calling
> > > it.
> > > Signed-off-by: Bastien Philbert 
> > > ---
> > > drivers/scsi/bnx2fc/bnx2fc_tgt.c | 6 +-
> > > 1 file changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
> > > b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
> > > index 08ec318..f2988cd 100644
> > > --- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
> > > +++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
> > > @@ -368,9 +368,13 @@ static int bnx2fc_init_tgt(struct
> > > bnx2fc_rport *tgt,
> > > return -1;
> > > }
> > > 
> > > +   mutex_lock(>hba_mutex);
> > > tgt->fcoe_conn_id = bnx2fc_alloc_conn_id(hba, tgt);
> > > -   if (tgt->fcoe_conn_id == -1)
> > > +   if (tgt->fcoe_conn_id == -1) {
> > > +   mutex_unlock(>hba_mutex);
> > > return -1;
> > > +   }
> > > +   mutex_unlock(>hba_mutex);
> > > 
> > > BNX2FC_TGT_DBG(tgt, "init_tgt - conn_id = 0x%x\n",
> > > tgt->fcoe_conn_id);
> > > 
> > > 
> > 
> > Taking the mutex here is not needed as it is already taken in
> > bnx2fc_rport_event_handler() in the call chain
> > bnx2fc_rport_event_handler->bnx2fc_offload_session->bnx2fc_init_tgt
> > ->bnx2fc_alloc_conn_id
> Ok thanks and good to known.

Since the mutex was already taken, the patch you propose would produce
an immediate deadlock if applied, meaning you didn't actually test it
out.  If you're going to propose patches like this, please understand
the driver you're patching, *test* the patches on actual hardware and
describe the problem you're solving in the changelog.

Thanks,

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mpt3sas:Make sure mpt3sas adapter has been reset in scsih_resume

2016-04-05 Thread Bastien Philbert
This fixes the issue in the function scih_resume that we assume
that the mpt3sas adapter has been reset properly with a call to
mpt3sas_base_hard_reset_handler by checking if this function
call returns a error code and exit adpater resume prematurely

Signed-off-by: Bastien Philbert 
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index e0e4920..be2a7c3 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -8892,7 +8892,11 @@ scsih_resume(struct pci_dev *pdev)
if (r)
return r;
 
-   mpt3sas_base_hard_reset_handler(ioc, CAN_SLEEP, SOFT_RESET);
+   r = mpt3sas_base_hard_reset_handler(ioc, CAN_SLEEP, SOFT_RESET);
+   if (r) {
+   mpt3sas_base_free_resources(ioc);
+   return r;
+   }
scsi_unblock_requests(shost);
mpt3sas_base_start_watchdog(ioc);
return 0;
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] csiostor: Fix backwards locking in the function __csio_unreg_rnode

2016-04-05 Thread Bastien Philbert
This fixes backwards locking in the function __csio_unreg_rnode to
properly lock before the call to the function csio_unreg_rnode and
not unlock with spin_unlock_irq as this would not allow the proper
protection for concurrent access on the shared csio_hw structure
pointer hw. In addition switch the locking after the critical region
function call to properly unlock instead with spin_unlock_irq on

Signed-off-by: Bastien Philbert 
---
 drivers/scsi/csiostor/csio_rnode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_rnode.c 
b/drivers/scsi/csiostor/csio_rnode.c
index e9c3b04..029a09e 100644
--- a/drivers/scsi/csiostor/csio_rnode.c
+++ b/drivers/scsi/csiostor/csio_rnode.c
@@ -580,9 +580,9 @@ __csio_unreg_rnode(struct csio_rnode *rn)
ln->last_scan_ntgts--;
}
 
-   spin_unlock_irq(>lock);
-   csio_unreg_rnode(rn);
spin_lock_irq(>lock);
+   csio_unreg_rnode(rn);
+   spin_unlock_irq(>lock);
 
/* Cleanup I/Os that were waiting for rnode to unregister */
if (cmpl)
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/3] Add ZBC <-> ZAC xlat support for report, open, close, reset, finish

2016-04-05 Thread Shaun Tancheff
Add SCSI <-> ATA translation layer for ZBC commands:
  - Open, Close, and Finish zones

Signed-off-by: Shaun Tancheff 
---
 drivers/ata/libata-scsi.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index f06f389..ad6a8a2 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3504,7 +3504,10 @@ static unsigned int ata_scsi_zbc_out_xlat(struct 
ata_queued_cmd *qc)
/* Compatibility with ZBC r01 */
if (!sa)
sa = ZO_RESET_WRITE_POINTER;
-   if (sa != ZO_RESET_WRITE_POINTER) {
+   if (!(sa == ZO_CLOSE_ZONE ||
+ sa == ZO_FINISH_ZONE ||
+ sa == ZO_OPEN_ZONE ||
+ sa == ZO_RESET_WRITE_POINTER)) {
fp = 1;
goto invalid_fld;
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/3] Add bio/request flags for using ZBC/ZAC commands

2016-04-05 Thread Shaun Tancheff
T10 ZBC and T13 ZAC specify operations for Zoned devices.

To be able to access the zone information and open and close zones
adding flags for the report zones command (REQ_REPORT_ZONES) and for
Open and Close zone (REQ_OPEN_ZONE and REQ_CLOSE_ZONE) can be added
for use by struct bio's bi_rw and by struct request's cmd_flags.

To reduce the number of additional flags needed, the REQ_RESET_ZONE
shares the same bit as REQ_REPORT_ZONES and is differentiated by
direction (bi_op). Report zones is a device read that requires a
buffer. Reset is a device command (WRITE) that has no associated
data transfer.

Originally the intent was to use REQ_DISCARD as a functional analog
to zone reset, however the number of incompatible special cases
that need to be visited seems more error-prone than have one of
the new flags initially dual purposed.

The Finish zone command is intentionally not implimented as there is no
current use case for that operation.

Signed-off-by: Shaun Tancheff 
---
 MAINTAINERS   |   9 ++
 block/blk-lib.c   | 125 ++
 drivers/scsi/sd.c | 107 +++
 drivers/scsi/sd.h |   1 +
 include/linux/blk_types.h |  17 ++-
 include/linux/blkzoned_api.h  |  25 +
 include/scsi/scsi_device.h|   1 +
 include/uapi/linux/Kbuild |   1 +
 include/uapi/linux/blkzoned_api.h | 215 ++
 include/uapi/linux/fs.h   |   1 +
 10 files changed, 500 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/blkzoned_api.h
 create mode 100644 include/uapi/linux/blkzoned_api.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 1c32f8a..b68acbb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12340,6 +12340,15 @@ F: Documentation/networking/z8530drv.txt
 F: drivers/net/hamradio/*scc.c
 F: drivers/net/hamradio/z8530.h
 
+ZBC AND ZBC BLOCK DEVICES
+M: Shaun Tancheff 
+W: http://seagate.com
+W: https://github.com/Seagate/ZDM-Device-Mapper
+L: linux-bl...@vger.kernel.org
+S: Maintained
+F: include/linux/blkzoned_api.h
+F: include/uapi/linux/blkzoned_api.h
+
 ZBUD COMPRESSED PAGE ALLOCATOR
 M: Seth Jennings 
 L: linux...@kvack.org
diff --git a/block/blk-lib.c b/block/blk-lib.c
index d01b5f2..8424dfe 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "blk.h"
 
@@ -303,3 +304,127 @@ int blkdev_issue_zeroout(struct block_device *bdev, 
sector_t sector,
return __blkdev_issue_zeroout(bdev, sector, nr_sects, gfp_mask);
 }
 EXPORT_SYMBOL(blkdev_issue_zeroout);
+
+/**
+ * blkdev_issue_zone_report - queue a report zones operation
+ * @bdev:  target blockdev
+ * @bi_rw: extra bio rw flags. If unsure, use 0.
+ * @sector:starting sector (report will include this sector).
+ * @page:  one or more contiguous pages.
+ * @pgsz:  up to size of page in bytes, size of report.
+ * @gfp_mask:  memory allocation flags (for bio_alloc)
+ *
+ * Description:
+ *Issue a zone report request for the sectors in question.
+ */
+int blkdev_issue_zone_report(struct block_device *bdev, unsigned int bi_rw,
+sector_t sector, u8 opt, struct page *page,
+size_t pgsz, gfp_t gfp_mask)
+{
+   DECLARE_COMPLETION_ONSTACK(wait);
+   struct bdev_zone_report *conv = page_address(page);
+   struct bio_batch bb;
+   struct bio *bio;
+   unsigned int nr_iovecs = 1;
+   int ret = 0;
+
+   if (pgsz < (sizeof(struct bdev_zone_report) +
+   sizeof(struct bdev_zone_descriptor)))
+   return -EINVAL;
+
+   conv->descriptor_count = 0;
+   atomic_set(, 1);
+   bb.error = 0;
+   bb.wait = 
+
+   bio = bio_alloc(gfp_mask, nr_iovecs);
+   if (!bio)
+   return -ENOMEM;
+
+   bio->bi_iter.bi_sector = sector;
+   bio->bi_end_io = bio_batch_end_io;
+   bio->bi_bdev = bdev;
+   bio->bi_private = 
+   bio->bi_vcnt = 0;
+   bio->bi_iter.bi_size = 0;
+   bio->bi_op = REQ_OP_READ;
+   bio->bi_rw = bi_rw | REQ_REPORT_ZONES;
+
+   bio_set_streamid(bio, opt);
+   bio_add_page(bio, page, pgsz, 0);
+   atomic_inc();
+   submit_bio(bio);
+
+   /* Wait for bios in-flight */
+   if (!atomic_dec_and_test())
+   wait_for_completion_io();
+
+   /*
+* When our request it nak'd the underlying device maybe conventional
+* so ... report a single conventional zone the size of the device.
+*/
+   if (bb.error == -EIO && conv->descriptor_count) {
+   /* Adjust the conventional to the size of the partition ... */
+   __be64 blksz = cpu_to_be64(bdev->bd_part->nr_sects);
+
+   conv->maximum_lba = blksz;
+   conv->descriptors[0].type = 

[PATCH v2 3/3] Add ioctl to issue ZBC/ZAC commands via block layer

2016-04-05 Thread Shaun Tancheff
Add New ioctl types
BLKREPORT- Issue Report Zones to device.
BLKOPENZONE  - Issue an Zone Action: Open Zone command.
BLKCLOSEZONE - Issue an Zone Action: Close Zone command.
BLKRESETZONE - Issue an Zone Action: Reset Zone command.

Signed-off-by: Shaun Tancheff 
---
 block/ioctl.c | 113 ++
 include/uapi/linux/blkzoned_api.h |   6 ++
 2 files changed, 119 insertions(+)

diff --git a/block/ioctl.c b/block/ioctl.c
index d8996bb..67c03d0 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -195,6 +196,112 @@ int blkdev_reread_part(struct block_device *bdev)
 }
 EXPORT_SYMBOL(blkdev_reread_part);
 
+static int blk_zoned_report_ioctl(struct block_device *bdev, fmode_t mode,
+   void __user *parg)
+{
+   int error = -EFAULT;
+   gfp_t gfp = GFP_KERNEL;
+   struct bdev_zone_report_io *zone_iodata = NULL;
+   int order = 0;
+   struct page *pgs = NULL;
+   u32 alloc_size = PAGE_SIZE;
+   unsigned long bi_rw = 0;
+   u8 opt = 0;
+
+   if (!(mode & FMODE_READ))
+   return -EBADF;
+
+   zone_iodata = (void *)get_zeroed_page(gfp);
+   if (!zone_iodata) {
+   error = -ENOMEM;
+   goto report_zones_out;
+   }
+   if (copy_from_user(zone_iodata, parg, sizeof(*zone_iodata))) {
+   error = -EFAULT;
+   goto report_zones_out;
+   }
+   if (zone_iodata->data.in.return_page_count > alloc_size) {
+   int npages;
+
+   alloc_size = zone_iodata->data.in.return_page_count;
+   npages = (alloc_size + PAGE_SIZE - 1) / PAGE_SIZE;
+   order =  ilog2(roundup_pow_of_two(npages));
+   pgs = alloc_pages(gfp, order);
+   if (pgs) {
+   void *mem = page_address(pgs);
+
+   if (!mem) {
+   error = -ENOMEM;
+   goto report_zones_out;
+   }
+   memset(mem, 0, alloc_size);
+   memcpy(mem, zone_iodata, sizeof(*zone_iodata));
+   free_page((unsigned long)zone_iodata);
+   zone_iodata = mem;
+   } else {
+   /* Result requires DMA capable memory */
+   pr_err("Not enough memory available for request.\n");
+   error = -ENOMEM;
+   goto report_zones_out;
+   }
+   }
+   opt = zone_iodata->data.in.report_option & 0x7F;
+   if (zone_iodata->data.in.report_option & ZOPT_USE_ATA_PASS)
+   bi_rw |= REQ_META;
+
+   error = blkdev_issue_zone_report(bdev, bi_rw,
+   zone_iodata->data.in.zone_locator_lba, opt,
+   pgs ? pgs : virt_to_page(zone_iodata),
+   alloc_size, GFP_KERNEL);
+
+   if (error)
+   goto report_zones_out;
+
+   if (copy_to_user(parg, zone_iodata, alloc_size))
+   error = -EFAULT;
+
+report_zones_out:
+   if (pgs)
+   __free_pages(pgs, order);
+   else if (zone_iodata)
+   free_page((unsigned long)zone_iodata);
+   return error;
+}
+
+static int blk_zoned_action_ioctl(struct block_device *bdev, fmode_t mode,
+ unsigned int cmd, unsigned long arg)
+{
+   unsigned long bi_rw = 0;
+
+   if (!(mode & FMODE_WRITE))
+   return -EBADF;
+
+   /*
+* When acting on zones we explicitly disallow using a partition.
+*/
+   if (bdev != bdev->bd_contains) {
+   pr_err("%s: All zone operations disallowed on this device\n",
+   __func__);
+   return -EFAULT;
+   }
+
+   switch (cmd) {
+   case BLKOPENZONE:
+   bi_rw |= REQ_OPEN_ZONE;
+   break;
+   case BLKCLOSEZONE:
+   bi_rw |= REQ_CLOSE_ZONE;
+   break;
+   case BLKRESETZONE:
+   bi_rw |= REQ_RESET_ZONE;
+   break;
+   default:
+   pr_err("%s: Unknown action: %u\n", __func__, cmd);
+   WARN_ON(1);
+   }
+   return blkdev_issue_zone_action(bdev, bi_rw, arg, GFP_KERNEL);
+}
+
 static int blk_ioctl_discard(struct block_device *bdev, fmode_t mode,
unsigned long arg, unsigned long flags)
 {
@@ -598,6 +705,12 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, 
unsigned cmd,
case BLKTRACESETUP:
case BLKTRACETEARDOWN:
return blk_trace_ioctl(bdev, cmd, argp);
+   case BLKREPORT:
+   return blk_zoned_report_ioctl(bdev, mode, argp);
+   case BLKOPENZONE:
+   case BLKCLOSEZONE:
+   case BLKRESETZONE:
+   return blk_zoned_action_ioctl(bdev, mode, 

Re: [PATCH] bnx2fc: Fix locking requirements in bnx2fc_init_tgt

2016-04-05 Thread Bastien Bastien Philbert
On Tue, Apr 5, 2016 at 1:43 PM, Chad Dupuis  wrote:
>
>
> On Tue, 5 Apr 2016, Bastien Philbert wrote:
>
>> This fixes the locking around the call to bnx2fc_alloc_id to comply
>> with the comments about this particular function's definition about
>> requiring the need to hold the hba mutex before and after calling
>> it.
>> Signed-off-by: Bastien Philbert 
>> ---
>> drivers/scsi/bnx2fc/bnx2fc_tgt.c | 6 +-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
>> b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
>> index 08ec318..f2988cd 100644
>> --- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
>> +++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
>> @@ -368,9 +368,13 @@ static int bnx2fc_init_tgt(struct bnx2fc_rport *tgt,
>> return -1;
>> }
>>
>> +   mutex_lock(>hba_mutex);
>> tgt->fcoe_conn_id = bnx2fc_alloc_conn_id(hba, tgt);
>> -   if (tgt->fcoe_conn_id == -1)
>> +   if (tgt->fcoe_conn_id == -1) {
>> +   mutex_unlock(>hba_mutex);
>> return -1;
>> +   }
>> +   mutex_unlock(>hba_mutex);
>>
>> BNX2FC_TGT_DBG(tgt, "init_tgt - conn_id = 0x%x\n",
>> tgt->fcoe_conn_id);
>>
>>
>
> Taking the mutex here is not needed as it is already taken in
> bnx2fc_rport_event_handler() in the call chain
> bnx2fc_rport_event_handler->bnx2fc_offload_session->bnx2fc_init_tgt->bnx2fc_alloc_conn_id
Ok thanks and good to known.
Bastien
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] bnx2fc: Fix locking requirements in bnx2fc_init_tgt

2016-04-05 Thread Chad Dupuis



On Tue, 5 Apr 2016, Bastien Philbert wrote:


This fixes the locking around the call to bnx2fc_alloc_id to comply
with the comments about this particular function's definition about
requiring the need to hold the hba mutex before and after calling
it.
Signed-off-by: Bastien Philbert 
---
drivers/scsi/bnx2fc/bnx2fc_tgt.c | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
index 08ec318..f2988cd 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
@@ -368,9 +368,13 @@ static int bnx2fc_init_tgt(struct bnx2fc_rport *tgt,
return -1;
}

+   mutex_lock(>hba_mutex);
tgt->fcoe_conn_id = bnx2fc_alloc_conn_id(hba, tgt);
-   if (tgt->fcoe_conn_id == -1)
+   if (tgt->fcoe_conn_id == -1) {
+   mutex_unlock(>hba_mutex);
return -1;
+   }
+   mutex_unlock(>hba_mutex);

BNX2FC_TGT_DBG(tgt, "init_tgt - conn_id = 0x%x\n", tgt->fcoe_conn_id);




Taking the mutex here is not needed as it is already taken in 
bnx2fc_rport_event_handler() in the call chain 
bnx2fc_rport_event_handler->bnx2fc_offload_session->bnx2fc_init_tgt->bnx2fc_alloc_conn_id

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 4/5] scsi: rename SCSI_MAX_{SG, SG_CHAIN}_SEGMENTS

2016-04-05 Thread Tejun Heo
On Mon, Apr 04, 2016 at 02:48:10PM -0700, Ming Lin wrote:
> From: Ming Lin 
> 
> Rename SCSI_MAX_SG_SEGMENTS to SG_CHUNK_SIZE, which means the amount
> we fit into a single scatterlist chunk.
> 
> Rename SCSI_MAX_SG_CHAIN_SEGMENTS to SG_MAX_SEGMENTS.
> 
> Will move these 2 generic definitions to scatterlist.h later.
> 
> Reviewed-by: Christoph Hellwig 
> Acked-by: Bart Van Assche  (for ib_srp changes)
> Signed-off-by: Ming Lin 

For libata,

Acked-by: Tejun Heo 

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] bnx2fc: Fix locking requirements in bnx2fc_init_tgt

2016-04-05 Thread Bastien Philbert
This fixes the locking around the call to bnx2fc_alloc_id to comply
with the comments about this particular function's definition about
requiring the need to hold the hba mutex before and after calling 
it.
Signed-off-by: Bastien Philbert 
---
 drivers/scsi/bnx2fc/bnx2fc_tgt.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
index 08ec318..f2988cd 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
@@ -368,9 +368,13 @@ static int bnx2fc_init_tgt(struct bnx2fc_rport *tgt,
return -1;
}
 
+   mutex_lock(>hba_mutex);
tgt->fcoe_conn_id = bnx2fc_alloc_conn_id(hba, tgt);
-   if (tgt->fcoe_conn_id == -1)
+   if (tgt->fcoe_conn_id == -1) {
+   mutex_unlock(>hba_mutex);
return -1;
+   }
+   mutex_unlock(>hba_mutex);
 
BNX2FC_TGT_DBG(tgt, "init_tgt - conn_id = 0x%x\n", tgt->fcoe_conn_id);
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: QoS for iSCSI target?

2016-04-05 Thread Chris Friesen

On 04/04/2016 06:25 PM, Nicholas A. Bellinger wrote:

On Mon, 2016-04-04 at 17:01 -0600, Chris Friesen wrote:



I'm not trying to globally throttle IO on a particular block device.  I'm trying
to control how much IO the iSCSI target in the kernel is allowed to drive on a
particular block device.

The goal is to ensure that the iSCSI target does not consume all of the
available bandwidth for a particular block device.  I want to ensure that some
of the bandwidth for that device is available to other processes on the host
(for management purposes) rather than being consumed by a greedy iSCSI 
initiator.



AFAIK, different traffic classes for a single block device is not
supported by block cgroups.

Also given target_core_iblock claims a given block_device for exclusive
access, you can't actually use the same block device for a mounted
filesystem, LVM, MD, etc, once it's been registered for target usage.


The issue we're running into is in the context of OpenStack Cinder.  It layers 
LVM on top of the bare block device, then creates an LVM volume per cinder 
volume, and exports the logical volumes via iSCSI.


The problem we're seeing is that if one or more iSCSI initiators drive heavy 
traffic on a slow disk, it can become very slow to access anything at all on the 
bare block device (/dev/sdb or equivalent).  This can cause the server-side 
management code to time out on operations like making a new volume, checking 
free disk space, etc.



In an ideal world I would like a set of rules that say things like:
1) if there is contention, ensure that the host is guaranteed X percent of the
available /dev/sdb IOPS
2) if there is contention, do not allow the iSCSI target traffic to consume more
than Y percent of /dev/sdb's write traffic



Yeah, that doesn't exist in standlone block groups.

You could probably use network cgroups to limit bandwidth at the socket
level for iscsi_target_mod, but that's going to be across all LUNs in a
session, and not at individual LUN level.


Are there a set of dedicated kernel threads being used for the iSCSI target?  Or 
is it handled by generic softirq mechanisms?


Chris

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/27] target: use bio_is_full()

2016-04-05 Thread Christoph Hellwig
On Tue, Apr 05, 2016 at 07:56:54PM +0800, Ming Lei wrote:
> +++ b/drivers/target/target_core_pscsi.c
> @@ -951,7 +951,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, 
> u32 sgl_nents,
>   pr_debug("PSCSI: bio->bi_vcnt: %d nr_vecs: %d\n",
>   bio->bi_vcnt, nr_vecs);
>  
> - if (bio->bi_vcnt > nr_vecs) {
> + if (bio_is_full(bio)) {
>   pr_debug("PSCSI: Reached bio->bi_vcnt max:"
>   " %d i: %d bio: %p, allocating another"
>   " bio\n", bio->bi_vcnt, i, bio);

This check should be removed entirely - bio_add_pc_page takes care of
it.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 6/8] tools rpmb: add RPBM access tool

2016-04-05 Thread kbuild test robot
Hi Tomas,

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on v4.6-rc2 next-20160405]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Tomas-Winkler/Replay-Protected-Memory-Block-RPMB-subsystem/20160404-192243
config: x86_64-randconfig-s2-04051858 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   make[2]: *** No rule to make target 'lib/usercopy.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/lockref.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/bcd.o', needed by 'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/div64.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/sort.o', needed by 'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/parser.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/halfmd4.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/debug_locks.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/random32.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/bust_spinlocks.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/kasprintf.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/bitmap.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/scatterlist.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/gcd.o', needed by 'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/lcm.o', needed by 'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/list_sort.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/uuid.o', needed by 'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/flex_array.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/iov_iter.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/clz_ctz.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/bsearch.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/find_bit.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/llist.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/memweight.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/kfifo.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/percpu-refcount.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/percpu_ida.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/rhashtable.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/reciprocal_div.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/once.o', needed by 'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/string_helpers.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/test-string_helpers.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/hexdump.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/test_hexdump.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/kstrtox.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/test_firmware.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/test-kstrtox.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/test_rhashtable.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/test_printf.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/iomap.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/pci_iomap.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/iomap_copy.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/devres.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/check_signature.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/locking-selftest.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/hweight.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/assoc_array.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/bitrev.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/rational.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/crc-ccitt.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make target 'lib/crc16.o', needed by 
'lib/built-in.o'.
   make[2]: *** No rule to make 

Re: [PATCH v2 6/8] tools rpmb: add RPBM access tool

2016-04-05 Thread kbuild test robot
Hi Tomas,

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on v4.6-rc2 next-20160405]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Tomas-Winkler/Replay-Protected-Memory-Block-RPMB-subsystem/20160404-192243
config: x86_64-randconfig-s5-04051858 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   make[3]: *** No rule to make target 'arch/x86/kernel/process_64.o', needed 
by 'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/signal.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/signal_compat.o', 
needed by 'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/traps.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/irq.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/irq_64.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/dumpstack_64.o', needed 
by 'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/time.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/ioport.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/dumpstack.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/nmi.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/setup.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/x86_init.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/i8259.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/irqinit.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/jump_label.o', needed 
by 'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/irq_work.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/probe_roms.o', needed 
by 'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/sys_x86_64.o', needed 
by 'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/x8664_ksyms_64.o', 
needed by 'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/mcount_64.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/ksysfs.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/bootflag.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/e820.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/pci-dma.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/quirks.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/topology.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/kdebugfs.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/alternative.o', needed 
by 'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/i8253.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/pci-nommu.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/hw_breakpoint.o', 
needed by 'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/tsc.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/tsc_msr.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/io_delay.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/rtc.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/pci-iommu_table.o', 
needed by 'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/resource.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/process.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/ptrace.o', needed by 
'arch/x86/kernel/built-in.o'.
   make[3]: *** No rule to make target 'arch/x86/kernel/tls.o', 

Re: [PATCHv3] scsi: disable automatic target scan

2016-04-05 Thread Benjamin Block
On 09:29 Fri 01 Apr , Hannes Reinecke wrote:
> On 03/30/2016 09:41 PM, Benjamin Block wrote:
> > Hello Hannes,
> > 
> > I am a bit late here, but as this got pulled and Steffen didn't have
> > time to give it a review, I did today.
> > 
> > On 08:39 Thu 17 Mar , Hannes Reinecke wrote:
> >> On larger installations it is useful to disable automatic LUN
> >> scanning, and only add the required LUNs via udev rules.
> >> This can speed up bootup dramatically.
> >>
> >> This patch introduces a new scan module parameter value 'manual',
> >> which works like 'none', but can be overriden by setting the 'rescan'
> >> value from scsi_scan_target to 'SCSI_SCAN_MANUAL'.
> >> And it updates all relevant callers to set the 'rescan' value
> >> to 'SCSI_SCAN_MANUAL' if invoked via the 'scan' option in sysfs.
> >>
> >> Signed-off-by: Hannes Reinecke 
> >> ---
> > 
> > [:snip:]
> > 
> >>
> >> diff --git a/drivers/s390/scsi/zfcp_unit.c b/drivers/s390/scsi/zfcp_unit.c
> >> index 157d3d2..08bba7c 100644
> >> --- a/drivers/s390/scsi/zfcp_unit.c
> >> +++ b/drivers/s390/scsi/zfcp_unit.c
> >> @@ -26,7 +26,8 @@ void zfcp_unit_scsi_scan(struct zfcp_unit *unit)
> >>lun = scsilun_to_int((struct scsi_lun *) >fcp_lun);
> >>
> >>if (rport && rport->port_state == FC_PORTSTATE_ONLINE)
> >> -  scsi_scan_target(>dev, 0, rport->scsi_target_id, lun, 1);
> >> +  scsi_scan_target(>dev, 0, rport->scsi_target_id, lun,
> >> +   SCSI_SCAN_RESCAN);
> > 
> > I'd rather use the new SCSI_SCAN_MANUAL here. We don't want this to be
> > "blocked" by an attribute set in a different (new) code-path and
> > config-location.
> > 
> > This path is used by both, zfcp-recovery and -userinterfaces (sysfs) and
> > in both cases we call it with the intend that the scan is really done -
> > hence the SCSI_SCAN_MANUAL to force a scan. I'd find it very weird if
> > suddenly our users would have to additionally use yet an other config to
> > get the old interfaces working properly.
> > 
> Okay, no problem with that.
> zfcp has its own scanning rules (cf allow_lun_scan module parameter), so
> setting it to 'MANUAL' will just restore the original behaviour.
> 
> Will you be sending a patch for it?
> 

Yeah, sry, once I am through our backlog and I find time to test that
properly.



Beste Grüße / Best regards,
  - Benjamin Block
-- 
Linux on z Systems Development / IBM Systems & Technology Group
  IBM Deutschland Research & Development GmbH 
Vorsitz. AufsR.: Martina Koederitz /Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/27] target: use bio_is_full()

2016-04-05 Thread Ming Lei
Signed-off-by: Ming Lei 
---
 drivers/target/target_core_pscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_pscsi.c 
b/drivers/target/target_core_pscsi.c
index de18790..24906c3 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -951,7 +951,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, 
u32 sgl_nents,
pr_debug("PSCSI: bio->bi_vcnt: %d nr_vecs: %d\n",
bio->bi_vcnt, nr_vecs);
 
-   if (bio->bi_vcnt > nr_vecs) {
+   if (bio_is_full(bio)) {
pr_debug("PSCSI: Reached bio->bi_vcnt max:"
" %d i: %d bio: %p, allocating another"
" bio\n", bio->bi_vcnt, i, bio);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/27] block: cleanup direct access on .bi_vcnt & .bi_io_vec

2016-04-05 Thread Ming Lei
Hi Guys,

It is always not a good practice to access bio->bi_vcnt and
bio->bi_io_vec from drivers directly. Also this kind of direct
access will cause trouble when converting to multipage bvecs.

The 1st patch introduces the following 4 bio helpers which can be
used inside drivers for avoiding direct access to .bi_vcnt and .bi_io_vec.

bio_pages()
bio_is_full()
bio_get_base_vec()
bio_set_vec_table()

Both bio_pages() and bio_is_full() can be easy to convert to
multipage bvecs.

For bio_get_base_vec() and bio_set_vec_table(), they are often used
during initializing a new bio or in case of single bvec bio. With the
two new helpers, it becomes quite easy to audit access to .bi_io_vec
and .bi_vcnt.

Most of the other patches use the 4 helpers to clean up most of direct
access to .bi_vcnt and .bi_io_vec from drivers, except for MD and btrfs,
which two subsystems will be done in the future. 

Also bio_add_page() is used in floppy, dm-crypt and fs/logfs to
avoiding direct access to .bi_vcnt & .bi_io_vec.

Thanks,
Ming

Ming Lei (27):
  block: bio: introduce 4 helpers for cleanup
  block: drbd: use bio_get_base_vec() to retrieve the 1st bvec
  block: drbd: remove impossible failure handling
  block: loop: use bio_get_base_vec() to retrive bvec table
  block: pktcdvd: use bio_get_base_vec() to retrive bvec table
  block: floppy: use bio_set_vec_table()
  block: floppy: use bio_add_page()
  staging: lustre: avoid to use bio->bi_vcnt directly
  target: use bio_is_full()
  bcache: debug: avoid to access .bi_io_vec directly
  bcache: io.c: use bio_set_vec_table
  bcache: journal.c: use bio_set_vec_table()
  bcache: movinggc: use bio_set_vec_table()
  bcache: writeback: use bio_set_vec_table()
  bcache: super: use bio_set_vec_table()
  bcache: super: use bio_get_base_vec
  dm: crypt: use bio_add_page()
  dm: dm-io.c: use bio_get_base_vec()
  dm: dm.c: replace 'bio->bi_vcnt == 1' with !bio_multiple_segments
  dm: dm-bufio.c: use bio_set_vec_table()
  fs: logfs: use bio_set_vec_table()
  fs: logfs: convert to bio_add_page() in sync_request()
  fs: logfs: use bio_add_page() in __bdev_writeseg()
  fs: logfs: use bio_add_page() in do_erase()
  fs: logfs: remove unnecesary check
  kernel/power/swap.c: use bio_get_base_vec()
  mm: page_io.c: use bio_get_base_vec()

 drivers/block/drbd/drbd_bitmap.c|   4 +-
 drivers/block/drbd/drbd_receiver.c  |  14 +---
 drivers/block/floppy.c  |   9 +--
 drivers/block/loop.c|   5 +-
 drivers/block/pktcdvd.c |   3 +-
 drivers/md/bcache/debug.c   |  11 ++-
 drivers/md/bcache/io.c  |   3 +-
 drivers/md/bcache/journal.c |   3 +-
 drivers/md/bcache/movinggc.c|   6 +-
 drivers/md/bcache/super.c   |  28 +---
 drivers/md/bcache/writeback.c   |   4 +-
 drivers/md/dm-bufio.c   |   3 +-
 drivers/md/dm-crypt.c   |   8 +--
 drivers/md/dm-io.c  |   7 +-
 drivers/md/dm.c |   3 +-
 drivers/staging/lustre/lustre/llite/lloop.c |   9 +--
 drivers/target/target_core_pscsi.c  |   2 +-
 fs/logfs/dev_bdev.c | 107 +++-
 include/linux/bio.h |  28 
 kernel/power/swap.c |  10 ++-
 mm/page_io.c|  18 -
 21 files changed, 156 insertions(+), 129 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 0/2] Update SCSI target removal path

2016-04-05 Thread Martin K. Petersen
> "Johannes" == Johannes Thumshirn  writes:

Johannes> This is a follow up to "scsi: Add intermediate STARGET_REMOVE
Johannes> state to scsi_target_state".

James suggested we should let this incubate before hitting stable.

Dropped v3 from 4.6/scsi-fixes and applied v4 to 4.7/scsi-queue.

Thanks!

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/12] BUG: Losing bits on request.cmd_flags

2016-04-05 Thread Shaun Tancheff
On Tue, Apr 5, 2016 at 9:08 AM, Martin K. Petersen
 wrote:
>> "Shaun" == Shaun Tancheff  writes:
>
> Shaun> Oh, okay. It became an issue in the next patch where some
> Shaun> internal cmd_flags temporaries where stored in 32 bit values.
>
> Shaun> I will fix patch/subject.
>
> There's a pending patch set from Mike Christie that cleans all this
> up. Please use that as baseline.

Given Mike Christie's patches this is not needed.
Thanks!

> --
> Martin K. Petersen  Oracle Linux Engineering
-- 
Shaun Tancheff
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v13 0/9] add support for DWC UFS Controller

2016-04-05 Thread Joao Pinto
On 4/5/2016 11:15 AM, Winkler, Tomas wrote:
> 
> Hi,
> 
> On 4/5/2016 12:34 AM, Martin K. Petersen wrote:
>>> "Joao" == Joao Pinto  writes:
>>
>> Joao,
>>
>> Joao> The work consisted of: - Fixed typo in ufshcd-pltfrm.c - Tweak 
>> Joao> ufshcd.c for UFS 2.0 support - Implement ufshcd-dwc which 
>> Joao> contains all DWC HW specific code - Unipro attributes were added 
>> Joao> and new registers were added to the driver - Implement a 
>> Joao> tc-dwc-g210 containing G210 MPHY specific code - Implement a 
>> Joao> tc-dwc-g210 glue platform driver - Implement a tc-dwc-g210 glue 
>> Joao> pci driver - Documentation update
>>
>> You really need to keep track of which Acked-by: and Reviewed-by: tags 
>> you have gotten from people and apply them to patches that you haven't 
>> changed. Otherwise we start from scratch every time you resubmit.
>>
>> Thanks!
>>
> 
> It's ok to submit the same v13 with the ACK tags?
> 
> You can add my Ack on the core patches, not DWC specific, I didn't really 
> look at those properly.
> Thanks
> Tomas 

Nice! Going to send a new v13 with your acks.

> 

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v13 0/9] add support for DWC UFS Controller

2016-04-05 Thread Winkler, Tomas

Hi,

On 4/5/2016 12:34 AM, Martin K. Petersen wrote:
>> "Joao" == Joao Pinto  writes:
> 
> Joao,
> 
> Joao> The work consisted of: - Fixed typo in ufshcd-pltfrm.c - Tweak 
> Joao> ufshcd.c for UFS 2.0 support - Implement ufshcd-dwc which 
> Joao> contains all DWC HW specific code - Unipro attributes were added 
> Joao> and new registers were added to the driver - Implement a 
> Joao> tc-dwc-g210 containing G210 MPHY specific code - Implement a 
> Joao> tc-dwc-g210 glue platform driver - Implement a tc-dwc-g210 glue 
> Joao> pci driver - Documentation update
> 
> You really need to keep track of which Acked-by: and Reviewed-by: tags 
> you have gotten from people and apply them to patches that you haven't 
> changed. Otherwise we start from scratch every time you resubmit.
> 
> Thanks!
> 

It's ok to submit the same v13 with the ACK tags?

You can add my Ack on the core patches, not DWC specific, I didn't really look 
at those properly.
Thanks
Tomas 

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/2] scsi: Add intermediate STARGET_REMOVE state to scsi_target_state

2016-04-05 Thread Johannes Thumshirn
Add intermediate STARGET_REMOVE state to scsi_target_state to avoid
running into the BUG_ON() in scsi_target_reap(). The STARGET_REMOVE
state is only valid in the path from scsi_remove_target() to
scsi_target_destroy() indicating this target is going to be removed.

This re-fixes the problem introduced in commits
bc3f02a795d3b4faa99d37390174be2a75d091bd  and
40998193560dab6c3ce8d25f4fa58a23e252ef38 in a more comprehensive way.

Signed-off-by: Johannes Thumshirn 
Fixes: 40998193560dab6c3ce8d25f4fa58a23e252ef38
Cc: sta...@vger.kernel.org
Reviewed-by: Ewan D. Milne 
Reviewed-by: Hannes Reinecke 
Reviewed-by: James Bottomley 
---
 drivers/scsi/scsi_scan.c   | 2 ++
 drivers/scsi/scsi_sysfs.c  | 2 ++
 include/scsi/scsi_device.h | 1 +
 3 files changed, 5 insertions(+)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 6a82066..63b8bca 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -315,6 +315,8 @@ static void scsi_target_destroy(struct scsi_target *starget)
struct Scsi_Host *shost = dev_to_shost(dev->parent);
unsigned long flags;
 
+   BUG_ON(starget->state != STARGET_REMOVE &&
+  starget->state != STARGET_CREATED);
starget->state = STARGET_DEL;
transport_destroy_device(dev);
spin_lock_irqsave(shost->host_lock, flags);
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 00bc721..0df82e8 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1279,11 +1279,13 @@ restart:
spin_lock_irqsave(shost->host_lock, flags);
list_for_each_entry(starget, >__targets, siblings) {
if (starget->state == STARGET_DEL ||
+   starget->state == STARGET_REMOVE ||
starget == last_target)
continue;
if (starget->dev.parent == dev || >dev == dev) {
kref_get(>reap_ref);
last_target = starget;
+   starget->state = STARGET_REMOVE;
spin_unlock_irqrestore(shost->host_lock, flags);
__scsi_remove_target(starget);
scsi_target_reap(starget);
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index f63a167..2bffaa6 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -240,6 +240,7 @@ scmd_printk(const char *, const struct scsi_cmnd *, const 
char *, ...);
 enum scsi_target_state {
STARGET_CREATED = 1,
STARGET_RUNNING,
+   STARGET_REMOVE,
STARGET_DEL,
 };
 
-- 
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 0/2] Update SCSI target removal path

2016-04-05 Thread Johannes Thumshirn
This is a follow up to "scsi: Add intermediate STARGET_REMOVE state to
scsi_target_state".

Changes to v3:
* Incorporate James' suggestions for the commit messages.
* Re-add accidently dropped Reviewed-by tags.

Changes to v2:
* Reverse the order of patches as pointed out by James.

Changes to v1:
* Fix error (hit BUG_ON()) discovered by the 0-Day bot.
* Revert "scsi: fix soft lockup in scsi_remove_target() on module removal".

Johannes Thumshirn (2):
  scsi: Add intermediate STARGET_REMOVE state to scsi_target_state
  Revert "scsi: fix soft lockup in scsi_remove_target() on module
removal"

 drivers/scsi/scsi_scan.c   | 2 ++
 drivers/scsi/scsi_sysfs.c  | 6 +++---
 include/scsi/scsi_device.h | 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)

-- 
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 2/2] Revert "scsi: fix soft lockup in scsi_remove_target() on module removal"

2016-04-05 Thread Johannes Thumshirn
Now that we've done a more comprehensive fix with the intermediate
target state we can remove the previous hack introduced with commit
90a88d6ef88edcfc4f644dddc7eef4ea41bccf8b.

Signed-off-by: Johannes Thumshirn 
Cc: sta...@vger.kernel.org
Reviewed-by: Ewan D. Milne 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/scsi_sysfs.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 0df82e8..9e5f893 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1272,19 +1272,17 @@ static void __scsi_remove_target(struct scsi_target 
*starget)
 void scsi_remove_target(struct device *dev)
 {
struct Scsi_Host *shost = dev_to_shost(dev->parent);
-   struct scsi_target *starget, *last_target = NULL;
+   struct scsi_target *starget;
unsigned long flags;
 
 restart:
spin_lock_irqsave(shost->host_lock, flags);
list_for_each_entry(starget, >__targets, siblings) {
if (starget->state == STARGET_DEL ||
-   starget->state == STARGET_REMOVE ||
-   starget == last_target)
+   starget->state == STARGET_REMOVE)
continue;
if (starget->dev.parent == dev || >dev == dev) {
kref_get(>reap_ref);
-   last_target = starget;
starget->state = STARGET_REMOVE;
spin_unlock_irqrestore(shost->host_lock, flags);
__scsi_remove_target(starget);
-- 
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v13 0/9] add support for DWC UFS Controller

2016-04-05 Thread Joao Pinto
Hi,

On 4/5/2016 12:34 AM, Martin K. Petersen wrote:
>> "Joao" == Joao Pinto  writes:
> 
> Joao,
> 
> Joao> The work consisted of: - Fixed typo in ufshcd-pltfrm.c - Tweak
> Joao> ufshcd.c for UFS 2.0 support - Implement ufshcd-dwc which contains
> Joao> all DWC HW specific code - Unipro attributes were added and new
> Joao> registers were added to the driver - Implement a tc-dwc-g210
> Joao> containing G210 MPHY specific code - Implement a tc-dwc-g210 glue
> Joao> platform driver - Implement a tc-dwc-g210 glue pci driver -
> Joao> Documentation update
> 
> You really need to keep track of which Acked-by: and Reviewed-by: tags
> you have gotten from people and apply them to patches that you haven't
> changed. Otherwise we start from scratch every time you resubmit.
> 
> Thanks!
> 

It's ok to submit the same v13 with the ACK tags?

Joao
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html