All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Yarbrough <jmy@sgi.com>
To: Usha Ketineni <ketineni@us.ibm.com>
Cc: nfs@lists.sourceforge.net
Subject: Re: [NFS][PATCH] Fix to start nfs services through rsh
Date: Mon, 24 Oct 2005 16:17:32 -0700	[thread overview]
Message-ID: <435D6B8C.983D0FA0@sgi.com> (raw)
In-Reply-To: 1130179778.4887.33.camel@ibm-rf40cz9kb83.beaverton.ibm.com

I think you might be able to accomplish the same thing by doing the
following:

	rsh hostname "/sbin/service nfs start < /dev/null"

I haven't tried this to do what you want, but I've used this trick
for other things that want to use getsockname on file descriptor 0.

Usha Ketineni wrote:
> 
> When issuing "rsh hostname /sbin/service nfs start"
> rsh gives the error message "Starting NFS mountd: svc_tcp.c - cannot
> getsockname or listen: Invalid argument [FAILED]"
> 
> When mountd is invoked by rshd, file descriptor 0 is a socket, hence
> getsockname in rpc_init() succeeds so, rpc_init() tries to listen on
> that socket in svc_tcp_create(). The socket is a connected socket, but
> this code is assuming the socket came from inetd (or xinetd) and listen
> & accept can be called to establish a connection.
> 
> When mountd is invoked from the command line or sshd, file descriptor 0
> is not a socket.
> 
> Here is a fix for starting the nfs services through rsh which checks
> whether 0 is not a connected socket and if it is, sets socket to
> RPC_ANYSOCK so, svc_tcp_create() will create a new socket.
> 
> This patched code assumes that any udp socket, or a tcp socket that is
> not connected came from inetd and can be passed to svc_udp_create() or
> svc_tcp_create().
> 
> Signed-off-by: Usha Ketineni <uketinen@us.ibm.com>
> 
> --- nfs-utils-1.0.7.orig/support/nfs/rpcmisc.c  2005-10-24 17:19:07.000000000 -0700
> +++ nfs-utils-1.0.7/support/nfs/rpcmisc.c       2005-10-24 18:48:23.000000000 -0700
> @@ -53,10 +53,17 @@ rpc_init(char *name, int prog, int vers,
>         if (getsockname(0, (struct sockaddr *) &saddr, &asize) == 0
>             && saddr.sin_family == AF_INET) {
>                 int ssize = sizeof (int);
> -               _rpcfdtype = 0;
> +               int tmp_rpcfdtype = 0;
>                 if (getsockopt(0, SOL_SOCKET, SO_TYPE,
>                                 (char *)&_rpcfdtype, &ssize) == -1)
>                         xlog(L_FATAL, "getsockopt failed: %s", strerror(errno));
> +               if (_rpcfdtype != SOCK_STREAM || listen(0,5) != -1) {
> +                       _rpcpmstart = 1;
> +                       _rpcfdtype = tmp_rpcfdtype;
> +               } else {
> +                       sock = RPC_ANYSOCK;
> +                       pmap_unset(prog, vers);
> +               }
>                 _rpcpmstart = 1;
>         } else {
>                 pmap_unset(prog, vers);
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> NFS maillist  -  NFS@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nfs

-- 
jmy@sgi.com
650 933 3124

Stupid Internet!


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

  reply	other threads:[~2005-10-24 23:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-24 18:49 [NFS][PATCH] Fix to start nfs services through rsh Usha Ketineni
2005-10-24 23:17 ` James Yarbrough [this message]
2005-10-25  2:19   ` Usha Ketineni

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=435D6B8C.983D0FA0@sgi.com \
    --to=jmy@sgi.com \
    --cc=ketineni@us.ibm.com \
    --cc=nfs@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.