linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Fajerski <jfajerski@suse.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Jeff Layton <jlayton@kernel.org>,
	steved@redhat.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] manpage: explain why showmount doesn't really work against a v4-only server
Date: Mon, 13 May 2019 10:12:24 +0200	[thread overview]
Message-ID: <20190513081224.4giacxxvler3xvnt@jfsuselaptop> (raw)
In-Reply-To: <20190511135442.GA15721@fieldses.org>

On Sat, May 11, 2019 at 09:54:42AM -0400, J. Bruce Fields wrote:
>On Fri, May 10, 2019 at 05:54:45PM -0400, Jeff Layton wrote:
>> From: Jeff Layton <jlayton@redhat.com>
>>
>> I occasionally see people that expect valid info when running showmount
>> against a server that may export some or all filesystems via NFSv4.
>> Let's make it clear that it only works by talking to the remote MNT
>> service, and that that may not be available from a v4-only server.
Looks good...thanks Jeff!
>
>Looks fine.
>
>I wonder if it'd also be helpful for showmount to detect this case and
>say something.  E.g. the following (not even compileable, but you get
>the idea).
This would be ideal of course.
>
>We've also talked about trying to cobble together an export list by
>scanning the root filesystem over NFSv4, but that's likely to be
>complicated and wouldn't give all the same results without further
>protocol extensions anyway, so I think that idea's dead.
>
>--b.
>
>diff --git a/utils/showmount/showmount.c b/utils/showmount/showmount.c
>index 394f5284a219..de9a6d38783a 100644
>--- a/utils/showmount/showmount.c
>+++ b/utils/showmount/showmount.c
>@@ -115,6 +115,22 @@ static CLIENT *nfs_get_mount_client(const char *hostname, rpcvers_t vers)
> 	exit(1);
> }
>
>+void warn_if_v4_only(char *hostname)
>+{
>+	struct sockaddr_in server_addr, client_addr;
>+
>+	if (fill_ipv4_sockaddr(hostname, &serveraddr))
>+		return;
>+	server_addr.sin_port = htnos(NFS_PORT);
>+	client_addr.sin_family = 0;
>+	client_addr.sin_addr.s_addr = 0;
>+	clnt_ping(&server_addr, NFS_PROGRAM, 4, "tcp", &client_addr);
>+
>+	if (rpc.createerr == RPC_SUCCESS)
>+		printf("Server responding to NFSv4 but not MNT; try mounting "
>+			"%s:/ instead of showmount", hostname);
>+}
>+
> int main(int argc, char **argv)
> {
> 	char hostname_buf[MAXHOSTLEN];
>@@ -199,6 +215,7 @@ int main(int argc, char **argv)
> 		fprintf(stderr, "%s: unable to create RPC auth handle.\n",
> 				program_name);
> 		clnt_destroy(mclient);
>+		warn_if_v4_only(hostname);
> 		exit(1);
> 	}
> 	total_timeout.tv_sec = TOTAL_TIMEOUT;
>

-- 
Jan Fajerski
Engineer Enterprise Storage
SUSE Linux GmbH, GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)

  reply	other threads:[~2019-05-13  8:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10 21:54 [PATCH] manpage: explain why showmount doesn't really work against a v4-only server Jeff Layton
2019-05-11 13:54 ` J. Bruce Fields
2019-05-13  8:12   ` Jan Fajerski [this message]
2019-05-13 13:29   ` Jeff Layton
2019-05-13 13:44     ` J. Bruce Fields
2019-05-13 14:19       ` Frank Filz
2019-05-29 13:15   ` Steve Dickson
2019-05-29 13:24     ` J. Bruce Fields
2019-06-03 14:27 ` Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190513081224.4giacxxvler3xvnt@jfsuselaptop \
    --to=jfajerski@suse.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).