2006-03-08 08:59:57

by Vijay Chauhan

[permalink] [raw]
Subject: NFS mount error

hi,
im doing mount/unmount in an infinte loop
while [ "a" == "a" ];
do
mount -t nfs -o tcp server:/filepath /mount-point
unmount -at nfs
done

after some successful mount/unmount its giving error message like

RPC: can't bind to reserved port.

what does it means?

TIA,
Vijay


Attachments:
(No filename) (277.00 B)
(No filename) (499.00 B)
Download all attachments

2006-03-08 16:30:56

by Chuck Lever

[permalink] [raw]
Subject: Re: NFS mount error

Vijay Chauhan wrote:
> hi,
> im doing mount/unmount in an infinte loop
> while [ "a" == "a" ];
> do
> mount -t nfs -o tcp server:/filepath /mount-point
> unmount -at nfs
> done
>
> after some successful mount/unmount its giving error message like
>
> RPC: can't bind to reserved port.
>
> what does it means?
>
> TIA,
> Vijay

there are a limited number of reserved ports on every host. each mount
operation takes up to 5 ports (5 sockets for contacting the server's
portmapper, mount daemon, and so on). when each mount is finished, it
leaves 4 sockets in TIME_WAIT and one, to the NFS server, is ESTABLISHED.

after about 120 seconds the TIME_WAIT sockets will go away, freeing
those ports. but if you mount in a tight loop, you are not giving these
sockets long enough to time out. so all the reserved ports are used up
with TIME_WAIT sockets. you can see this with the "netstat" command.

if you wait a few minutes, you will find that the ports free up and you
can do more mounts. or you can add a "sleep" in your loop.

there has been some mitigation in later kernels.

1. port numbers can be reused immediately in some circumstances.

2. steve d has reduced the number of sockets used for a mount request.

3. NFSv4 can usually skip the portmapper query.

4. the RPC client will attempt to connect to the default port first,
and use the portmapper only if the requested service isn't available on
the default port.

but a tight loop like yours will still probably consume all the reserved
ports available on a client.


Attachments:
cel.vcf (451.00 B)

2006-03-10 11:23:18

by Vijay Chauhan

[permalink] [raw]
Subject: Re: NFS mount error

Thanks for ur explained reply.

- Vijay


On 3/8/06, Chuck Lever <[email protected]> wrote:
>
> Vijay Chauhan wrote:
> > hi,
> > im doing mount/unmount in an infinte loop
> > while [ "a" == "a" ];
> > do
> > mount -t nfs -o tcp server:/filepath /mount-point
> > unmount -at nfs
> > done
> >
> > after some successful mount/unmount its giving error message like
> >
> > RPC: can't bind to reserved port.
> >
> > what does it means?
> >
> > TIA,
> > Vijay
>
> there are a limited number of reserved ports on every host. each mount
> operation takes up to 5 ports (5 sockets for contacting the server's
> portmapper, mount daemon, and so on). when each mount is finished, it
> leaves 4 sockets in TIME_WAIT and one, to the NFS server, is ESTABLISHED.
>
> after about 120 seconds the TIME_WAIT sockets will go away, freeing
> those ports. but if you mount in a tight loop, you are not giving these
> sockets long enough to time out. so all the reserved ports are used up
> with TIME_WAIT sockets. you can see this with the "netstat" command.
>
> if you wait a few minutes, you will find that the ports free up and you
> can do more mounts. or you can add a "sleep" in your loop.
>
> there has been some mitigation in later kernels.
>
> 1. port numbers can be reused immediately in some circumstances.
>
> 2. steve d has reduced the number of sockets used for a mount request.
>
> 3. NFSv4 can usually skip the portmapper query.
>
> 4. the RPC client will attempt to connect to the default port first,
> and use the portmapper only if the requested service isn't available on
> the default port.
>
> but a tight loop like yours will still probably consume all the reserved
> ports available on a client.
>
>
>


Attachments:
(No filename) (1.68 kB)
(No filename) (2.22 kB)
Download all attachments