How can I retry nfs mount if it fails?

Tetsuo Handa a5497108 at anet.ne.jp
Mon Aug 30 11:11:19 UTC 2004


Hello, Forrest.

Taylor, ForrestX wrote:
> I do not recall any options to retry an NFS mount or options for a
> longer timeout.  However, you can rebuild loader from the anaconda
> src.rpm.
> 
> Forrest

Thank you for your comment.
Today I patched ftp.c to retry HTTP request if connect() fails.
I'll test it tomorrow, and if it always work well, I'll use HTTP.
Thank you.


Patch for /usr/src/redhat/SOURCES/anaconda-9.1/loader2/ftp.c
(for Enterprise AS 3.0)

*** ftp.c.org   2003-07-08 07:50:18.000000000 +0900
--- ftp.c       2004-08-30 16:46:51.000000000 +0900
***************
*** 434,444 ****
      int rc;
      struct sockaddr_in destPort;
      fd_set readSet;

      if (port < 0) port = 80;

      if ((rc = getHostAddress(hostname, &serverAddress))) return rc;
!
      sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
      if (sock < 0) {
          return FTPERR_FAILED_CONNECT;
--- 434,445 ----
      int rc;
      struct sockaddr_in destPort;
      fd_set readSet;
+     int retry_count = 0;

      if (port < 0) port = 80;

      if ((rc = getHostAddress(hostname, &serverAddress))) return rc;
!  retry: ;
      sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
      if (sock < 0) {
          return FTPERR_FAILED_CONNECT;
***************
*** 450,455 ****
--- 451,460 ----

      if (connect(sock, (struct sockaddr *) &destPort, sizeof(destPort))) {
        close(sock);
+       if (retry_count++ < 30) {
+         sleep(1);
+         goto retry;
+       }
          return FTPERR_FAILED_CONNECT;
      }





More information about the Kickstart-list mailing list