Skip to contentSkip to conversation

mount.nfs: don't parse "device" name for -o remount

PATCH In review NeilBrown 2 participants 2 messages Nov 24, 2017 – Dec 7, 2017

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 mount.nfs: don't parse "device" name for -o remount

When "-o remount" is used, the device/special name is ignored. So don't parse it and risk generating a useless error.

This is particularly important when nfs-root is used as the "device name" is listed as "/dev/nfs". Because mount.nfs doesn't think that is valid,
mount -o remount,rw /
will fail.

---
 utils/mount/stropts.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
utils/mount/stropts.c +3 -1
index 440131482e2b..12178235f068 100644
@@ -384,7 +384,9 @@ static int nfs_set_version(struct nfsmount_info *mi)
  */
 static int nfs_validate_options(struct nfsmount_info *mi)
 {
-	if (!nfs_parse_devname(mi->spec, &mi->hostname, NULL))
+	/* For remount, ignore mi->spec: the kernel will. */
+	if (!(mi->flags & MS_REMOUNT) &&
+	    !nfs_parse_devname(mi->spec, &mi->hostname, NULL))
 		return 0;
 
 	if (!nfs_nfs_proto_family(mi->options, &mi->family))
Signature · 1 line
2.14.0.rc0.dirty
#1 lore raw
Quoted 5 lines · NeilBrown

When "-o remount" is used, the device/special name is ignored. So don't parse it and risk generating a useless error.

Quoted 8 lines

This is particularly important when nfs-root is used as the "device name" is listed as "/dev/nfs". Because mount.nfs doesn't think that is valid,
mount -o remount,rw /
will fail.

Committed....

steved.

Quoted 20 lines
---
 utils/mount/stropts.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
utils/mount/stropts.c +3 -1
index 440131482e2b..12178235f068 100644
@@ -384,7 +384,9 @@ static int nfs_set_version(struct nfsmount_info *mi)
  */
 static int nfs_validate_options(struct nfsmount_info *mi)
 {
-	if (!nfs_parse_devname(mi->spec, &mi->hostname, NULL))
+	/* For remount, ignore mi->spec: the kernel will. */
+	if (!(mi->flags & MS_REMOUNT) &&
+	    !nfs_parse_devname(mi->spec, &mi->hostname, NULL))
 		return 0;
 
 	if (!nfs_nfs_proto_family(mi->options, &mi->family))