Skip to contentSkip to conversation

f2fs: fix to clean previous mount option when remount_fs

PATCH In review Chao Yu 2 participants 4 messages Sep 15, 2014 – Sep 16, 2014 F2FS file system

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 4/5 f2fs: fix to clean previous mount option when remount_fs

In manual of mount, we descript remount as below:

"mount -o remount,rw /dev/foo /dir
After this call all old mount options are replaced and arbitrary stuff from fstab is ignored, except the loop= option which is internally generated and maintained by the mount command."

Previously f2fs do not clear up old mount options when remount_fs, so we have no chance of disabling previous option (e.g. flush_merge). Fix it.

---
 fs/f2fs/super.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/super.c +3 -0
index 54444bb..90fcbe0 100644
@@ -616,6 +616,9 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
 	org_mount_opt = sbi->mount_opt;
 	active_logs = sbi->active_logs;
 
+	sbi->mount_opt.opt = 0;
+	sbi->active_logs = NR_CURSEG_TYPE;
+
 	/* parse mount options */
 	err = parse_options(sb, data);
 	if (err)
Signature · 1 line
2.0.1.474.g72c7794
#1 lore raw

Hi Yu,

Quoted 9 lines · Chao Yu

In manual of mount, we descript remount as below:

"mount -o remount,rw /dev/foo /dir
After this call all old mount options are replaced and arbitrary stuff from fstab is ignored, except the loop= option which is internally generated and maintained by the mount command."

Previously f2fs do not clear up old mount options when remount_fs, so we have no chance of disabling previous option (e.g. flush_merge). Fix it.

Please don't.
"Remount" should just change what you specified and keep others unchanged. The problem here is that we need to provide mount opts for disable/enable some features, but we missed it. So the right way is adding these opts if we really need them.

Thanks,
Gu

Quoted 20 lines
---
 fs/f2fs/super.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/super.c +3 -0
index 54444bb..90fcbe0 100644
@@ -616,6 +616,9 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
 	org_mount_opt = sbi->mount_opt;
 	active_logs = sbi->active_logs;
 
+	sbi->mount_opt.opt = 0;
+	sbi->active_logs = NR_CURSEG_TYPE;
+
 	/* parse mount options */
 	err = parse_options(sb, data);
 	if (err)
author
#2 lore raw

Hi Gu,

Quoted 18 lines

-----Original Message-----
From: Gu Zheng [mailto:[email protected]]
Sent: Tuesday, September 16, 2014 9:51 AM
To: Chao Yu
Cc: Jaegeuk Kim; Changman Lee; [email protected]; [email protected]
Subject: Re: [f2fs-dev][PATCH 4/5] f2fs: fix to clean previous mount option when remount_fs

Hi Yu,

Quoted 7 lines · Chao Yu

In manual of mount, we descript remount as below:

"mount -o remount,rw /dev/foo /dir
After this call all old mount options are replaced and arbitrary stuff from fstab is ignored, except the loop= option which is internally generated and maintained by the mount command."

Quoted 5 lines
Quoted 2 lines

Previously f2fs do not clear up old mount options when remount_fs, so we have no chance of disabling previous option (e.g. flush_merge). Fix it.

Please don't.
"Remount" should just change what you specified and keep others unchanged.

Actually, there are two kinds of different 'remount', they are all specified in manual of mount.
1) mount -o remount,rw /dev/foo /dir
2) mount -o remount,rw /dir

I think 'remount' in your description is the second kind, being different from the first kind in description of this patch, for the second kind remount, 'mount' command can keep old options by loading them from mtab/fstab then merge them with new specified options.

Thanks,
Yu

Quoted 27 lines

The problem here is that we need to provide mount opts for disable/enable some features, but we missed it. So the right way is adding these opts if we really need them.

Thanks,
Gu

Quoted 20 lines
---
 fs/f2fs/super.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/super.c +3 -0
index 54444bb..90fcbe0 100644
@@ -616,6 +616,9 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
 	org_mount_opt = sbi->mount_opt;
 	active_logs = sbi->active_logs;
 
+	sbi->mount_opt.opt = 0;
+	sbi->active_logs = NR_CURSEG_TYPE;
+
 	/* parse mount options */
 	err = parse_options(sb, data);
 	if (err)
#3 lore raw
Quoted 23 lines · Chao Yu

Hi Gu,

Quoted 21 lines

-----Original Message-----
From: Gu Zheng [mailto:[email protected]]
Sent: Tuesday, September 16, 2014 9:51 AM
To: Chao Yu
Cc: Jaegeuk Kim; Changman Lee; [email protected]; [email protected]
Subject: Re: [f2fs-dev][PATCH 4/5] f2fs: fix to clean previous mount option when remount_fs

Hi Yu,

Quoted 9 lines · Chao Yu

In manual of mount, we descript remount as below:

"mount -o remount,rw /dev/foo /dir
After this call all old mount options are replaced and arbitrary stuff from fstab is ignored, except the loop= option which is internally generated and maintained by the mount command."

Previously f2fs do not clear up old mount options when remount_fs, so we have no chance of disabling previous option (e.g. flush_merge). Fix it.

Quoted 7 lines
Quoted 2 lines

Please don't.
"Remount" should just change what you specified and keep others unchanged.

Actually, there are two kinds of different 'remount', they are all specified in manual of mount.
1) mount -o remount,rw /dev/foo /dir
2) mount -o remount,rw /dir

Thanks for your reminder, I confused them.

Regards,
Gu

Quoted 40 lines

I think 'remount' in your description is the second kind, being different from the first kind in description of this patch, for the second kind remount, 'mount' command can keep old options by loading them from mtab/fstab then merge them with new specified options.

Thanks,
Yu

Quoted 21 lines

The problem here is that we need to provide mount opts for disable/enable some features, but we missed it. So the right way is adding these opts if we really need them.

Thanks,
Gu

Quoted 14 lines
---
 fs/f2fs/super.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/super.c +0 -0
index 54444bb..90fcbe0 100644
@@ -616,6 +616,9 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
 	org_mount_opt = sbi->mount_opt;
 	active_logs = sbi->active_logs;
 
Quoted 6 lines

fs/f2fs/super.c static int f2fs_remount(struct super_block *sb, int *flags, char *data) · line 624

Quoted 6 lines
fs/f2fs/super.c +3 -0
+	sbi->mount_opt.opt = 0;
+	sbi->active_logs = NR_CURSEG_TYPE;
+
 	/* parse mount options */
 	err = parse_options(sb, data);
 	if (err)

.