Re: [PATCH v3] scsi: tcmu: avoid cmd/qfull timers updated whenever a new cmd comes

2018-11-21 Thread Mike Christie
On 11/20/2018 11:37 PM, Xiubo Li wrote: > [...] >>> -is_running = list_empty(>cmdr_queue_entry); >>> +is_running = test_bit(TCMU_CMD_BIT_INFLIGHT, >flags); >>> se_cmd = cmd->se_cmd; >>> if (is_running) { >>> @@ -1289,7 +1319,6 @@ static int tcmu_check_expired_cmd(int id, void

Re: [PATCH v5] target: add emulate_pr backstore attr to toggle PR support

2018-11-20 Thread Mike Christie
cent VMware ESXi initiators. > - Allowing clustered (e.g. tcm-user) backends to block such requests, > avoiding the multi-node reservation state propagation. > > When explicitly disabled, PR and RESERVE/RELEASE requests receive > Invalid Command Operation Code response sense data. > Reviewed-by: Mike Christie

Re: [PATCH v3] scsi: tcmu: avoid cmd/qfull timers updated whenever a new cmd comes

2018-11-20 Thread Mike Christie
On 10/17/2018 02:54 AM, xiu...@redhat.com wrote: > From: Xiubo Li > > Currently there has one cmd timeout timer and one qfull timer for > each udev, and whenever there has any new coming cmd it will update > the cmd timer or qfull timer. And for some corner case the timers > are always working

Re: [PATCH v4] target: add emulate_pr backstore attr to toggle PR support

2018-11-06 Thread Mike Christie
On 10/30/2018 09:26 AM, David Disseldorp wrote: > The new emulate_pr backstore attribute allows for Persistent Reservation > and SCSI2 RESERVE/RELEASE support to be completely disabled. This can be > useful for scenarios such as: > - Ensuring ATS (Compare & Write) usage on recent VMware ESXi

Re: [RFC PATCH 0/3] target: remove some unused stats

2018-10-30 Thread Mike Christie
On 10/29/2018 06:00 PM, David Disseldorp wrote: > On Wed, 17 Oct 2018 17:48:17 +0200, David Disseldorp wrote: > >> This patchset removes a couple of unused error stat counters and a >> redundant cumulative counter. >> I've tagged this patchset RFC, as it may be considered a kernel<->user >>

Re: [PATCH] scsi: ibmvscsi_tgt: Remove target_wait_for_sess_cmd()

2018-10-17 Thread Mike Christie
nexus(struct ibmvscsis_tport > *tport) > /* >* Release the SCSI I_T Nexus to the emulated ibmvscsis Target Port >*/ > - target_wait_for_sess_cmds(se_sess); > target_remove_session(se_sess); > tport->ibmv_nexus = NULL; > kfree(nexus); > Reviewed-by: Mike Christie

Re: [PATCH] scsi: tcmu: setup one timeout timer for each cmd

2018-09-18 Thread Mike Christie
On 09/18/2018 05:32 AM, xiu...@redhat.com wrote: > From: Xiubo Li > > Currently there has one cmd timeout timer for each udev, and whenever > there has any new coming cmd it will update the timer. And for some > corner case the timer is always working only for the ringbuffer's > newest cmd.

Re: [PATCH v5] target/iblock: split T10 PI SGL across command bios

2018-09-13 Thread Mike Christie
> > Changes from v1: > * expand commit message > * use an sg_mapping_iter to track where we are in the PI SGL > Looks ok to me. Reviewed-by: Mike Christie

Re: [PATCH v4] target/iblock: split T10 PI SGL across command bios

2018-09-04 Thread Mike Christie
On 09/04/2018 11:21 AM, Greg Edwards wrote: > static int > -iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio) > +iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio, > + struct sg_mapping_iter *miter) > { > struct se_device *dev = cmd->se_dev; > struct blk_integrity

Re: [PATCH v3] target/iblock: split T10 PI SGL across command bios

2018-08-30 Thread Mike Christie
> + rc = iblock_alloc_bip(cmd, bio, _miter); > + if (rc) > + goto fail_put_bios; > + } > + > if (bio_cnt >= IBLOCK_MAX_BIO_PER_TASK) { > iblock_submit_bios(); > bio_cnt = 0; > @@ -762,7 +782,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist > *sgl, u32 sgl_nents, > } > > if (cmd->prot_type && dev->dev_attrib.pi_prot_type) { > - int rc = iblock_alloc_bip(cmd, bio_start); > + rc = iblock_alloc_bip(cmd, bio, _miter); > if (rc) > goto fail_put_bios; > } > Seems ok to me. Reviewed-by: Mike Christie

