Skip to contentSkip to conversation

stop rejecting options in remount

PATCH In review Christoph Hellwig 2 participants 2 messages Aug 9, 2008 – Aug 11, 2008 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stop rejecting options in remount

Thanks to some not so nice code in mount(8) we can't blindly reject moun options we don't support to be changed in remount. See the comment in the code for more details.

fs/xfs/linux-2.6/xfs_super.c +19 -0
Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_super.c
===================================================================
@@ -1349,9 +1349,28 @@ xfs_fs_remount(
 			mp->m_flags &= ~XFS_MOUNT_BARRIER;
 			break;
 		default:
+			/*
+			 * Logically we would return an error here to prevent
+			 * users from believing they might have changed
+			 * mount options using remount which can't be changed.
+			 *
+			 * But unfortunately mount(8) adds all options from
+			 * mtab and fstab to the mount arguments in some
+			 * cases so we can't blindly reject options.
+			 *
+			 * The workaround for that behaviour will be to
+			 * check for each specified option whether it actually
+			 * is a change compared to the status quo and if yes
+			 * silently ignore it or otherwise reject the remount
+			 * and tell the user about the reason.
+			 */
+#if 0
 			printk(KERN_INFO
 	"XFS: mount option \"%s\" not supported for remount\n", p);
 			return -EINVAL;
+#else
+			return 0;
+#endif
 		}
 	}
 
#1 lore raw
Quoted 30 lines · Christoph Hellwig

Thanks to some not so nice code in mount(8) we can't blindly reject moun options we don't support to be changed in remount. See the comment in the code for more details.

Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_super.c
===================================================================

fs/xfs/linux-2.6/xfs_super.c +15 -0
@@ -1349,9 +1349,28 @@ xfs_fs_remount(
 			mp->m_flags &= ~XFS_MOUNT_BARRIER;
 			break;
 		default:
+			/*
+			 * Logically we would return an error here to prevent
+			 * users from believing they might have changed
+			 * mount options using remount which can't be changed.
+			 *
+			 * But unfortunately mount(8) adds all options from
+			 * mtab and fstab to the mount arguments in some
+			 * cases so we can't blindly reject options.
+			 *
+			 * The workaround for that behaviour will be to
+			 * check for each specified option whether it actually
+			 * is a change compared to the status quo and if yes
+			 * silently ignore it or otherwise reject the remount
+			 * and tell the user about the reason.
+			 */

fs/xfs/linux-2.6/xfs_super.c xfs_fs_remount( · line 1376

Quoted 10 lines
fs/xfs/linux-2.6/xfs_super.c +4 -0
+#if 0
 			printk(KERN_INFO
 	"XFS: mount option \"%s\" not supported for remount\n", p);
 			return -EINVAL;
+#else
+			return 0;
+#endif
 		}
 	}
 

We should sill issue a warning that the option was ignored. It's not as obvious as refusing the mount but will allow some kind of triage if strange behavior results.

Don