All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix match_prepath()
@ 2017-04-26 13:05 Sachin Prabhu
       [not found] ` <20170426130546.4493-1-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Sachin Prabhu @ 2017-04-26 13:05 UTC (permalink / raw)
  To: linux-cifs

Incorrect return value for shares not using the prefix patch means that
we will never match superblocks for these shares.

Fixes: commit c1d8b24d1819 ("Compare prepaths when comparing superblocks")
Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 fs/cifs/connect.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d82467c..d95744d 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2912,16 +2912,14 @@ match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data)
 {
 	struct cifs_sb_info *old = CIFS_SB(sb);
 	struct cifs_sb_info *new = mnt_data->cifs_sb;
+	bool old_set = old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH;
+	bool new_set = new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH;
 
-	if (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) {
-		if (!(new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH))
-			return 0;
-		/* The prepath should be null terminated strings */
-		if (strcmp(new->prepath, old->prepath))
-			return 0;
-
+	if (old_set && new_set && !strcmp(new->prepath, old->prepath))
 		return 1;
-	}
+	else if (!old_set && !new_set)
+		return 1;
+
 	return 0;
 }
 
-- 
2.9.3

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

* Re: [PATCH] Fix match_prepath()
       [not found] ` <20170426130546.4493-1-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2017-04-26 22:15   ` Pavel Shilovsky
       [not found]     ` <CAKywueQLpqdj9erZOPPbr-B6mROi6wPpBszASLoev8Uis-pr7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Shilovsky @ 2017-04-26 22:15 UTC (permalink / raw)
  To: Sachin Prabhu; +Cc: linux-cifs

2017-04-26 6:05 GMT-07:00 Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>:
> Incorrect return value for shares not using the prefix patch means that
> we will never match superblocks for these shares.
>
> Fixes: commit c1d8b24d1819 ("Compare prepaths when comparing superblocks")
> Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Signed-off-by: Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  fs/cifs/connect.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index d82467c..d95744d 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -2912,16 +2912,14 @@ match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data)
>  {
>         struct cifs_sb_info *old = CIFS_SB(sb);
>         struct cifs_sb_info *new = mnt_data->cifs_sb;
> +       bool old_set = old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH;
> +       bool new_set = new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH;
>
> -       if (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) {
> -               if (!(new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH))
> -                       return 0;
> -               /* The prepath should be null terminated strings */
> -               if (strcmp(new->prepath, old->prepath))
> -                       return 0;
> -
> +       if (old_set && new_set && !strcmp(new->prepath, old->prepath))
>                 return 1;
> -       }
> +       else if (!old_set && !new_set)
> +               return 1;
> +
>         return 0;
>  }
>
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Pavel Shilovsky <pshilov-0li6OtcxBFHby3iVrkZq2A@public.gmane.org>

--
Best regards,
Pavel Shilovsky

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

* Re: [PATCH] Fix match_prepath()
       [not found]     ` <CAKywueQLpqdj9erZOPPbr-B6mROi6wPpBszASLoev8Uis-pr7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-04-27 20:09       ` Steve French
  0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2017-04-27 20:09 UTC (permalink / raw)
  To: Pavel Shilovsky; +Cc: Sachin Prabhu, linux-cifs

merged into cifs-2.6.git for-next

On Wed, Apr 26, 2017 at 5:15 PM, Pavel Shilovsky <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 2017-04-26 6:05 GMT-07:00 Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>:
>> Incorrect return value for shares not using the prefix patch means that
>> we will never match superblocks for these shares.
>>
>> Fixes: commit c1d8b24d1819 ("Compare prepaths when comparing superblocks")
>> Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Signed-off-by: Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> ---
>>  fs/cifs/connect.c | 14 ++++++--------
>>  1 file changed, 6 insertions(+), 8 deletions(-)
>>
>> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
>> index d82467c..d95744d 100644
>> --- a/fs/cifs/connect.c
>> +++ b/fs/cifs/connect.c
>> @@ -2912,16 +2912,14 @@ match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data)
>>  {
>>         struct cifs_sb_info *old = CIFS_SB(sb);
>>         struct cifs_sb_info *new = mnt_data->cifs_sb;
>> +       bool old_set = old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH;
>> +       bool new_set = new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH;
>>
>> -       if (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) {
>> -               if (!(new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH))
>> -                       return 0;
>> -               /* The prepath should be null terminated strings */
>> -               if (strcmp(new->prepath, old->prepath))
>> -                       return 0;
>> -
>> +       if (old_set && new_set && !strcmp(new->prepath, old->prepath))
>>                 return 1;
>> -       }
>> +       else if (!old_set && !new_set)
>> +               return 1;
>> +
>>         return 0;
>>  }
>>
>> --
>> 2.9.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> Reviewed-by: Pavel Shilovsky <pshilov-0li6OtcxBFHby3iVrkZq2A@public.gmane.org>
>
> --
> Best regards,
> Pavel Shilovsky
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks,

Steve

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

end of thread, other threads:[~2017-04-27 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-26 13:05 [PATCH] Fix match_prepath() Sachin Prabhu
     [not found] ` <20170426130546.4493-1-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-04-26 22:15   ` Pavel Shilovsky
     [not found]     ` <CAKywueQLpqdj9erZOPPbr-B6mROi6wPpBszASLoev8Uis-pr7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-27 20:09       ` Steve French

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.