Skip to contentSkip to conversation

get_sb_single() - do not pass options twice

PATCH Kay Sievers 2 participants 4 messages Nov 5, 2009 – Dec 15, 2009 VFS

lore
Share & tools
lore
#0 lore raw

From: Kay Sievers <[email protected]>
Subject: vfs: get_sb_single() - do not pass options twice

Filesystem code usually destroys the option buffer while parsing it, which leads to errors when the same buffer is passed twice. In case we fill a new superblock with the options, do not pass the options again to the remount() call.

---
 fs/super.c |    2 ++
 1 file changed, 2 insertions(+)
fs/super.c +2 -0
@@ -900,6 +900,8 @@ int get_sb_single(struct file_system_typ
 			deactivate_locked_super(s);
 			return error;
 		}
+		/* options usually get mangled and can only be parsed once */
+		data = NULL;
 		s->s_flags |= MS_ACTIVE;
 	}
 	do_remount_sb(s, flags, data, 0);
#1 lore raw
Quoted 8 lines · Kay Sievers

From: Kay Sievers <[email protected]>
Subject: vfs: get_sb_single() - do not pass options twice

Filesystem code usually destroys the option buffer while parsing it, which leads to errors when the same buffer is passed twice. In case we fill a new superblock with the options, do not pass the options again to the remount() call.

Ping! Can someone please have a look and comment on that? Something like this will now be needed for 2.6.33 to silent a warning.

Thanks,
Kay

Quoted 17 lines

---
 fs/super.c |    2 ++

 1 file changed, 2 insertions(+)
fs/super.c +2 -0
@@ -900,6 +900,8 @@ int get_sb_single(struct file_system_typ
                        deactivate_locked_super(s);
                        return error;
                }
+               /* options usually get mangled and can only be parsed once */
+               data = NULL;
                s->s_flags |= MS_ACTIVE;
        }
        do_remount_sb(s, flags, data, 0);
#2 lore raw
Quoted 12 lines · Kay Sievers

Ping! Can someone please have a look and comment on that? Something like this will now be needed for 2.6.33 to silent a warning.

Thanks,
Kay

Quoted 6 lines

---
 fs/super.c |    2 ++

 1 file changed, 2 insertions(+)
Quoted 11 lines

fs/super.c int get_sb_single(struct file_system_typ · line 907

Quoted 11 lines
fs/super.c +2 -0
@@ -900,6 +900,8 @@ int get_sb_single(struct file_system_typ
                        deactivate_locked_super(s);
                        return error;
                }
+               /* options usually get mangled and can only be parsed once */
+               data = NULL;
                s->s_flags |= MS_ACTIVE;
        }
        do_remount_sb(s, flags, data, 0);

I think the do_remount_sb() is a NOP in that case. So shouldn't it rather be

	} else {
		do_remount_sb(s, flags, data, 0);
	}

?

Thanks,
Miklos

#3 lore raw
Quoted 19 lines · Miklos Szeredi
Quoted 14 lines · Kay Sievers

Ping! Can someone please have a look and comment on that? Something like this will now be needed for 2.6.33 to silent a warning.

fs/super.c int get_sb_single(struct file_system_typ · line 907

Quoted 11 lines
fs/super.c +2 -0
@@ -900,6 +900,8 @@ int get_sb_single(struct file_system_typ
                       deactivate_locked_super(s);
                       return error;
               }
+               /* options usually get mangled and can only be parsed once */
+               data = NULL;
               s->s_flags |= MS_ACTIVE;
       }
       do_remount_sb(s, flags, data, 0);

I think the do_remount_sb() is a NOP in that case. So shouldn't it rather be

Quoted 3 lines
	} else {
		do_remount_sb(s, flags, data, 0);
	}

Yeah, sounds good to me. I wasn't sure if this was done for some non-obvious reason. In case we can do it this way, here is the patch.

Thanks,
Kay

From: Kay Sievers <[email protected]>
Subject: vfs: get_sb_single() - do not pass options twice

Filesystem code usually destroys the option buffer while parsing it. This leads to errors when the same buffer is passed twice. In case we fill a new superblock do not call remount.

Cc Greg KH <[email protected]>
Cc Miklos Szeredi <[email protected]>
---
 fs/super.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/super.c +2 -1
@@ -901,8 +901,9 @@ int get_sb_single(struct file_system_typ
 			return error;
 		}
 		s->s_flags |= MS_ACTIVE;
+	} else {
+		do_remount_sb(s, flags, data, 0);
 	}
-	do_remount_sb(s, flags, data, 0);
 	simple_set_mnt(mnt, s);
 	return 0;
 }