Re: tcm_loopback broken in for-next of target-pending

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sebastian,

On Fri, 2012-11-30 at 10:50 +0100, Sebastian Andrzej Siewior wrote:
> nab, your next tree is broken. I have here file backend setup with
> tcm_loopback. Since commit 8f9f44f8 in your for-next branch of
> git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
> 

So far I've been trying to reproduce with for-next + master code with a
FILEIO + xfs on top, but am not having any luck triggering this bug as
of yet.

> I get
> 
>    SCSI subsystem initialized
>    Rounding down aligned max_sectors from 4294967295 to 8388600
>    scsi0 : TCM_Loopback
>    scsi 0:0:1:0: Direct-Access     LIO-ORG  FILEIO           4.0  PQ: 0 
> ANSI: 5
>    sd 0:0:1:0: [sda] 61441 512-byte logical blocks: (31.4 MB/30.0 MiB)
>    sd 0:0:1:0: [sda] Write Protect is off
>    sd 0:0:1:0: [sda] Mode Sense: 2f 00 00 00
>    sd 0:0:1:0: [sda] Write cache: disabled, read cache: enabled, doesn't 
> support DPO or FUA
>     sda: sda1
>    sd 0:0:1:0: [sda] Attached SCSI disk
>    sd 0:0:1:0: Attached scsi generic sg0 type 0
>    SGI XFS with security attributes, no debug enabled
>    XFS (sda1): Mounting Filesystem
>    XFS (sda1): Ending clean mount
>    vfs_readv() returned -14 for non S_ISBLK
>    sd 0:0:1:0: [sda]
>    Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
>    sd 0:0:1:0: [sda]
>    Sense Key : Illegal Request [current]
>    sd 0:0:1:0: [sda]
>    <<vendor>> ASC=0x80 ASCQ=0x0ASC=0x80 ASCQ=0x0
>    sd 0:0:1:0: [sda] CDB:
>    Read(10): 28 00 00 00 30 3d 00 00 80 00
>    end_request: I/O error, dev sda, sector 12349

Ok, this looks like a perfectly normal READ_10 of 64K (128 sectors) to
LBA 12349.

Not sure why vfs_readv() of 64K is generating an -EFAULT here, but lets
first verify that SGLs being dispatched by tcm_loop to TCM -> FILEIO are
looking as expected on your setup.

Please try to reproduce with the following patch:

diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index 8f6dae0..0a46137 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -261,6 +261,11 @@ static int fd_do_readv(struct se_cmd *cmd, struct scatterlist *sgl,
                if (ret < 0) {
                        pr_err("vfs_readv() returned %d for non"
                                " S_ISBLK\n", ret);
+
+                       for_each_sg(sgl, sg, sgl_nents, i) {
+                               pr_err("SG[%d]: %p page: %p length: %u offset: %d\n",
+                                       i, sg, sg_page(sg), sg->length, sg->offset);
+                       }
                        return ret;
                }
        }

>    vfs_readv() returned -14 for non S_ISBLK
>    sd 0:0:1:0: [sda]
>    Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
>    sd 0:0:1:0: [sda]
>    Sense Key : Illegal Request [current]
>    sd 0:0:1:0: [sda]
>    <<vendor>> ASC=0x80 ASCQ=0x0ASC=0x80 ASCQ=0x0
>    sd 0:0:1:0: [sda] CDB:
>    Read(10): 28 00 00 00 30 3d 00 00 08 00
>    end_request: I/O error, dev sda, sector 12349
>   sha1sum: /mnt/sdb/libc-2.11.2.so: Input/output error
> 
> It wirks one commit before the commit I mentioned. The commit in
> question is:
> 
> commit 8f9f44f8957b262de717a48269a5ceca36c2b504
> Author: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
> Date:   Mon Oct 1 23:29:49 2012 -0700
> 
>      tcm_loop: Convert I/O path to use target_submit_cmd_map_sgls
> 
>      This patch converts tcm_loop to use target_submit_cmd_map_sgls() for
>      I/O submission and mapping of pre-allocated SGL memory from incoming
>      scsi_cmnd -> se_cmd descriptors.
> 
>      This includes removing the original open-coded fabric uses of target
>      core callers to support transport_generic_map_mem_to_cmd() between
>      target_setup_cmd_from_cdb() and transport_handle_cdb_direct() logic.
> 
>      (v2: Use renamed target_submit_cmd_map_sgls)
> 
>      Reported-by: Christoph Hellwig <hch@xxxxxx>
>      Reviewed-by: Christoph Hellwig <hch@xxxxxx>
>      Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
> 

Very strange.  This is a non functional change for tcm_loop code using
the exact same underlying target_core_mod functions for se_cmd setup ->
SGL mapping -> se_cmd I/O dispatch ub target_submit_cmd_map_sg(), so I
don't see how it would effect this bug.

Thanks for reporting!

--nab

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


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux