Skip to contentSkip to conversation

Fix match_prepath()

PATCH Applied Sachin Prabhu 3 participants 3 messages Apr 26, 2017 – Apr 27, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix match_prepath()

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")
---
 fs/cifs/connect.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
fs/cifs/connect.c +6 -8
index d82467c..d95744d 100644
@@ -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;
 }
 
Signature · 1 line
2.9.3

A message that is not in the archive (sent off-list or not yet received): 20170426130546.4493-1-sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

Reviewed-by
#2 lore raw

2017-04-26 6:05 GMT-07:00 Sachin Prabhu <[email protected]>:

Quoted 40 lines

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")
---
 fs/cifs/connect.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
fs/cifs/connect.c +6 -9
index d82467c..d95744d 100644
@@ -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

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Best regards,
Pavel Shilovsky

A message that is not in the archive (sent off-list or not yet received): CAKywueQLpqdj9erZOPPbr-B6mROi6wPpBszASLoev8Uis-pr7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Applied
#4 lore raw

merged into cifs-2.6.git for-next

Quoted 55 lines · Pavel Shilovsky

2017-04-26 6:05 GMT-07:00 Sachin Prabhu <[email protected]>:

Quoted 40 lines

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")
---
 fs/cifs/connect.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
fs/cifs/connect.c +6 -9
index d82467c..d95744d 100644
@@ -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

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Best regards,
Pavel Shilovsky
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Thanks,

Steve