diff mbox series

[RFC,24/24] target: mark __rcu to avoid warning

Message ID 20210220214112.7469-1-chaitanya.kulkarni@wdc.com (mailing list archive)
State New, archived
Headers show
Series target: code cleanup | expand

Commit Message

Chaitanya Kulkarni Feb. 20, 2021, 9:41 p.m. UTC
Mark struct fc_lport member prov with __rcu that fixes following
warning :-

drivers/target/tcm_fc/tfc_sess.c:47:17: error: incompatible types in comparison expression (different address spaces):
drivers/target/tcm_fc/tfc_sess.c:47:17:    void [noderef] __rcu *
drivers/target/tcm_fc/tfc_sess.c:47:17:    void *
drivers/target/tcm_fc/tfc_sess.c:72:9: error: incompatible types in comparison expression (different address spaces):
drivers/target/tcm_fc/tfc_sess.c:72:9:    void [noderef] __rcu *
drivers/target/tcm_fc/tfc_sess.c:72:9:    void *

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 include/scsi/libfc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bart Van Assche Feb. 20, 2021, 10:56 p.m. UTC | #1
On 2/20/21 1:41 PM, Chaitanya Kulkarni wrote:
> Mark struct fc_lport member prov with __rcu that fixes following
> warning :-
> 
> drivers/target/tcm_fc/tfc_sess.c:47:17: error: incompatible types in comparison expression (different address spaces):
> drivers/target/tcm_fc/tfc_sess.c:47:17:    void [noderef] __rcu *
> drivers/target/tcm_fc/tfc_sess.c:47:17:    void *
> drivers/target/tcm_fc/tfc_sess.c:72:9: error: incompatible types in comparison expression (different address spaces):
> drivers/target/tcm_fc/tfc_sess.c:72:9:    void [noderef] __rcu *
> drivers/target/tcm_fc/tfc_sess.c:72:9:    void *
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  include/scsi/libfc.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
> index 9b87e1a1c646..0446513e46d8 100644
> --- a/include/scsi/libfc.h
> +++ b/include/scsi/libfc.h
> @@ -746,7 +746,7 @@ struct fc_lport {
>  	struct mutex		       lp_mutex;
>  	struct list_head	       list;
>  	struct delayed_work	       retry_work;
> -	void			       *prov[FC_FC4_PROV_SIZE];
> +	void			       __rcu *prov[FC_FC4_PROV_SIZE];
>  	struct list_head	       lport_list;
>  };

This patch looks suspicious to me. Although the tcm_fc driver uses RCU
to modify 'prov', this is a choice that has been made in the tcm_fc
driver and not something that other libfc users are required to do. In
other words, I think this should be fixed in the tcm_fc driver instead
of in the libfc header.

Bart.
Chaitanya Kulkarni Feb. 20, 2021, 11:35 p.m. UTC | #2
> On Feb 20, 2021, at 2:56 PM, Bart Van Assche <bvanassche@acm.org> wrote:
> 
> ´╗┐On 2/20/21 1:41 PM, Chaitanya Kulkarni wrote:
>> Mark struct fc_lport member prov with __rcu that fixes following
>> warning :-
>> 
>> drivers/target/tcm_fc/tfc_sess.c:47:17: error: incompatible types in comparison expression (different address spaces):
>> drivers/target/tcm_fc/tfc_sess.c:47:17:    void [noderef] __rcu *
>> drivers/target/tcm_fc/tfc_sess.c:47:17:    void *
>> drivers/target/tcm_fc/tfc_sess.c:72:9: error: incompatible types in comparison expression (different address spaces):
>> drivers/target/tcm_fc/tfc_sess.c:72:9:    void [noderef] __rcu *
>> drivers/target/tcm_fc/tfc_sess.c:72:9:    void *
>> 
>> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
>> ---
>> include/scsi/libfc.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
>> index 9b87e1a1c646..0446513e46d8 100644
>> --- a/include/scsi/libfc.h
>> +++ b/include/scsi/libfc.h
>> @@ -746,7 +746,7 @@ struct fc_lport {
>>    struct mutex               lp_mutex;
>>    struct list_head           list;
>>    struct delayed_work           retry_work;
>> -    void                   *prov[FC_FC4_PROV_SIZE];
>> +    void                   __rcu *prov[FC_FC4_PROV_SIZE];
>>    struct list_head           lport_list;
>> };
> 
> This patch looks suspicious to me. Although the tcm_fc driver uses RCU
> to modify 'prov', this is a choice that has been made in the tcm_fc
> driver and not something that other libfc users are required to do. In
> other words, I think this should be fixed in the tcm_fc driver instead
> of in the libfc header.

Thanks for the reply Bart. I'll make the necessary change and see if warning still persists.  

> Bart.
diff mbox series

Patch

diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 9b87e1a1c646..0446513e46d8 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -746,7 +746,7 @@  struct fc_lport {
 	struct mutex		       lp_mutex;
 	struct list_head	       list;
 	struct delayed_work	       retry_work;
-	void			       *prov[FC_FC4_PROV_SIZE];
+	void			       __rcu *prov[FC_FC4_PROV_SIZE];
 	struct list_head	       lport_list;
 };