Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1219357 > unrolled thread

RE: [PATCH] csiostor:Fix locking requirements for function call in the function csio_alloc_rnode

Started byAnish Bhatt <anish@chelsio.com>
First post2015-09-05 00:50 +0200
Last post2015-09-05 00:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  RE: [PATCH] csiostor:Fix locking requirements for function call in  the function csio_alloc_rnode Anish Bhatt <anish@chelsio.com> - 2015-09-05 00:50 +0200

#1219357 — RE: [PATCH] csiostor:Fix locking requirements for function call in the function csio_alloc_rnode

FromAnish Bhatt <anish@chelsio.com>
Date2015-09-05 00:50 +0200
SubjectRE: [PATCH] csiostor:Fix locking requirements for function call in the function csio_alloc_rnode
Message-ID<q57XY-7hG-23@gated-at.bofh.it>
> -----Original Message-----
> From: Nicholas Krause [mailto:xerofoify@gmail.com]
> Sent: Thursday, September 3, 2015 10:44 AM
> To: JBottomley@odin.com
> Cc: hare@suse.de; michaelc@cs.wisc.edu; davem@davemloft.net; Anish
> Bhatt; Hariprasad S; linux-scsi@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] csiostor:Fix locking requirements for function call in the
> function csio_alloc_rnode
> 
> This fixes locking requirements for the function call to the function
> csio_rnode_init to properly lock and disable irqs before calling this function
> with spin_lock_irq on the structure pointer hw of type csio_hw and unlocking
> after the function call with spin_unlock_irq in order to prevent concurrent
> access on the shared structure pointer hw of type csio_hw with other
> threads of execution accessing this structure
> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/scsi/csiostor/csio_rnode.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/csiostor/csio_rnode.c
> b/drivers/scsi/csiostor/csio_rnode.c
> index e9c3b04..85635f4 100644
> --- a/drivers/scsi/csiostor/csio_rnode.c
> +++ b/drivers/scsi/csiostor/csio_rnode.c
> @@ -222,9 +222,13 @@ csio_alloc_rnode(struct csio_lnode *ln)
>  		goto err;
> 
>  	memset(rn, 0, sizeof(struct csio_rnode));
> -	if (csio_rnode_init(rn, ln))
> +	spin_lock_irq(&hw->lock);
> +	if (csio_rnode_init(rn, ln)) {
> +		spin_unlock_irq(&hw->lock);
>  		goto err_free;
> -
> +	}
> +
> +	spin_unlock_irq(&hw->lock);
>  	CSIO_INC_STATS(ln, n_rnode_alloc);
> 
>  	return rn;
> --
> 2.1.4

NACK. Function called from csio_fcoe_fwevt_handler() with lock held.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web