Re: [PATCH v2] target/iblock: split T10 PI SGL across command bios

2018-08-29 Thread Mike Christie
On 08/29/2018 03:36 PM, Greg Edwards wrote: > When T10 PI is enabled on a backing device for the iblock backstore, the > PI SGL for the entire command is attached to the first bio only. This > works fine if the command is covered by a single bio, but can result in > ref tag errors in the client

[PATCH 1/2] iscsi target: Set conn->sess to NULL when iscsi_login_set_conn_values fails

2018-08-27 Thread Mike Christie
00 00 00 == Signed-off-by: Vincent Pelletier [rebased against idr/ida changes and to handle ret review comments from Matthew] Signed-off-by: Mike Christie Cc: Matthew Wilcox --- v2: - Rebase against Linus's tree with idr/ida changes. - Always return -ENOMEM on failure because ca

[PATCH 0/2] iscsi target: login fixes

2018-08-27 Thread Mike Christie
The following patches are login fixes from the list. The set has been rebased against Linus's current tree so they apply over the idr/ida patches that have been merged.

[PATCH 2/2] iscsi target: fix conn_ops double free

2018-08-27 Thread Mike Christie
that are only needed during login. Signed-off-by: Mike Christie --- drivers/target/iscsi/iscsi_target.c | 9 +- drivers/target/iscsi/iscsi_target_login.c | 141 -- drivers/target/iscsi/iscsi_target_login.h | 2 +- 3 files changed, 77 insertions(+), 75

Re: [PATCH 0/3]: iscsi target login fixes

2018-08-27 Thread Mike Christie
On 08/27/2018 12:03 AM, Matthew Wilcox wrote: > On Fri, Aug 24, 2018 at 01:37:10PM -0500, Mike Christie wrote: >> The following patchset is a round up of login fixes that have been >> on the list and in Mathew's tree. They fix a couple of bugs in the >> iscsi login

[PATCH 3/3] iscsi target: fix conn_ops double free

2018-08-24 Thread Mike Christie
that are only needed during login. Signed-off-by: Mike Christie --- drivers/target/iscsi/iscsi_target.c | 9 +- drivers/target/iscsi/iscsi_target_login.c | 141 -- drivers/target/iscsi/iscsi_target_login.h | 2 +- 3 files changed, 77 insertions(+), 75

[PATCH 0/3]: iscsi target login fixes

2018-08-24 Thread Mike Christie
The following patchset is a round up of login fixes that have been on the list and in Mathew's tree. They fix a couple of bugs in the iscsi login failure handling path. The patches were made against Martin's 4.19/scsi-queue branch. Matthew, the first patch is one that I had sent to you that had

[PATCH 2/3] iscsi target: Set conn->sess to NULL when iscsi_login_set_conn_values fails

2018-08-24 Thread Mike Christie
00 00 00 == Also, let idr_alloc return value through instead of replacing it with -ENOMEM, as it is already a negative value and caller checks sign, not exact value. Signed-off-by: Vincent Pelletier Signed-off-by: Mike Christie --- drivers/target/iscsi/iscsi_target_log

[PATCH 1/3] iscsi target: fix session creation failure handling

2018-08-24 Thread Mike Christie
cation leak in...") Signed-off-by: Mike Christie Cc: Matthew Wilcox --- drivers/target/iscsi/iscsi_target_login.c | 35 ++- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_targ

Re: [PATCHv2] iscsi target: Set conn->sess to NULL when iscsi_login_set_conn_values fails

2018-08-24 Thread Mike Christie
On 08/23/2018 09:11 PM, Martin K. Petersen wrote: > > Mike, > >> this was made over that patch that was going through Mathew's tree. I >> do not know exactly which one though. It is in next here > > Doesn't look like Linus will pull Matthew's tree for 4.19. > It looks like there is also going

Re: [PATCH] target/iblock: split T10 PI SGL across command bios

2018-08-21 Thread Mike Christie
On 08/08/2018 02:31 PM, Greg Edwards wrote: > When T10 PI is enabled on a backing device for the iblock backstore, the > PI SGL for the entire command is attached to the first bio only. This > works fine if the command is covered by a single bio, but results in > integrity verification errors for

Re: [PATCHv2] iscsi target: Set conn->sess to NULL when iscsi_login_set_conn_values fails

