From patchwork Fri Nov 24 04:30:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 10073515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 16D9260383 for ; Fri, 24 Nov 2017 04:30:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C8152A15D for ; Fri, 24 Nov 2017 04:30:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E50F2A160; Fri, 24 Nov 2017 04:30:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_TVD_MIME_EPI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 844012A15D for ; Fri, 24 Nov 2017 04:30:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752454AbdKXEaQ (ORCPT ); Thu, 23 Nov 2017 23:30:16 -0500 Received: from mx2.suse.de ([195.135.220.15]:34808 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752318AbdKXEaQ (ORCPT ); Thu, 23 Nov 2017 23:30:16 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 19069AAA3; Fri, 24 Nov 2017 04:30:15 +0000 (UTC) From: NeilBrown To: Steve Dickson Date: Fri, 24 Nov 2017 15:30:07 +1100 Cc: "linux-nfs\@vger.kernel.org" , Lennart Poettering Subject: [nfs-utils PATCH] mount.nfs: don't parse "device" name for -o remount Message-ID: <87zi7cxprk.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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))