public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Chaitra Basappa <chaitra.basappa@avagotech.com>
To: Sreekanth Reddy <sreekanth.reddy@avagotech.com>,
	"Nicholas A. Bellinger" <nab@daterainc.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	Calvin Owens <calvinowens@fb.com>,
	Christoph Hellwig <hch@infradead.org>,
	PDL-MPT-FUSIONLINUX <MPT-FusionLinux.pdl@avagotech.com>,
	kernel-team <kernel-team@fb.com>,
	Nicholas Bellinger <nab@linux-iscsi.org>
Subject: RE: [PATCH-v2 1/2] mpt3sas: Refcount sas_device objects and fix unsafe list usage
Date: Wed, 9 Sep 2015 19:59:14 +0530	[thread overview]
Message-ID: <e0bde29b9384f924b2868cd81b7b1c8d@mail.gmail.com> (raw)
In-Reply-To: <CAK=zhgrTpxiiEbHCvLL09EhyLq+xAdteMU1Gzd3jPg9UGo=BDA@mail.gmail.com>

From: Sreekanth Reddy [mailto:sreekanth.reddy@avagotech.com]
Sent: Tuesday, September 08, 2015 5:26 PM
To: Nicholas A. Bellinger
Cc: linux-scsi; linux-kernel; James Bottomley; Calvin Owens; Christoph
Hellwig; MPT-FusionLinux.pdl; kernel-team; Nicholas Bellinger; Chaitra
Basappa
Subject: Re: [PATCH-v2 1/2] mpt3sas: Refcount sas_device objects and fix
unsafe list usage

On Sun, Aug 30, 2015 at 1:24 PM, Nicholas A. Bellinger <nab@daterainc.com>
wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> These objects can be referenced concurrently throughout the driver, we
> need a way to make sure threads can't delete them out from under each
> other. This patch adds the refcount, and refactors the code to use it.
>
> Additionally, we cannot iterate over the sas_device_list without
> holding the lock, or we risk corrupting random memory if items are
> added or deleted as we iterate. This patch refactors
> _scsih_probe_sas() to use the sas_device_list in a safe way.
>
> This patch is a port of Calvin's PATCH-v4 for mpt2sas code, atop
> mpt3sas changes in scsi.git/for-next.
>
> Cc: Calvin Owens <calvinowens@fb.com>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: Sreekanth Reddy <sreekanth.reddy@avagotech.com>
> Cc: MPT-FusionLinux.pdl <MPT-FusionLinux.pdl@avagotech.com>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
> ---
>  drivers/scsi/mpt3sas/mpt3sas_base.h      |  25 +-
>  drivers/scsi/mpt3sas/mpt3sas_scsih.c     | 479
> +++++++++++++++++++++----------
>  drivers/scsi/mpt3sas/mpt3sas_transport.c |  18 +-
>  3 files changed, 364 insertions(+), 158 deletions(-)
>
> @@ -2763,7 +2874,7 @@ _scsih_block_io_device(struct MPT3SAS_ADAPTER *ioc,
> u16 handle)
>         struct scsi_device *sdev;
>         struct _sas_device *sas_device;
>

[Sreekanth] Here sas_device_lock spin lock needs to be acquired before
calling
                  __mpt3sas_get_sdev_by_addr() function.

[Chaitra]Here instead of calling " __mpt3sas_get_sdev_by_handle()" function
calling
	"mpt3sas_get_sdev_by_handle()" function will fixes "invalid page access"
type of kernel panic

> -       sas_device = _scsih_sas_device_find_by_handle(ioc, handle);
> +       sas_device = __mpt3sas_get_sdev_by_handle(ioc, handle);
>         if (!sas_device)
>                 return;
>
> @@ -2779,6 +2890,8 @@ _scsih_block_io_device(struct MPT3SAS_ADAPTER *ioc,
> u16 handle)
>                         continue;
>                 _scsih_internal_device_block(sdev, sas_device_priv_data);
>         }
> +
> +       sas_device_put(sas_device);
>  }
>


Regards,
Chaitra

  parent reply	other threads:[~2015-09-09 14:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-30  7:54 [PATCH-v2 0/2] mpt3sas: Reference counting fixes from for-next mpt2sas Nicholas A. Bellinger
2015-08-30  7:54 ` [PATCH-v2 1/2] mpt3sas: Refcount sas_device objects and fix unsafe list usage Nicholas A. Bellinger
2015-09-08 11:55   ` Sreekanth Reddy
2015-09-09  6:21     ` Nicholas A. Bellinger
2015-09-09 14:29     ` Chaitra Basappa [this message]
2015-09-09 22:03       ` Nicholas A. Bellinger
2015-09-11  6:55         ` Nicholas A. Bellinger
2015-09-11 17:50           ` James Bottomley
2015-09-11 20:01             ` Nicholas A. Bellinger
2015-08-30  7:54 ` [PATCH-v2 2/2] mpt3sas: Refcount fw_events " Nicholas A. Bellinger
2015-09-04 18:47 ` [PATCH-v2 0/2] mpt3sas: Reference counting fixes from for-next mpt2sas Nicholas A. Bellinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0bde29b9384f924b2868cd81b7b1c8d@mail.gmail.com \
    --to=chaitra.basappa@avagotech.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=MPT-FusionLinux.pdl@avagotech.com \
    --cc=calvinowens@fb.com \
    --cc=hch@infradead.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@daterainc.com \
    --cc=nab@linux-iscsi.org \
    --cc=sreekanth.reddy@avagotech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox