diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/super.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 7e56411e55fc..48db52a7067a 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -992,6 +992,63 @@ out_unknown: | |||
992 | } | 992 | } |
993 | 993 | ||
994 | /* | 994 | /* |
995 | * Use the remote server's MOUNT service to request the NFS file handle | ||
996 | * corresponding to the provided path. | ||
997 | */ | ||
998 | static int nfs_try_mount(struct nfs_parsed_mount_data *args, | ||
999 | struct nfs_fh *root_fh) | ||
1000 | { | ||
1001 | struct sockaddr_in sin; | ||
1002 | int status; | ||
1003 | |||
1004 | if (args->mount_server.version == 0) { | ||
1005 | if (args->flags & NFS_MOUNT_VER3) | ||
1006 | args->mount_server.version = NFS_MNT3_VERSION; | ||
1007 | else | ||
1008 | args->mount_server.version = NFS_MNT_VERSION; | ||
1009 | } | ||
1010 | |||
1011 | /* | ||
1012 | * Construct the mount server's address. | ||
1013 | */ | ||
1014 | if (args->mount_server.address.sin_addr.s_addr != INADDR_ANY) | ||
1015 | sin = args->mount_server.address; | ||
1016 | else | ||
1017 | sin = args->nfs_server.address; | ||
1018 | if (args->mount_server.port == 0) { | ||
1019 | status = rpcb_getport_sync(&sin, | ||
1020 | args->mount_server.program, | ||
1021 | args->mount_server.version, | ||
1022 | args->mount_server.protocol); | ||
1023 | if (status < 0) | ||
1024 | goto out_err; | ||
1025 | sin.sin_port = htons(status); | ||
1026 | } else | ||
1027 | sin.sin_port = htons(args->mount_server.port); | ||
1028 | |||
1029 | /* | ||
1030 | * Now ask the mount server to map our export path | ||
1031 | * to a file handle. | ||
1032 | */ | ||
1033 | status = nfs_mount((struct sockaddr *) &sin, | ||
1034 | sizeof(sin), | ||
1035 | args->nfs_server.hostname, | ||
1036 | args->nfs_server.export_path, | ||
1037 | args->mount_server.version, | ||
1038 | args->mount_server.protocol, | ||
1039 | root_fh); | ||
1040 | if (status < 0) | ||
1041 | goto out_err; | ||
1042 | |||
1043 | return status; | ||
1044 | |||
1045 | out_err: | ||
1046 | dfprintk(MOUNT, "NFS: unable to contact server on host " | ||
1047 | NIPQUAD_FMT "\n", NIPQUAD(sin.sin_addr.s_addr)); | ||
1048 | return status; | ||
1049 | } | ||
1050 | |||
1051 | /* | ||
995 | * Validate the NFS2/NFS3 mount data | 1052 | * Validate the NFS2/NFS3 mount data |
996 | * - fills in the mount root filehandle | 1053 | * - fills in the mount root filehandle |
997 | */ | 1054 | */ |