diff mbox

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

Message ID 87zi7cxprk.fsf@notabene.neil.brown.name (mailing list archive)
State New, archived
Headers show

Commit Message

NeilBrown Nov. 24, 2017, 4:30 a.m. UTC
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.

Link: https://github.com/systemd/systemd/issues/3590
Signed-off-by: NeilBrown <neilb@suse.com>
---
 utils/mount/stropts.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Steve Dickson Dec. 7, 2017, 3:39 p.m. UTC | #1
On 11/23/2017 11:30 PM, NeilBrown wrote:
> 
> 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.
> 
> Link: https://github.com/systemd/systemd/issues/3590
> Signed-off-by: NeilBrown <neilb@suse.com>
Committed.... 

steved.

> ---
>  utils/mount/stropts.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
> index 440131482e2b..12178235f068 100644
> --- a/utils/mount/stropts.c
> +++ b/utils/mount/stropts.c
> @@ -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))
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 440131482e2b..12178235f068 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -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))