Re: [PATCH] tcm_fc: rcu_deref outside rcu lock/unlock section

2012-08-20 Thread Rustad, Mark D
On Aug 18, 2012, at 3:35 PM, Nicholas A. Bellinger wrote:

> On Sat, 2012-08-18 at 16:10 +0400, Denis Efremov wrote:
>> Use rcu_dereference_protected in order to prevent lockdep
>> complaint. Sequel of the patch 863555be
>> 
>> Found by Linux Driver Verification project (linuxtesting.org).
>> 
>> Signed-off-by: Denis Efremov 
>> ---
>> drivers/target/tcm_fc/tfc_sess.c |4 +++-
>> 1 files changed, 3 insertions(+), 1 deletions(-)
>> 
>> diff --git a/drivers/target/tcm_fc/tfc_sess.c 
>> b/drivers/target/tcm_fc/tfc_sess.c
>> index 87901fa..3c9e5b5 100644
>> --- a/drivers/target/tcm_fc/tfc_sess.c
>> +++ b/drivers/target/tcm_fc/tfc_sess.c
>> @@ -456,7 +456,9 @@ static void ft_prlo(struct fc_rport_priv *rdata)
>>  struct ft_tport *tport;
>> 
>>  mutex_lock(_lport_lock);
>> -tport = rcu_dereference(rdata->local_port->prov[FC_TYPE_FCP]);
>> +tport = rcu_dereference_protected(rdata->local_port->prov[FC_TYPE_FCP],
>> +  lockdep_is_held(_lport_lock));
>> +
>>  if (!tport) {
>>  mutex_unlock(_lport_lock);
>>  return;
> 
> This looks OK to silence lockdep.  CC'ing MDR + Kiran for good measure
> here, and will move from target-pending queue -> master with their ACK.
> 
> Thanks Dennis!
> 
> --nab


Ack. In fact I wonder why I didn't encounter it myself.

-- 
Mark Rustad, LAN Access Division, Intel Corporation

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tcm_fc: rcu_deref outside rcu lock/unlock section

2012-08-20 Thread Rustad, Mark D
On Aug 18, 2012, at 3:35 PM, Nicholas A. Bellinger wrote:

 On Sat, 2012-08-18 at 16:10 +0400, Denis Efremov wrote:
 Use rcu_dereference_protected in order to prevent lockdep
 complaint. Sequel of the patch 863555be
 
 Found by Linux Driver Verification project (linuxtesting.org).
 
 Signed-off-by: Denis Efremov yefremov.de...@gmail.com
 ---
 drivers/target/tcm_fc/tfc_sess.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/target/tcm_fc/tfc_sess.c 
 b/drivers/target/tcm_fc/tfc_sess.c
 index 87901fa..3c9e5b5 100644
 --- a/drivers/target/tcm_fc/tfc_sess.c
 +++ b/drivers/target/tcm_fc/tfc_sess.c
 @@ -456,7 +456,9 @@ static void ft_prlo(struct fc_rport_priv *rdata)
  struct ft_tport *tport;
 
  mutex_lock(ft_lport_lock);
 -tport = rcu_dereference(rdata-local_port-prov[FC_TYPE_FCP]);
 +tport = rcu_dereference_protected(rdata-local_port-prov[FC_TYPE_FCP],
 +  lockdep_is_held(ft_lport_lock));
 +
  if (!tport) {
  mutex_unlock(ft_lport_lock);
  return;
 
 This looks OK to silence lockdep.  CC'ing MDR + Kiran for good measure
 here, and will move from target-pending queue - master with their ACK.
 
 Thanks Dennis!
 
 --nab


Ack. In fact I wonder why I didn't encounter it myself.

-- 
Mark Rustad, LAN Access Division, Intel Corporation

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tcm_fc: rcu_deref outside rcu lock/unlock section

2012-08-18 Thread Nicholas A. Bellinger
On Sat, 2012-08-18 at 16:10 +0400, Denis Efremov wrote:
> Use rcu_dereference_protected in order to prevent lockdep
> complaint. Sequel of the patch 863555be
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Denis Efremov 
> ---
>  drivers/target/tcm_fc/tfc_sess.c |4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/target/tcm_fc/tfc_sess.c 
> b/drivers/target/tcm_fc/tfc_sess.c
> index 87901fa..3c9e5b5 100644
> --- a/drivers/target/tcm_fc/tfc_sess.c
> +++ b/drivers/target/tcm_fc/tfc_sess.c
> @@ -456,7 +456,9 @@ static void ft_prlo(struct fc_rport_priv *rdata)
>   struct ft_tport *tport;
>  
>   mutex_lock(_lport_lock);
> - tport = rcu_dereference(rdata->local_port->prov[FC_TYPE_FCP]);
> + tport = rcu_dereference_protected(rdata->local_port->prov[FC_TYPE_FCP],
> +   lockdep_is_held(_lport_lock));
> +
>   if (!tport) {
>   mutex_unlock(_lport_lock);
>   return;

This looks OK to silence lockdep.  CC'ing MDR + Kiran for good measure
here, and will move from target-pending queue -> master with their ACK.

Thanks Dennis!

--nab

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tcm_fc: rcu_deref outside rcu lock/unlock section

2012-08-18 Thread Denis Efremov
Use rcu_dereference_protected in order to prevent lockdep
complaint. Sequel of the patch 863555be

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Denis Efremov 
---
 drivers/target/tcm_fc/tfc_sess.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
index 87901fa..3c9e5b5 100644
--- a/drivers/target/tcm_fc/tfc_sess.c
+++ b/drivers/target/tcm_fc/tfc_sess.c
@@ -456,7 +456,9 @@ static void ft_prlo(struct fc_rport_priv *rdata)
struct ft_tport *tport;
 
mutex_lock(_lport_lock);
-   tport = rcu_dereference(rdata->local_port->prov[FC_TYPE_FCP]);
+   tport = rcu_dereference_protected(rdata->local_port->prov[FC_TYPE_FCP],
+ lockdep_is_held(_lport_lock));
+
if (!tport) {
mutex_unlock(_lport_lock);
return;
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tcm_fc: rcu_deref outside rcu lock/unlock section

2012-08-18 Thread Denis Efremov
Use rcu_dereference_protected in order to prevent lockdep
complaint. Sequel of the patch 863555be

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Denis Efremov yefremov.de...@gmail.com
---
 drivers/target/tcm_fc/tfc_sess.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
index 87901fa..3c9e5b5 100644
--- a/drivers/target/tcm_fc/tfc_sess.c
+++ b/drivers/target/tcm_fc/tfc_sess.c
@@ -456,7 +456,9 @@ static void ft_prlo(struct fc_rport_priv *rdata)
struct ft_tport *tport;
 
mutex_lock(ft_lport_lock);
-   tport = rcu_dereference(rdata-local_port-prov[FC_TYPE_FCP]);
+   tport = rcu_dereference_protected(rdata-local_port-prov[FC_TYPE_FCP],
+ lockdep_is_held(ft_lport_lock));
+
if (!tport) {
mutex_unlock(ft_lport_lock);
return;
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tcm_fc: rcu_deref outside rcu lock/unlock section

2012-08-18 Thread Nicholas A. Bellinger
On Sat, 2012-08-18 at 16:10 +0400, Denis Efremov wrote:
 Use rcu_dereference_protected in order to prevent lockdep
 complaint. Sequel of the patch 863555be
 
 Found by Linux Driver Verification project (linuxtesting.org).
 
 Signed-off-by: Denis Efremov yefremov.de...@gmail.com
 ---
  drivers/target/tcm_fc/tfc_sess.c |4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/target/tcm_fc/tfc_sess.c 
 b/drivers/target/tcm_fc/tfc_sess.c
 index 87901fa..3c9e5b5 100644
 --- a/drivers/target/tcm_fc/tfc_sess.c
 +++ b/drivers/target/tcm_fc/tfc_sess.c
 @@ -456,7 +456,9 @@ static void ft_prlo(struct fc_rport_priv *rdata)
   struct ft_tport *tport;
  
   mutex_lock(ft_lport_lock);
 - tport = rcu_dereference(rdata-local_port-prov[FC_TYPE_FCP]);
 + tport = rcu_dereference_protected(rdata-local_port-prov[FC_TYPE_FCP],
 +   lockdep_is_held(ft_lport_lock));
 +
   if (!tport) {
   mutex_unlock(ft_lport_lock);
   return;

This looks OK to silence lockdep.  CC'ing MDR + Kiran for good measure
here, and will move from target-pending queue - master with their ACK.

Thanks Dennis!

--nab

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/