All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 13298/13468] drivers/scsi/libiscsi_tcp.c:563:2-8: preceding lock on line 542 (fwd)
@ 2022-05-22  9:54 ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2022-05-22  9:54 UTC (permalink / raw)
  To: Mike Christie
  Cc: Martin K. Petersen, Lee Duncan, Linux Memory Management List, kbuild-all

Hello,

Is a spin_unlock(&session->back_lock); needed before line 563?

thanks,
julia

---------- Forwarded message ----------
Date: Sun, 22 May 2022 12:42:24 +0800
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Cc: lkp@intel.com, Julia Lawall <julia.lawall@lip6.fr>
Subject: [linux-next:master 13298/13468] drivers/scsi/libiscsi_tcp.c:563:2-8:
    preceding lock on line 542

CC: kbuild-all@lists.01.org
BCC: lkp@intel.com
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Mike Christie <michael.christie@oracle.com>
CC: "Martin K. Petersen" <martin.petersen@oracle.com>
CC: Lee Duncan <lduncan@suse.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   18ecd30af1a8402c162cca1bd58771c0e5be7815
commit: a01ff1e161ea32d438d94032dd93cf2e4d9caac3 [13298/13468] scsi: iscsi: Remove iscsi_get_task back_lock requirement
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-c021 (https://download.01.org/0day-ci/archive/20220522/202205221208.kAbInIPD-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> drivers/scsi/libiscsi_tcp.c:563:2-8: preceding lock on line 542

vim +563 drivers/scsi/libiscsi_tcp.c

a081c13e39b5c1 Mike Christie     2008-12-02  523
a081c13e39b5c1 Mike Christie     2008-12-02  524  /**
a081c13e39b5c1 Mike Christie     2008-12-02  525   * iscsi_tcp_r2t_rsp - iSCSI R2T Response processing
a081c13e39b5c1 Mike Christie     2008-12-02  526   * @conn: iscsi connection
5923d64b7ab63d Mike Christie     2021-02-06  527   * @hdr: PDU header
a081c13e39b5c1 Mike Christie     2008-12-02  528   */
5923d64b7ab63d Mike Christie     2021-02-06  529  static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
a081c13e39b5c1 Mike Christie     2008-12-02  530  {
a081c13e39b5c1 Mike Christie     2008-12-02  531  	struct iscsi_session *session = conn->session;
5923d64b7ab63d Mike Christie     2021-02-06  532  	struct iscsi_tcp_task *tcp_task;
5923d64b7ab63d Mike Christie     2021-02-06  533  	struct iscsi_tcp_conn *tcp_conn;
5923d64b7ab63d Mike Christie     2021-02-06  534  	struct iscsi_r2t_rsp *rhdr;
a081c13e39b5c1 Mike Christie     2008-12-02  535  	struct iscsi_r2t_info *r2t;
5923d64b7ab63d Mike Christie     2021-02-06  536  	struct iscsi_task *task;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  537  	u32 data_length;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  538  	u32 data_offset;
5923d64b7ab63d Mike Christie     2021-02-06  539  	int r2tsn;
a081c13e39b5c1 Mike Christie     2008-12-02  540  	int rc;
a081c13e39b5c1 Mike Christie     2008-12-02  541
5923d64b7ab63d Mike Christie     2021-02-06 @542  	spin_lock(&session->back_lock);
5923d64b7ab63d Mike Christie     2021-02-06  543  	task = iscsi_itt_to_ctask(conn, hdr->itt);
5923d64b7ab63d Mike Christie     2021-02-06  544  	if (!task) {
5923d64b7ab63d Mike Christie     2021-02-06  545  		spin_unlock(&session->back_lock);
5923d64b7ab63d Mike Christie     2021-02-06  546  		return ISCSI_ERR_BAD_ITT;
5923d64b7ab63d Mike Christie     2021-02-06  547  	} else if (task->sc->sc_data_direction != DMA_TO_DEVICE) {
5923d64b7ab63d Mike Christie     2021-02-06  548  		spin_unlock(&session->back_lock);
5923d64b7ab63d Mike Christie     2021-02-06  549  		return ISCSI_ERR_PROTO;
5923d64b7ab63d Mike Christie     2021-02-06  550  	}
5923d64b7ab63d Mike Christie     2021-02-06  551  	/*
5923d64b7ab63d Mike Christie     2021-02-06  552  	 * A bad target might complete the cmd before we have handled R2Ts
5923d64b7ab63d Mike Christie     2021-02-06  553  	 * so get a ref to the task that will be dropped in the xmit path.
5923d64b7ab63d Mike Christie     2021-02-06  554  	 */
5923d64b7ab63d Mike Christie     2021-02-06  555  	if (task->state != ISCSI_TASK_RUNNING) {
5923d64b7ab63d Mike Christie     2021-02-06  556  		spin_unlock(&session->back_lock);
5923d64b7ab63d Mike Christie     2021-02-06  557  		/* Let the path that got the early rsp complete it */
5923d64b7ab63d Mike Christie     2021-02-06  558  		return 0;
5923d64b7ab63d Mike Christie     2021-02-06  559  	}
5923d64b7ab63d Mike Christie     2021-02-06  560  	task->last_xfer = jiffies;
a01ff1e161ea32 Mike Christie     2022-05-18  561  	if (!iscsi_get_task(task)) {
a01ff1e161ea32 Mike Christie     2022-05-18  562  		/* Let the path that got the early rsp complete it */
a01ff1e161ea32 Mike Christie     2022-05-18 @563  		return 0;
a01ff1e161ea32 Mike Christie     2022-05-18  564  	}
5923d64b7ab63d Mike Christie     2021-02-06  565
5923d64b7ab63d Mike Christie     2021-02-06  566  	tcp_conn = conn->dd_data;
5923d64b7ab63d Mike Christie     2021-02-06  567  	rhdr = (struct iscsi_r2t_rsp *)tcp_conn->in.hdr;
5923d64b7ab63d Mike Christie     2021-02-06  568  	/* fill-in new R2T associated with the task */
5923d64b7ab63d Mike Christie     2021-02-06  569  	iscsi_update_cmdsn(session, (struct iscsi_nopin *)rhdr);
5923d64b7ab63d Mike Christie     2021-02-06  570  	spin_unlock(&session->back_lock);
5923d64b7ab63d Mike Christie     2021-02-06  571
a081c13e39b5c1 Mike Christie     2008-12-02  572  	if (tcp_conn->in.datalen) {
a081c13e39b5c1 Mike Christie     2008-12-02  573  		iscsi_conn_printk(KERN_ERR, conn,
a081c13e39b5c1 Mike Christie     2008-12-02  574  				  "invalid R2t with datalen %d\n",
a081c13e39b5c1 Mike Christie     2008-12-02  575  				  tcp_conn->in.datalen);
5923d64b7ab63d Mike Christie     2021-02-06  576  		rc = ISCSI_ERR_DATALEN;
5923d64b7ab63d Mike Christie     2021-02-06  577  		goto put_task;
a081c13e39b5c1 Mike Christie     2008-12-02  578  	}
a081c13e39b5c1 Mike Christie     2008-12-02  579
5923d64b7ab63d Mike Christie     2021-02-06  580  	tcp_task = task->dd_data;
5923d64b7ab63d Mike Christie     2021-02-06  581  	r2tsn = be32_to_cpu(rhdr->r2tsn);
a081c13e39b5c1 Mike Christie     2008-12-02  582  	if (tcp_task->exp_datasn != r2tsn){
0ab1c2529e6a70 Mike Christie     2009-03-05  583  		ISCSI_DBG_TCP(conn, "task->exp_datasn(%d) != rhdr->r2tsn(%d)\n",
0ab1c2529e6a70 Mike Christie     2009-03-05  584  			      tcp_task->exp_datasn, r2tsn);
5923d64b7ab63d Mike Christie     2021-02-06  585  		rc = ISCSI_ERR_R2TSN;
5923d64b7ab63d Mike Christie     2021-02-06  586  		goto put_task;
a081c13e39b5c1 Mike Christie     2008-12-02  587  	}
a081c13e39b5c1 Mike Christie     2008-12-02  588
5923d64b7ab63d Mike Christie     2021-02-06  589  	if (session->state != ISCSI_STATE_LOGGED_IN) {
a081c13e39b5c1 Mike Christie     2008-12-02  590  		iscsi_conn_printk(KERN_INFO, conn,
a081c13e39b5c1 Mike Christie     2008-12-02  591  				  "dropping R2T itt %d in recovery.\n",
a081c13e39b5c1 Mike Christie     2008-12-02  592  				  task->itt);
5923d64b7ab63d Mike Christie     2021-02-06  593  		rc = 0;
5923d64b7ab63d Mike Christie     2021-02-06  594  		goto put_task;
a081c13e39b5c1 Mike Christie     2008-12-02  595  	}
a081c13e39b5c1 Mike Christie     2008-12-02  596
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  597  	data_length = be32_to_cpu(rhdr->data_length);
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  598  	if (data_length == 0) {
a081c13e39b5c1 Mike Christie     2008-12-02  599  		iscsi_conn_printk(KERN_ERR, conn,
a081c13e39b5c1 Mike Christie     2008-12-02  600  				  "invalid R2T with zero data len\n");
5923d64b7ab63d Mike Christie     2021-02-06  601  		rc = ISCSI_ERR_DATALEN;
5923d64b7ab63d Mike Christie     2021-02-06  602  		goto put_task;
a081c13e39b5c1 Mike Christie     2008-12-02  603  	}
a081c13e39b5c1 Mike Christie     2008-12-02  604
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  605  	if (data_length > session->max_burst)
0ab1c2529e6a70 Mike Christie     2009-03-05  606  		ISCSI_DBG_TCP(conn, "invalid R2T with data len %u and max "
0ab1c2529e6a70 Mike Christie     2009-03-05  607  			      "burst %u. Attempting to execute request.\n",
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  608  			      data_length, session->max_burst);
a081c13e39b5c1 Mike Christie     2008-12-02  609
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  610  	data_offset = be32_to_cpu(rhdr->data_offset);
ae3d56d81507c3 Christoph Hellwig 2019-01-29  611  	if (data_offset + data_length > task->sc->sdb.length) {
a081c13e39b5c1 Mike Christie     2008-12-02  612  		iscsi_conn_printk(KERN_ERR, conn,
a081c13e39b5c1 Mike Christie     2008-12-02  613  				  "invalid R2T with data len %u at offset %u "
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  614  				  "and total length %d\n", data_length,
ae3d56d81507c3 Christoph Hellwig 2019-01-29  615  				  data_offset, task->sc->sdb.length);
5923d64b7ab63d Mike Christie     2021-02-06  616  		rc = ISCSI_ERR_DATALEN;
5923d64b7ab63d Mike Christie     2021-02-06  617  		goto put_task;
a081c13e39b5c1 Mike Christie     2008-12-02  618  	}
a081c13e39b5c1 Mike Christie     2008-12-02  619
659743b02c4110 Shlomo Pongratz   2014-02-07  620  	spin_lock(&tcp_task->pool2queue);
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  621  	rc = kfifo_out(&tcp_task->r2tpool.queue, (void *)&r2t, sizeof(void *));
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  622  	if (!rc) {
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  623  		iscsi_conn_printk(KERN_ERR, conn, "Could not allocate R2T. "
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  624  				  "Target has sent more R2Ts than it "
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  625  				  "negotiated for or driver has leaked.\n");
659743b02c4110 Shlomo Pongratz   2014-02-07  626  		spin_unlock(&tcp_task->pool2queue);
5923d64b7ab63d Mike Christie     2021-02-06  627  		rc = ISCSI_ERR_PROTO;
5923d64b7ab63d Mike Christie     2021-02-06  628  		goto put_task;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  629  	}
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  630
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  631  	r2t->exp_statsn = rhdr->statsn;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  632  	r2t->data_length = data_length;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  633  	r2t->data_offset = data_offset;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  634
a081c13e39b5c1 Mike Christie     2008-12-02  635  	r2t->ttt = rhdr->ttt; /* no flip */
a081c13e39b5c1 Mike Christie     2008-12-02  636  	r2t->datasn = 0;
a081c13e39b5c1 Mike Christie     2008-12-02  637  	r2t->sent = 0;
a081c13e39b5c1 Mike Christie     2008-12-02  638
a081c13e39b5c1 Mike Christie     2008-12-02  639  	tcp_task->exp_datasn = r2tsn + 1;
7acd72eb85f1c7 Stefani Seibold   2009-12-21  640  	kfifo_in(&tcp_task->r2tqueue, (void*)&r2t, sizeof(void*));
a081c13e39b5c1 Mike Christie     2008-12-02  641  	conn->r2t_pdus_cnt++;
659743b02c4110 Shlomo Pongratz   2014-02-07  642  	spin_unlock(&tcp_task->pool2queue);
a081c13e39b5c1 Mike Christie     2008-12-02  643
a081c13e39b5c1 Mike Christie     2008-12-02  644  	iscsi_requeue_task(task);
a081c13e39b5c1 Mike Christie     2008-12-02  645  	return 0;
5923d64b7ab63d Mike Christie     2021-02-06  646
5923d64b7ab63d Mike Christie     2021-02-06  647  put_task:
5923d64b7ab63d Mike Christie     2021-02-06  648  	iscsi_put_task(task);
5923d64b7ab63d Mike Christie     2021-02-06  649  	return rc;
a081c13e39b5c1 Mike Christie     2008-12-02  650  }
a081c13e39b5c1 Mike Christie     2008-12-02  651

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


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

* [linux-next:master 13298/13468] drivers/scsi/libiscsi_tcp.c:563:2-8: preceding lock on line 542 (fwd)
@ 2022-05-22  9:54 ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2022-05-22  9:54 UTC (permalink / raw)
  To: kbuild-all

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

Hello,

Is a spin_unlock(&session->back_lock); needed before line 563?

thanks,
julia

---------- Forwarded message ----------
Date: Sun, 22 May 2022 12:42:24 +0800
From: kernel test robot <lkp@intel.com>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <julia.lawall@lip6.fr>
Subject: [linux-next:master 13298/13468] drivers/scsi/libiscsi_tcp.c:563:2-8:
    preceding lock on line 542

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Mike Christie <michael.christie@oracle.com>
CC: "Martin K. Petersen" <martin.petersen@oracle.com>
CC: Lee Duncan <lduncan@suse.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   18ecd30af1a8402c162cca1bd58771c0e5be7815
commit: a01ff1e161ea32d438d94032dd93cf2e4d9caac3 [13298/13468] scsi: iscsi: Remove iscsi_get_task back_lock requirement
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-c021 (https://download.01.org/0day-ci/archive/20220522/202205221208.kAbInIPD-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> drivers/scsi/libiscsi_tcp.c:563:2-8: preceding lock on line 542

vim +563 drivers/scsi/libiscsi_tcp.c

a081c13e39b5c1 Mike Christie     2008-12-02  523
a081c13e39b5c1 Mike Christie     2008-12-02  524  /**
a081c13e39b5c1 Mike Christie     2008-12-02  525   * iscsi_tcp_r2t_rsp - iSCSI R2T Response processing
a081c13e39b5c1 Mike Christie     2008-12-02  526   * @conn: iscsi connection
5923d64b7ab63d Mike Christie     2021-02-06  527   * @hdr: PDU header
a081c13e39b5c1 Mike Christie     2008-12-02  528   */
5923d64b7ab63d Mike Christie     2021-02-06  529  static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
a081c13e39b5c1 Mike Christie     2008-12-02  530  {
a081c13e39b5c1 Mike Christie     2008-12-02  531  	struct iscsi_session *session = conn->session;
5923d64b7ab63d Mike Christie     2021-02-06  532  	struct iscsi_tcp_task *tcp_task;
5923d64b7ab63d Mike Christie     2021-02-06  533  	struct iscsi_tcp_conn *tcp_conn;
5923d64b7ab63d Mike Christie     2021-02-06  534  	struct iscsi_r2t_rsp *rhdr;
a081c13e39b5c1 Mike Christie     2008-12-02  535  	struct iscsi_r2t_info *r2t;
5923d64b7ab63d Mike Christie     2021-02-06  536  	struct iscsi_task *task;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  537  	u32 data_length;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  538  	u32 data_offset;
5923d64b7ab63d Mike Christie     2021-02-06  539  	int r2tsn;
a081c13e39b5c1 Mike Christie     2008-12-02  540  	int rc;
a081c13e39b5c1 Mike Christie     2008-12-02  541
5923d64b7ab63d Mike Christie     2021-02-06 @542  	spin_lock(&session->back_lock);
5923d64b7ab63d Mike Christie     2021-02-06  543  	task = iscsi_itt_to_ctask(conn, hdr->itt);
5923d64b7ab63d Mike Christie     2021-02-06  544  	if (!task) {
5923d64b7ab63d Mike Christie     2021-02-06  545  		spin_unlock(&session->back_lock);
5923d64b7ab63d Mike Christie     2021-02-06  546  		return ISCSI_ERR_BAD_ITT;
5923d64b7ab63d Mike Christie     2021-02-06  547  	} else if (task->sc->sc_data_direction != DMA_TO_DEVICE) {
5923d64b7ab63d Mike Christie     2021-02-06  548  		spin_unlock(&session->back_lock);
5923d64b7ab63d Mike Christie     2021-02-06  549  		return ISCSI_ERR_PROTO;
5923d64b7ab63d Mike Christie     2021-02-06  550  	}
5923d64b7ab63d Mike Christie     2021-02-06  551  	/*
5923d64b7ab63d Mike Christie     2021-02-06  552  	 * A bad target might complete the cmd before we have handled R2Ts
5923d64b7ab63d Mike Christie     2021-02-06  553  	 * so get a ref to the task that will be dropped in the xmit path.
5923d64b7ab63d Mike Christie     2021-02-06  554  	 */
5923d64b7ab63d Mike Christie     2021-02-06  555  	if (task->state != ISCSI_TASK_RUNNING) {
5923d64b7ab63d Mike Christie     2021-02-06  556  		spin_unlock(&session->back_lock);
5923d64b7ab63d Mike Christie     2021-02-06  557  		/* Let the path that got the early rsp complete it */
5923d64b7ab63d Mike Christie     2021-02-06  558  		return 0;
5923d64b7ab63d Mike Christie     2021-02-06  559  	}
5923d64b7ab63d Mike Christie     2021-02-06  560  	task->last_xfer = jiffies;
a01ff1e161ea32 Mike Christie     2022-05-18  561  	if (!iscsi_get_task(task)) {
a01ff1e161ea32 Mike Christie     2022-05-18  562  		/* Let the path that got the early rsp complete it */
a01ff1e161ea32 Mike Christie     2022-05-18 @563  		return 0;
a01ff1e161ea32 Mike Christie     2022-05-18  564  	}
5923d64b7ab63d Mike Christie     2021-02-06  565
5923d64b7ab63d Mike Christie     2021-02-06  566  	tcp_conn = conn->dd_data;
5923d64b7ab63d Mike Christie     2021-02-06  567  	rhdr = (struct iscsi_r2t_rsp *)tcp_conn->in.hdr;
5923d64b7ab63d Mike Christie     2021-02-06  568  	/* fill-in new R2T associated with the task */
5923d64b7ab63d Mike Christie     2021-02-06  569  	iscsi_update_cmdsn(session, (struct iscsi_nopin *)rhdr);
5923d64b7ab63d Mike Christie     2021-02-06  570  	spin_unlock(&session->back_lock);
5923d64b7ab63d Mike Christie     2021-02-06  571
a081c13e39b5c1 Mike Christie     2008-12-02  572  	if (tcp_conn->in.datalen) {
a081c13e39b5c1 Mike Christie     2008-12-02  573  		iscsi_conn_printk(KERN_ERR, conn,
a081c13e39b5c1 Mike Christie     2008-12-02  574  				  "invalid R2t with datalen %d\n",
a081c13e39b5c1 Mike Christie     2008-12-02  575  				  tcp_conn->in.datalen);
5923d64b7ab63d Mike Christie     2021-02-06  576  		rc = ISCSI_ERR_DATALEN;
5923d64b7ab63d Mike Christie     2021-02-06  577  		goto put_task;
a081c13e39b5c1 Mike Christie     2008-12-02  578  	}
a081c13e39b5c1 Mike Christie     2008-12-02  579
5923d64b7ab63d Mike Christie     2021-02-06  580  	tcp_task = task->dd_data;
5923d64b7ab63d Mike Christie     2021-02-06  581  	r2tsn = be32_to_cpu(rhdr->r2tsn);
a081c13e39b5c1 Mike Christie     2008-12-02  582  	if (tcp_task->exp_datasn != r2tsn){
0ab1c2529e6a70 Mike Christie     2009-03-05  583  		ISCSI_DBG_TCP(conn, "task->exp_datasn(%d) != rhdr->r2tsn(%d)\n",
0ab1c2529e6a70 Mike Christie     2009-03-05  584  			      tcp_task->exp_datasn, r2tsn);
5923d64b7ab63d Mike Christie     2021-02-06  585  		rc = ISCSI_ERR_R2TSN;
5923d64b7ab63d Mike Christie     2021-02-06  586  		goto put_task;
a081c13e39b5c1 Mike Christie     2008-12-02  587  	}
a081c13e39b5c1 Mike Christie     2008-12-02  588
5923d64b7ab63d Mike Christie     2021-02-06  589  	if (session->state != ISCSI_STATE_LOGGED_IN) {
a081c13e39b5c1 Mike Christie     2008-12-02  590  		iscsi_conn_printk(KERN_INFO, conn,
a081c13e39b5c1 Mike Christie     2008-12-02  591  				  "dropping R2T itt %d in recovery.\n",
a081c13e39b5c1 Mike Christie     2008-12-02  592  				  task->itt);
5923d64b7ab63d Mike Christie     2021-02-06  593  		rc = 0;
5923d64b7ab63d Mike Christie     2021-02-06  594  		goto put_task;
a081c13e39b5c1 Mike Christie     2008-12-02  595  	}
a081c13e39b5c1 Mike Christie     2008-12-02  596
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  597  	data_length = be32_to_cpu(rhdr->data_length);
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  598  	if (data_length == 0) {
a081c13e39b5c1 Mike Christie     2008-12-02  599  		iscsi_conn_printk(KERN_ERR, conn,
a081c13e39b5c1 Mike Christie     2008-12-02  600  				  "invalid R2T with zero data len\n");
5923d64b7ab63d Mike Christie     2021-02-06  601  		rc = ISCSI_ERR_DATALEN;
5923d64b7ab63d Mike Christie     2021-02-06  602  		goto put_task;
a081c13e39b5c1 Mike Christie     2008-12-02  603  	}
a081c13e39b5c1 Mike Christie     2008-12-02  604
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  605  	if (data_length > session->max_burst)
0ab1c2529e6a70 Mike Christie     2009-03-05  606  		ISCSI_DBG_TCP(conn, "invalid R2T with data len %u and max "
0ab1c2529e6a70 Mike Christie     2009-03-05  607  			      "burst %u. Attempting to execute request.\n",
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  608  			      data_length, session->max_burst);
a081c13e39b5c1 Mike Christie     2008-12-02  609
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  610  	data_offset = be32_to_cpu(rhdr->data_offset);
ae3d56d81507c3 Christoph Hellwig 2019-01-29  611  	if (data_offset + data_length > task->sc->sdb.length) {
a081c13e39b5c1 Mike Christie     2008-12-02  612  		iscsi_conn_printk(KERN_ERR, conn,
a081c13e39b5c1 Mike Christie     2008-12-02  613  				  "invalid R2T with data len %u at offset %u "
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  614  				  "and total length %d\n", data_length,
ae3d56d81507c3 Christoph Hellwig 2019-01-29  615  				  data_offset, task->sc->sdb.length);
5923d64b7ab63d Mike Christie     2021-02-06  616  		rc = ISCSI_ERR_DATALEN;
5923d64b7ab63d Mike Christie     2021-02-06  617  		goto put_task;
a081c13e39b5c1 Mike Christie     2008-12-02  618  	}
a081c13e39b5c1 Mike Christie     2008-12-02  619
659743b02c4110 Shlomo Pongratz   2014-02-07  620  	spin_lock(&tcp_task->pool2queue);
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  621  	rc = kfifo_out(&tcp_task->r2tpool.queue, (void *)&r2t, sizeof(void *));
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  622  	if (!rc) {
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  623  		iscsi_conn_printk(KERN_ERR, conn, "Could not allocate R2T. "
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  624  				  "Target has sent more R2Ts than it "
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  625  				  "negotiated for or driver has leaked.\n");
659743b02c4110 Shlomo Pongratz   2014-02-07  626  		spin_unlock(&tcp_task->pool2queue);
5923d64b7ab63d Mike Christie     2021-02-06  627  		rc = ISCSI_ERR_PROTO;
5923d64b7ab63d Mike Christie     2021-02-06  628  		goto put_task;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  629  	}
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  630
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  631  	r2t->exp_statsn = rhdr->statsn;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  632  	r2t->data_length = data_length;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  633  	r2t->data_offset = data_offset;
5d0fddd0a72d30 Shlomo Pongratz   2014-02-07  634
a081c13e39b5c1 Mike Christie     2008-12-02  635  	r2t->ttt = rhdr->ttt; /* no flip */
a081c13e39b5c1 Mike Christie     2008-12-02  636  	r2t->datasn = 0;
a081c13e39b5c1 Mike Christie     2008-12-02  637  	r2t->sent = 0;
a081c13e39b5c1 Mike Christie     2008-12-02  638
a081c13e39b5c1 Mike Christie     2008-12-02  639  	tcp_task->exp_datasn = r2tsn + 1;
7acd72eb85f1c7 Stefani Seibold   2009-12-21  640  	kfifo_in(&tcp_task->r2tqueue, (void*)&r2t, sizeof(void*));
a081c13e39b5c1 Mike Christie     2008-12-02  641  	conn->r2t_pdus_cnt++;
659743b02c4110 Shlomo Pongratz   2014-02-07  642  	spin_unlock(&tcp_task->pool2queue);
a081c13e39b5c1 Mike Christie     2008-12-02  643
a081c13e39b5c1 Mike Christie     2008-12-02  644  	iscsi_requeue_task(task);
a081c13e39b5c1 Mike Christie     2008-12-02  645  	return 0;
5923d64b7ab63d Mike Christie     2021-02-06  646
5923d64b7ab63d Mike Christie     2021-02-06  647  put_task:
5923d64b7ab63d Mike Christie     2021-02-06  648  	iscsi_put_task(task);
5923d64b7ab63d Mike Christie     2021-02-06  649  	return rc;
a081c13e39b5c1 Mike Christie     2008-12-02  650  }
a081c13e39b5c1 Mike Christie     2008-12-02  651

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [linux-next:master 13298/13468] drivers/scsi/libiscsi_tcp.c:563:2-8: preceding lock on line 542 (fwd)
  2022-05-22  9:54 ` Julia Lawall
@ 2022-05-22 16:05   ` Mike Christie
  -1 siblings, 0 replies; 4+ messages in thread
From: Mike Christie @ 2022-05-22 16:05 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Martin K. Petersen, Lee Duncan, kbuild-all, linux-scsi

Replace linux-mm with linux-scsi.

On 5/22/22 4:54 AM, Julia Lawall wrote:
> Hello,
> 
> Is a spin_unlock(&session->back_lock); needed before line 563?
> 

Yes.

Martin, because the patches are only in your staging branch, should
I resend the entire patchset with a correct patch? Or, do you just want
a patch on top of what's in staging?

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

* Re: [linux-next:master 13298/13468] drivers/scsi/libiscsi_tcp.c:563:2-8: preceding lock on line 542 (fwd)
@ 2022-05-22 16:05   ` Mike Christie
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Christie @ 2022-05-22 16:05 UTC (permalink / raw)
  To: kbuild-all

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

Replace linux-mm with linux-scsi.

On 5/22/22 4:54 AM, Julia Lawall wrote:
> Hello,
> 
> Is a spin_unlock(&session->back_lock); needed before line 563?
> 

Yes.

Martin, because the patches are only in your staging branch, should
I resend the entire patchset with a correct patch? Or, do you just want
a patch on top of what's in staging?

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

end of thread, other threads:[~2022-05-22 21:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-22  9:54 [linux-next:master 13298/13468] drivers/scsi/libiscsi_tcp.c:563:2-8: preceding lock on line 542 (fwd) Julia Lawall
2022-05-22  9:54 ` Julia Lawall
2022-05-22 16:05 ` Mike Christie
2022-05-22 16:05   ` Mike Christie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.