2018-08-15 Thread Mike Christie
EM; > goto remove_idr; > } > > @@ -356,6 +355,7 @@ static int iscsi_login_zero_tsih_s1( > if (IS_ERR(sess->se_sess)) { > iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, > ISCSI_LOGIN_STATUS_N

Re: iscsi target: Set conn->sess to NULL when iscsi_login_set_conn_values fails

2018-08-15 Thread Mike Christie
On 08/15/2018 10:59 AM, Mike Christie wrote: > On 08/15/2018 05:19 AM, Vincent Pelletier wrote: >> Fixes a use-after-free reported by KASAN when later >> iscsi_target_login_sess_out gets called and it tries to access >> conn->sess->se_sess: >> >> Disab

Re: iscsi target: Set conn->sess to NULL when iscsi_login_set_conn_values fails

2018-08-15 Thread Mike Christie
nn, ISCSI_STATUS_CLS_TARGET_ERR, > ISCSI_LOGIN_STATUS_NO_RESOURCES); > + ret = -ENOMEM; > goto free_sess; > } > > @@ -370,7 +369,7 @@ static int iscsi_login_zero_tsih_s1( > free_sess: > kfree(sess); >

Re: iscsi target: Set conn->sess to NULL when iscsi_login_set_conn_values fails

2018-08-15 Thread Mike Christie
On 08/15/2018 10:44 AM, Mike Christie wrote: > On 08/15/2018 05:19 AM, Vincent Pelletier wrote: >> Fixes a use-after-free reported by KASAN when later >> iscsi_target_login_sess_out gets called and it tries to access >> conn->sess->se_sess: >> >> Disab

Re: iscsi target: Set conn->sess to NULL when iscsi_login_set_conn_values fails

2018-08-15 Thread Mike Christie
On 08/15/2018 05:19 AM, Vincent Pelletier wrote: > Fixes a use-after-free reported by KASAN when later > iscsi_target_login_sess_out gets called and it tries to access > conn->sess->se_sess: > > Disabling lock debugging due to kernel taint > iSCSI Login timeout on Network Portal [::]:3260 > iSCSI

Re: BUG in slab_free after iSCSI login timeout

2018-08-13 Thread Mike Christie
On 08/13/2018 04:42 PM, Mike Christie wrote: > On 08/13/2018 02:48 PM, Mike Christie wrote: >> On 08/11/2018 10:51 PM, Vincent Pelletier wrote: >>> On Sun, 12 Aug 2018 02:55:31 +, Vincent Pelletier >>> wrote: >>>> Aug 12 04:44:53 boke kernel: [

Re: BUG in slab_free after iSCSI login timeout

2018-08-13 Thread Mike Christie
On 08/13/2018 02:48 PM, Mike Christie wrote: > On 08/11/2018 10:51 PM, Vincent Pelletier wrote: >> On Sun, 12 Aug 2018 02:55:31 +, Vincent Pelletier >> wrote: >>> Aug 12 04:44:53 boke kernel: [ 64.737069] BUG: KASAN: use-after-free in >>> iscsi_target_

Re: BUG in slab_free after iSCSI login timeout

2018-08-13 Thread Mike Christie
On 08/11/2018 10:51 PM, Vincent Pelletier wrote: > On Sun, 12 Aug 2018 02:55:31 +, Vincent Pelletier > wrote: >> Aug 12 04:44:53 boke kernel: [ 64.737069] BUG: KASAN: use-after-free in >> iscsi_target_login_sess_out.cold.11+0x58/0x123 [iscsi_target_mod] >> Aug 12 04:44:53 boke kernel: [

Re: [PATCH RESEND v2] target: move the rx hdr buffer out of the stack

2018-08-07 Thread Mike Christie
On 08/03/2018 03:48 AM, Maurizio Lombardi wrote: > When HeaderDigest is enabled on aarch64 machines, target triggers > a lot of failed crc checksum errors: > > example of output in dmesg: > [ 154.495031] HeaderDigest CRC32C failed, received 0x60571c8d, computed > 0x288c3ab9 > [ 154.583821] Got

[PATCH 0/8] target: a misc lock fix and some cleanup

2018-08-02 Thread Mike Christie
The following patches were made over Martin's for-next branch. They are the patches from my session RFC patchset that were reviewed by Bart and Christoph and are fixes/cleanups that I think are ok changes in general.

[PATCH 1/8] target: fix __transport_register_session locking

2018-08-02 Thread Mike Christie
the save/restore call. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig --- drivers/target/target_core_transport.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target

[PATCH 5/8] target: add session removal function

2018-08-02 Thread Mike Christie
This adds a function to remove a session which should be used by drivers that use target_setup_session. The next patches will convert the target drivers to use this new function. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Cc: Chris Boot Cc: Bryant

[PATCH 6/8] target: srp, vscsi, sbp, qla: use target_remove_session

2018-08-02 Thread Mike Christie
This converts the drivers that called transport_deregister_session_configfs and then immediately called transport_deregister_session to use target_remove_session. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Cc: Chris Boot Cc: Bryant G. Ly Cc

[PATCH 8/8] target: loop, usb, vhost, xen: use target_remove_session

2018-08-02 Thread Mike Christie
tpg and sess->fabric_sess_ptr from configfs accessible functions, so they will see no difference. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Cc: Felipe Balbi Cc: Sebastian Andrzej Siewior Cc: Andrzej Pietrasiewicz Cc: Michael S. Tsirkin Cc: J

[PATCH 7/8] tcm_fc: use target_remove_session

2018-08-02 Thread Mike Christie
transport_deregister_session_configfs only prevents access from configfs via tpg removal and its call to the close_session callback for that driver, and this is already protected by the ft_lport_lock and its port lookup handling. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche Reviewed

[PATCH 4/8] target: rename target_alloc_session

2018-08-02 Thread Mike Christie
will then add a remove function to match the setup in this one, so it should make sense for all drivers, except iscsi, to just call those 2 functions to setup and remove a session. iscsi will continue to be the odd driver. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche Reviewed

[PATCH 2/8] iscsi target: have iscsit_start_nopin_timer call __iscsit_start_nopin_timer

2018-08-02 Thread Mike Christie
Just have iscsit_start_nopin_timer grab the lock and call __iscsit_start_nopin_timer. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/target/iscsi/iscsi_target_util.c | 20 +--- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/target

Re: [PATCH 11/15] target: export initiator port values for all sessions

2018-08-01 Thread Mike Christie
On 08/01/2018 11:44 AM, Mike Christie wrote: > 1. Create a file named "acl" in the session's dir. > 2. For dynamic_node_acl=0 the acl file will return a empty string or Miswrote this. Above should be dynamic_node_acl=1 > "generate_node_acls=1" or "demo mode ena

Re: [PATCH 11/15] target: export initiator port values for all sessions

2018-08-01 Thread Mike Christie
On 07/19/2018 12:07 PM, Bart Van Assche wrote: > On Thu, 2018-07-19 at 11:38 -0500, Mike Christie wrote: >> On 07/19/2018 10:37 AM, Bart Van Assche wrote: >>> The general recommendation for configfs is that each attribute contains a >>> single value, just like for sys

[PATCH 9/9] tcmu: use u64 for dev_size

2018-07-23 Thread Mike Christie
We use unsigned long, size_t and u64 for dev_size. This has us standardize on u64. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 21 - 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers/target

[PATCH 5/9] tcmu: check if dev is configured before block/reset

2018-07-23 Thread Mike Christie
Do not allow userspace to block or reset the ring until the device has been configured. This will prevent the bug where userspace can write to those files and access mb_addr before it has been setup. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 10 ++ 1 file

[PATCH 4/9] tcmu: use lio core se_device configuration helper

2018-07-23 Thread Mike Christie
Use the lio core helper to check if the device is configured. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index b010ed7

[PATCH 8/9] tcmu: use match_int for dev params

2018-07-23 Thread Mike Christie
-off-by: Mike Christie --- drivers/target/target_core_user.c | 37 ++--- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 969ccba..cfe4f4b 100644 --- a/drivers/target

[PATCH 7/9] tcmu: do not set max_blocks if data_bitmap has been setup

2018-07-23 Thread Mike Christie
if data_bitmap has been setup. If it has then we fail the max_blocks update operation. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 73 +-- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/drivers/target/target_core_user.c b

[PATCH 0/9] tcmu: configuration fixes and cleanups

2018-07-23 Thread Mike Christie
The following patches were made over Martin's for-next branch. The first patch fixes a locking bug in the command setup path. The rest of the patches fix several bugs and cleanup the setup and configuration code paths.

[PATCH 2/9] tcmu: initialize list head

2018-07-23 Thread Mike Christie
Use INIT_LIST_HEAD to initialize node list head. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index fafe65f..b010ed7 100644 --- a/drivers/target

[PATCH 6/9] tcmu: unmap if dev is configured

2018-07-23 Thread Mike Christie
The tcmu dev is added to the list of tcmu devices during configuration. At this time the tcmu setup has completed, but lio core has not completed its setup. The device is not yet usable so do not try to unmap blocks from it Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 5

[PATCH 3/9] target: add helper to check if dev is configured

2018-07-23 Thread Mike Christie
This just adds a helper function to check if a device is configured and it converts the target users to use it. The next patch will add a backend module user so those types of modules do not have to know the lio core details. Signed-off-by: Mike Christie --- drivers/target

[PATCH 1/9] target_core_user: fix double unlock

2018-07-23 Thread Mike Christie
The caller of queue_cmd_ring grabs and releases the lock, so the tcmu_setup_cmd_timer failure handling inside queue_cmd_ring should not call mutex_unlock. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/target

Re: [PATCH 02/15] target: fix isid copying and comparision

2018-07-20 Thread Mike Christie
On 07/20/2018 04:08 PM, Mike Christie wrote: > On 07/19/2018 11:13 AM, Mike Christie wrote: >> > On 07/19/2018 10:15 AM, Bart Van Assche wrote: >>> >> On Wed, 2018-07-18 at 20:02 -0500, Mike Christie wrote: >>>> >>> On 07/18/2018 07:03 PM, Mike C

Re: [PATCH 02/15] target: fix isid copying and comparision

2018-07-20 Thread Mike Christie
On 07/19/2018 11:13 AM, Mike Christie wrote: > On 07/19/2018 10:15 AM, Bart Van Assche wrote: >> On Wed, 2018-07-18 at 20:02 -0500, Mike Christie wrote: >>> On 07/18/2018 07:03 PM, Mike Christie wrote: >>>> On 07/18/2018 05:09 PM, Bart Van Assche wrote: >>>

Re: [PATCH] tcmu: fix crash for dereferencing the released udev->mb_addr memory

2018-07-20 Thread Mike Christie
On 07/19/2018 07:34 PM, Xiubo Li wrote: > On 2018/7/19 23:49, Mike Christie wrote: >> On 07/19/2018 09:30 AM, xiu...@redhat.com wrote: >>> From: Xiubo Li >>> >>> The logs are: >>> >>> BUG: unable to handle kernel NULL pointer dereference at 0

Re: [PATCH 11/15] target: export initiator port values for all sessions

2018-07-19 Thread Mike Christie
On 07/19/2018 03:47 PM, Christoph Hellwig wrote: > On Thu, Jul 19, 2018 at 05:07:59PM +, Bart Van Assche wrote: >> Initially configfs did not support creation of a directory from the kernel >> side. Last time I brought this up with Christoph he replied that this >> functionality has been added

Re: [PATCH 11/15] target: export initiator port values for all sessions

2018-07-19 Thread Mike Christie
On 07/19/2018 10:37 AM, Bart Van Assche wrote: > On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: >> +if (se_sess->se_tpg->se_tpg_tfo->sess_get_initiator_sid) { >> +len = snprintf(page, PAGE_SIZE, "%s 0x%6phN\n", >> +

Re: [PATCH 02/15] target: fix isid copying and comparision

2018-07-19 Thread Mike Christie
On 07/19/2018 10:15 AM, Bart Van Assche wrote: > On Wed, 2018-07-18 at 20:02 -0500, Mike Christie wrote: >> On 07/18/2018 07:03 PM, Mike Christie wrote: >>> On 07/18/2018 05:09 PM, Bart Van Assche wrote: >>>> [ ... ] >>>> is that these involve a transpo

Re: [PATCH] tcmu: fix crash for dereferencing the released udev->mb_addr memory

2018-07-19 Thread Mike Christie
On 07/19/2018 09:30 AM, xiu...@redhat.com wrote: > From: Xiubo Li > > The logs are: > > BUG: unable to handle kernel NULL pointer dereference at 0040 > IP: [] tcmu_reset_ring_store+0x149/0x240 [target_core_user] > PGD 8e254067 PUD e255067 PMD 0 > Oops: 0002 [#1] SMP > [...]

Re: [PATCH 04/15] target/iscsi: move session_index to common se_session

2018-07-18 Thread Mike Christie
On 07/18/2018 07:15 PM, Mike Christie wrote: > On 07/18/2018 05:19 PM, Bart Van Assche wrote: >> On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: >>> diff --git a/drivers/target/target_core_transport.c >>> b/drivers/target/target_core_transport.c >&g

Re: [PATCH 11/15] target: export initiator port values for all sessions

2018-07-18 Thread Mike Christie
On 07/18/2018 06:04 PM, Mike Christie wrote: > On 07/18/2018 05:41 PM, Bart Van Assche wrote: >> On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: >>> Export the initiator port info in configfs >> >> Does configfs support soft links? Can this information be e

Re: [PATCH 02/15] target: fix isid copying and comparision

2018-07-18 Thread Mike Christie
On 07/18/2018 07:03 PM, Mike Christie wrote: > On 07/18/2018 05:09 PM, Bart Van Assche wrote: >> On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: >>> The isid is 48 bits, and in hex string format it's 12 bytes. >>> We are currently copying the 12 byte hex st

Re: [PATCH 12/15] target: add callout to test a session

2018-07-18 Thread Mike Christie
On 07/18/2018 05:46 PM, Bart Van Assche wrote: > On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: >> + int (*test_session)(struct se_session *, u8 timeout); > > Does any of the patches in this series define a test_session callback > function? Patch 14 does. >

Re: [PATCH 04/15] target/iscsi: move session_index to common se_session

2018-07-18 Thread Mike Christie
On 07/18/2018 05:19 PM, Bart Van Assche wrote: > On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: >> diff --git a/drivers/target/target_core_transport.c >> b/drivers/target/target_core_transport.c >> index 75ddbbb..97a1ee5 100644 >> --- a/drivers/target/targe

Re: [PATCH 02/15] target: fix isid copying and comparision

2018-07-18 Thread Mike Christie
On 07/18/2018 05:09 PM, Bart Van Assche wrote: > On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: >> The isid is 48 bits, and in hex string format it's 12 bytes. >> We are currently copying the 12 byte hex string to a u64 >> so we can easily compare it, but this has the

Re: [PATCH 11/15] target: export initiator port values for all sessions

2018-07-18 Thread Mike Christie
On 07/18/2018 05:41 PM, Bart Van Assche wrote: > On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: >> Export the initiator port info in configfs > > Does configfs support soft links? Can this information be exported as a > soft link from the session directory to the stru

Re: [PATCH 09/15] target: add session dir in configfs

2018-07-16 Thread Mike Christie
On 07/15/2018 06:16 PM, Mike Christie wrote: > TODO: > 1. handle target_fabric_register_session failure in iscsi target. > I fixed this in the updated attached patch. So Bodo and reviewers please use that instead. >From 895edd5d20df208c3dfae8d826a3c3fcbd68 Mon Sep 17 00:00:00 200

[PATCH 11/15] target: export initiator port values for all sessions

2018-07-15 Thread Mike Christie
Export the initiator port info in configfs Signed-off-by: Mike Christie --- drivers/target/target_core_fabric_configfs.c | 48 1 file changed, 48 insertions(+) diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c

[PATCH 12/15] target: add callout to test a session

2018-07-15 Thread Mike Christie
port. Signed-off-by: Mike Christie --- drivers/target/iscsi/iscsi_target_login.c| 2 +- drivers/target/target_core_fabric_configfs.c | 71 ++-- drivers/target/target_core_transport.c | 20 +--- include/target/target_core_base.h| 1 + include

[PATCH 14/15] iscsi target: add test_session callout

2018-07-15 Thread Mike Christie
Send a iscsi nop as a ping for the test_session callout. Signed-off-by: Mike Christie --- drivers/target/iscsi/iscsi_target.c | 8 ++-- drivers/target/iscsi/iscsi_target_configfs.c | 47 ++ drivers/target/iscsi/iscsi_target_util.c | 60

[PATCH 10/15] target: add lock around session fields exported in configfs

2018-07-15 Thread Mike Christie
the session has been full registered. Signed-off-by: Mike Christie --- drivers/target/target_core_transport.c | 13 +++-- include/target/target_core_base.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target

[PATCH 13/15] iscsi target: check nopin_response_timeout before starting timer

2018-07-15 Thread Mike Christie
it on for the user initiated test nop. Signed-off-by: Mike Christie --- drivers/target/iscsi/iscsi_target_util.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 5a645b5..c51c14e

[PATCH 15/15] iscsi target: merge iscsit_start_nopin_timer and __iscsit_start_nopin_timer

2018-07-15 Thread Mike Christie
Just have iscsit_start_nopin_timer grab the lock and call __iscsit_start_nopin_timer. Signed-off-by: Mike Christie --- drivers/target/iscsi/iscsi_target_util.c | 20 +--- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_util.c b

[PATCH 09/15] target: add session dir in configfs

2018-07-15 Thread Mike Christie
dir under the tpg. We can then export info like initiator name and if needed isid. These patches will then also add some files to test sessions. TODO: 1. handle target_fabric_register_session failure in iscsi target. Signed-off-by: Mike Christie --- drivers/target/iscsi/iscsi_target.c

[PATCH 06/15] target: make transport_init_session_tags static

2018-07-15 Thread Mike Christie
transport_init_session_tags is only called from target_core_transport.c so make it static. Signed-off-by: Mike Christie --- drivers/target/target_core_transport.c | 7 +++ include/target/target_core_fabric.h| 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers

[PATCH 05/15] target: remove sess_get_index

2018-07-15 Thread Mike Christie
out. Signed-off-by: Mike Christie --- Documentation/target/tcm_mod_builder.py | 8 drivers/infiniband/ulp/srpt/ib_srpt.c| 15 --- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 6 -- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 7 --- drivers/target/is

[PATCH 02/15] target: fix isid copying and comparision

2018-07-15 Thread Mike Christie
hex2bin to when converting from the hex sting to the bin value. Signed-off-by: Mike Christie --- drivers/target/target_core_pr.c| 20 drivers/target/target_core_transport.c | 3 ++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/target

[PATCH 08/15] target: add session removal function

2018-07-15 Thread Mike Christie
tup/remove session functions and we let it to continue to go wild with it calling the lower level functions directly. Signed-off-by: Mike Christie --- drivers/infiniband/ulp/srpt/ib_srpt.c| 3 +-- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 3 +-- drivers/scsi/qla2xxx/tcm_qla2xxx.c

[PATCH 01/15] configfs: fix registered group removal

2018-07-15 Thread Mike Christie
of unregistration. Sorry if you are getting this multiple times. I thouhgt I sent this to some of you and lkml, but I do not see it. Signed-off-by: Mike Christie Cc: Christoph Hellwig Cc: Joel Becker --- fs/configfs/dir.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/fs/configfs/dir.c b/fs

[PATCH 07/15] target: rename target_alloc_session

2018-07-15 Thread Mike Christie
will then add a remove function to match the setup in this one, so it should make sense for all drivers, except iscsi, to just call those 2 functions to setup and remove a session. iscsi will continue to be the odd driver. Signed-off-by: Mike Christie --- drivers/infiniband/ulp/srpt/ib_srpt.c| 6

[RFC PATCH 00/15] target: export session info

2018-07-15 Thread Mike Christie
Currently, session info is in 3 places: 1. iscsi has the info file under initiator acls. 2. In the tpg dir iscsi and qla have the dynamic sessions. 3. Some lun stat files return some initiator info. The problem with these is for: 1 and 3 - They only display 1 session's info per target port.

[PATCH 04/15] target/iscsi: move session_index to common se_session

2018-07-15 Thread Mike Christie
The next patches will make session$SID dir for each session so move the iscsi session session_index to the se_session. This differs from the previous code in that it now uses idr_alloc_cyclic to help prevent apps from confusing a reused sid with a previous session. Signed-off-by: Mike Christie

[PATCH 03/15] target: fix __transport_register_session locking

2018-07-15 Thread Mike Christie
the save/restore call. Signed-off-by: Mike Christie --- drivers/target/target_core_transport.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 6324743..75ddbbb 100644 --- a/drivers/target

[PATCH 1/1] tcmu: Don't pass KERN_ERR to pr_err

2018-06-26 Thread Mike Christie
Fix warning: smatch warnings: drivers/target/target_core_user.c:301 tcmu_genl_cmd_done() warn: KERN_* level not at start of string Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target

[PATCH 4/6] tcmu: misc nl code cleanup

2018-06-22 Thread Mike Christie
Some misc cleanup of the nl rework patches. 1. Fix space instead of tabs use and extra newline. 2. Drop initializing variables to 0 when not needed 3. Just pass the skb_buff and msg_header pointers to tcmu_netlink_event_send. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c

[PATCH 3/6] tcmu: simplify nl interface

2018-06-22 Thread Mike Christie
/remove is still executing does not make sense. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 73a5768

[PATCH 6/6] target: remove target_find_device

2018-06-22 Thread Mike Christie
target_find_device is no longer used, so remove it. Signed-off-by: Mike Christie --- drivers/target/target_core_device.c | 24 include/target/target_core_backend.h | 2 -- 2 files changed, 26 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers

[PATCH 5/6] tcmu: add module wide block/reset_netlink support

2018-06-22 Thread Mike Christie
and then reopen the netlink socket and unblock it to allow new requests. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 100 -- 1 file changed, 97 insertions(+), 3 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers

tcmu: fix hung netlink requests and nl related cleanup V2

2018-06-22 Thread Mike Christie
The following patches fix the issues where the userspace daemon has crashed and left netlink requests dangling. The daemon can now block the interface, kill outstanding requests, reopen the netlink socket and then unblock and execute new requests. The patches were made over Martin's for-next

[PATCH 2/6] tcmu: track nl commands

2018-06-22 Thread Mike Christie
The next patch is going to fix the hung nl command issue so this adds a list of outstanding nl commands that we can later abort when the daemon is restarted. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 68 ++- 1 file changed, 39

[PATCH 1/6] tcmu: delete unused __wait

2018-06-22 Thread Mike Christie
When this code change this was never cleaned up. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index e4a76f9..898a561 100644 --- a/drivers/target

Re: [PATCH 3/3] tcmu: add module wide block/reset_netlink support

2018-06-21 Thread Mike Christie
On 06/21/2018 10:52 PM, Mike Christie wrote: > +static int tcmu_set_block_netlink(const char *str, > + const struct kernel_param *kp) > +{ > + int ret; > + u8 val; > + > + ret = kstrtou8(str, 0, ); > + if (ret < 0)

[PATCH 2/3] tcmu: track nl commands

2018-06-21 Thread Mike Christie
The next patch is going to fix the hung nl command issue so this adds a list of outstanding nl commands that we can later abort when the daemon is restarted. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 68 ++- 1 file changed, 39

[PATCH 1/3] tcmu: delete unused __wait

2018-06-21 Thread Mike Christie
When this code change this was never cleaned up. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index e4a76f9..898a561 100644 --- a/drivers/target

[PATCH 3/3] tcmu: add module wide block/reset_netlink support

2018-06-21 Thread Mike Christie
and then reopen the netlink socket and unblock it to allow new requests. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 115 +++--- 1 file changed, 107 insertions(+), 8 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers

[PATCH 0/3] tcmu: fix hung netlink requests during restarts

2018-06-21 Thread Mike Christie
The following patches fix the issues where the userspace daemon has crashed and left netlink requests dangling. The daemon can block the interface, kill outstanding requests, reopen the netlink socket and then unblock and execute new requests. The patches were made over Martin's for-next branch.

Re: [PATCH 01/33] TCMU PR: first commit to implement TCMU PR

2018-06-16 Thread Mike Christie
On 06/16/2018 02:20 PM, Mike Christie wrote: > Adding Bodo who is working on a alternative approach. > > On 06/16/2018 12:22 AM, Christoph Hellwig wrote: >> > On Sat, Jun 16, 2018 at 02:23:10AM +0800, Zhu Lingshan wrote: >>> >> These commits and the followi

Re: [PATCH 01/33] TCMU PR: first commit to implement TCMU PR

2018-06-16 Thread Mike Christie
Adding Bodo who is working on a alternative approach. On 06/16/2018 12:22 AM, Christoph Hellwig wrote: > On Sat, Jun 16, 2018 at 02:23:10AM +0800, Zhu Lingshan wrote: >> These commits and the following intend to implement Persistent >> Reservation operations for TCMU devices. > > Err, hell no. >

Re: [PATCH] tcmu: remove useless code and clean up the code style.

2018-06-07 Thread Mike Christie
nl_info *info, int > completed_cmd) > > spin_unlock(>nl_cmd_lock); > if (!is_removed) > - target_undepend_item(>dev_group.cg_item); > + target_undepend_item(>dev_group.cg_item); > if (!ret) > complete(_cmd->complete); > return ret; > Acked-by: Mike Christie

Re: [PATCH v2] target: transport should allow st ILI reads

2018-05-10 Thread Mike Christie
On 05/10/2018 01:51 PM, Mike Christie wrote: > On 05/09/2018 03:59 PM, Lee Duncan wrote: >> When a tape drive is exported via LIO using the >> pscsi module, a read that requests more bytes per block >> than the tape can supply returns an empty buffer. This >> is bec

Re: [PATCH v2] target: transport should allow st ILI reads

2018-05-10 Thread Mike Christie
On 05/09/2018 03:59 PM, Lee Duncan wrote: > When a tape drive is exported via LIO using the > pscsi module, a read that requests more bytes per block > than the tape can supply returns an empty buffer. This > is because the pscsi pass-through target module sees > the "ILI" illegal length bit set

Re: [RESEND] tcmu: fix error resetting qfull_time_out to default

2018-05-10 Thread Mike Christie
static ssize_t tcmu_qfull_time_out_store(struct > config_item *item, > > if (val >= 0) { > udev->qfull_time_out = val * MSEC_PER_SEC; > + } else if (val == -1) { > + udev->qfull_time_out = val; > } else { > printk(

  1   2   3   4   5   6   >