]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/stropts.c
mount.nfs: Background mounts failing on time out errors.
[nfs-utils.git] / utils / mount / stropts.c
index 7a2edab45b0a6a475bb4b73105406f1bf745a5b3..d52e21a8749c17d770314c7863e96e49f4efbb79 100644 (file)
@@ -437,8 +437,8 @@ static int nfs_construct_new_options(struct mount_options *options,
        if (po_append(options, new_option) == PO_FAILED)
                return 0;
 
-       po_remove_all(options, "port");
-       if (nfs_pmap->pm_port != NFS_PORT) {
+       if(po_remove_all(options, "port") == PO_FOUND ||
+          nfs_pmap->pm_port != NFS_PORT) {
                snprintf(new_option, sizeof(new_option) - 1,
                         "port=%lu", nfs_pmap->pm_port);
                if (po_append(options, new_option) == PO_FAILED)
@@ -540,6 +540,8 @@ nfs_rewrite_pmap_mount_options(struct mount_options *options)
                        errno = EOPNOTSUPP;
                else if (rpc_createerr.cf_stat == RPC_AUTHERROR)
                        errno = EACCES;
+               else if (rpc_createerr.cf_stat == RPC_TIMEDOUT)
+                       errno = ETIMEDOUT;
                else if (rpc_createerr.cf_error.re_errno != 0)
                        errno = rpc_createerr.cf_error.re_errno;
                return 0;
@@ -665,9 +667,10 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi)
                case EHOSTUNREACH:
                        continue;
                default:
-                       break;
+                       goto out;
                }
        }
+out:
        return ret;
 }
 
@@ -751,9 +754,10 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi)
                case EHOSTUNREACH:
                        continue;
                default:
-                       break;
+                       goto out;
                }
        }
+out:
        return ret;
 }