home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 2000s / rfc2054.txt < prev    next >
Text File  |  1996-10-29  |  36KB  |  900 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                       B. Callaghan
  8. Request for Comments: 2054                        Sun Microsystems, Inc.
  9. Category: Informational                                     October 1996
  10.  
  11.  
  12.                       WebNFS Client Specification
  13.  
  14. Status of this Memo
  15.  
  16.    This memo provides information for the Internet community.  This memo
  17.    does not specify an Internet standard of any kind.  Distribution of
  18.    this memo is unlimited.
  19.  
  20. Abstract
  21.  
  22.    This document describes a lightweight binding mechanism that allows
  23.    NFS clients to obtain service from WebNFS-enabled servers with a
  24.    minimum of protocol overhead.  In removing this overhead, WebNFS
  25.    clients see benefits in faster response to requests, easy transit of
  26.    packet filter firewalls and TCP-based proxies, and better server
  27.    scalability.
  28.  
  29. Table of Contents
  30.  
  31.    1.    Introduction . . . . . . . . . . . . . . . . . . . . . . . 2
  32.    2.    TCP vs UDP . . . . . . . . . . . . . . . . . . . . . . . . 2
  33.    3.    Well-known Port  . . . . . . . . . . . . . . . . . . . . . 2
  34.    4.    NFS Version 3  . . . . . . . . . . . . . . . . . . . . . . 3
  35.    4.1     Transfer Size  . . . . . . . . . . . . . . . . . . . . . 3
  36.    4.2     Fast Writes  . . . . . . . . . . . . . . . . . . . . . . 4
  37.    4.3     READDIRPLUS  . . . . . . . . . . . . . . . . . . . . . . 4
  38.    5.    Public Filehandle  . . . . . . . . . . . . . . . . . . . . 5
  39.    5.1     NFS Version 2 Public Filehandle  . . . . . . . . . . . . 5
  40.    5.2     NFS Version 3 Public Filehandle  . . . . . . . . . . . . 5
  41.    6.    Multi-component Lookup . . . . . . . . . . . . . . . . . . 6
  42.    6.1     Canonical Path vs. Native Path . . . . . . . . . . . . . 6
  43.    6.2     Symbolic Links . . . . . . . . . . . . . . . . . . . . . 7
  44.    6.2.1     Absolute Link  . . . . . . . . . . . . . . . . . . . . 8
  45.    6.2.2     Relative Link  . . . . . . . . . . . . . . . . . . . . 8
  46.    6.3     Filesystem Spanning Pathnames  . . . . . . . . . . . . . 9
  47.    7.    Contacting the Server  . . . . . . . . . . . . . . . . . . 9
  48.    8.    Mount Protocol . . . . . . . . . . . . . . . . . . . . . . 11
  49.    9.    Exploiting Concurrency . . . . . . . . . . . . . . . . . . 12
  50.    9.1     Read-ahead . . . . . . . . . . . . . . . . . . . . . . . 12
  51.    9.2     Concurrent File Download . . . . . . . . . . . . . . . . 13
  52.    10.   Timeout and Retransmission . . . . . . . . . . . . . . . . 13
  53.    11.   Bibliography . . . . . . . . . . . . . . . . . . . . . . . 15
  54.    12.   Security Considerations  . . . . . . . . . . . . . . . . . 16
  55.  
  56.  
  57.  
  58. Callaghan                    Informational                      [Page 1]
  59.  
  60. RFC 2054              WebNFS Client Specification           October 1996
  61.  
  62.  
  63.    13.   Acknowledgements . . . . . . . . . . . . . . . . . . . . . 16
  64.    14.   Author's Address . . . . . . . . . . . . . . . . . . . . . 16
  65.  
  66. 1. Introduction
  67.  
  68.    The NFS protocol provides access to shared filesystems across
  69.    networks.  It is designed to be machine, operating system, network
  70.    architecture, and transport protocol independent.  The protocol
  71.    currently exists in two versions: version 2 [RFC1094] and version 3
  72.    [RFC1813], both built on Sun RPC [RFC1831] at its associated eXternal
  73.    Data Representation (XDR) [RFC1832] and Binding Protocol [RFC1833].
  74.  
  75.    WebNFS provides additional semantics that can be applied to NFS
  76.    version 2 and 3 to eliminate the overhead of PORTMAP and MOUNT
  77.    protocols, make the protocol easier to use where firewall transit is
  78.    required, and reduce the number of LOOKUP requests required to
  79.    identify a particular file on the server. WebNFS server requirements
  80.    are described in RFC 2055.
  81.  
  82. 2. TCP vs UDP
  83.  
  84.    The NFS protocol is most well known for its use of UDP which performs
  85.    acceptably on local area networks.  However, on wide area networks
  86.    with error prone, high-latency connections and bandwidth contention,
  87.    TCP is well respected for its congestion control and superior error
  88.    handling.  A growing number of NFS implementations now support the
  89.    NFS protocol over TCP connections.
  90.  
  91.    Use of NFS version 3 is particularly well matched to the use of TCP
  92.    as a transport protocol.  Version 3 removes the arbitrary 8k transfer
  93.    size limit of version 2, allowing the READ or WRITE of very large
  94.    streams of data over a TCP connection.  Note that NFS version 2 is
  95.    also supported on TCP connections, though the benefits of TCP data
  96.    streaming will not be as great.
  97.  
  98.    A WebNFS client must first attempt to connect to its server with a
  99.    TCP connection.  If the server refuses the connection, the client
  100.    should attempt to use UDP.
  101.  
  102. 3. Well-known Port
  103.  
  104.    While Internet protocols are generally identified by registered port
  105.    number assignments, RPC based protocols register a 32 bit program
  106.    number and a dynamically assigned port with the portmap service which
  107.    is registered on the well-known port 111.  Since the NFS protocol is
  108.    RPC-based, NFS servers register their port assignment with the
  109.    portmap service.
  110.  
  111.  
  112.  
  113.  
  114. Callaghan                    Informational                      [Page 2]
  115.  
  116. RFC 2054              WebNFS Client Specification           October 1996
  117.  
  118.  
  119.    NFS servers are constrained by a requirement to re-register at the
  120.    same port after a server crash and recovery so that clients can
  121.    recover simply by retransmitting an RPC request until a response is
  122.    received.  This is simpler than the alternative of having the client
  123.    repeatedly check with the portmap service for a new port assignment.
  124.    NFS servers typically achieve this port invariance by registering a
  125.    constant port assignment, 2049, for both UDP and TCP.
  126.  
  127.    To avoid the overhead of contacting the server's portmap service, and
  128.    to facilitate transit through packet filtering firewalls, WebNFS
  129.    clients optimistically assume that WebNFS servers register on port
  130.    2049.  Most NFS servers use this port assignment already, so this
  131.    client optimism is well justified. Refer to section 8 for further
  132.    details on port binding.
  133.  
  134. 4. NFS Version 3
  135.  
  136.    NFS version 3 corrects deficiencies in version 2 of the protocol as
  137.    well as providing a number of features suitable to WebNFS clients
  138.    accessing servers over high-latency, low-bandwidth connections.
  139.  
  140. 4.1 Transfer Size
  141.  
  142.    NFS version 2 limited the amount of data in a single request or reply
  143.    to 8 kilobytes.  This limit was based on what was then considered a
  144.    reasonable upper bound on the amount of data that could be
  145.    transmitted in a UDP datagram across an Ethernet.  The 8k transfer
  146.    size limitation affects READ, WRITE, and READDIR requests. When using
  147.    version 2, a WebNFS client must not transmit any request that exceeds
  148.    the 8k transfer size.  Additionally, the client must be able to
  149.    adjust its requests to suit servers that limit transfer sizes to
  150.    values smaller than 8k.
  151.  
  152.    NFS version 3 removes the 8k limit, allowing the client and server to
  153.    negotiate whatever limit they choose.  Larger transfer sizes are
  154.    preferred since they require fewer READ or WRITE requests to transfer
  155.    a given amount of data and utilize a TCP stream more efficiently.
  156.  
  157.    While the client can use the FSINFO procedure to request the server's
  158.    maximum and preferred transfer sizes, in the interests of keeping the
  159.    number of NFS requests to a minimum, WebNFS clients should
  160.    optimistically choose a transfer size and make corrections if
  161.    necessary based on the server's response.
  162.  
  163.    For instance, given that the file attributes returned with the
  164.    filehandle from a LOOKUP request indicate that the file has a size of
  165.    50k, the client might transmit a READ request for 50k.  If the server
  166.    returns only 32k, then the client can assume that the server's
  167.  
  168.  
  169.  
  170. Callaghan                    Informational                      [Page 3]
  171.  
  172. RFC 2054              WebNFS Client Specification           October 1996
  173.  
  174.  
  175.    maximum transfer size is 32k and issue another read request for the
  176.    remaining data.  The server will indicate positively when the end of
  177.    file is reached.
  178.  
  179.    A similar strategy can be used when writing to a file on the server,
  180.    though the client should be more conservative in choosing write
  181.    request sizes so as to avoid transmitting large amounts of data that
  182.    the server cannot handle.
  183.  
  184. 4.2 Fast Writes
  185.  
  186.    NFS version 2 requires the server to write client data to stable
  187.    storage before responding to the client.  This avoids the possibility
  188.    of the the server crashing and losing the client's data after a
  189.    positive response.  While this requirement protects the client from
  190.    data loss, it requires that the server direct client write requests
  191.    directly to the disk, or to buffer client data in expensive non-
  192.    volatile memory (NVRAM).  Either way, the effect is poor write
  193.    performance, either through inefficient synchronous writes to the
  194.    disk or through the limited buffering available in NVRAM.
  195.  
  196.    NFS version 3 provides clients with the option of having the server
  197.    buffer a series of WRITE requests in unstable storage.  A subsequent
  198.    COMMIT request from the client will have the server flush the data to
  199.    stable storage and have the client verify that the server lost none
  200.    of the data.  Since fast writes benefit both the client and the
  201.    server, WebNFS clients should use WRITE/COMMIT when writing to the
  202.    server.
  203.  
  204. 4.3 READDIRPLUS
  205.  
  206.    The NFS version 2 READDIR procedure is also supported in version 3.
  207.    READDIR returns the names of the entries in a directory along with
  208.    their fileids.  Browser programs that display directory contents as a
  209.    list will usually display more than just the filename; a different
  210.    icon may be displayed if the entry is a directory or a file.
  211.    Similarly, the browser may display the file size, and date of last
  212.    modification.
  213.  
  214.    Since this additional information is not returned by READDIR, version
  215.    2 clients must issue a series of LOOKUP requests, one per directory
  216.    member, to retrieve the attribute data.  Clearly this is an expensive
  217.    operation where the directory is large (perhaps several hundred
  218.    entries) and the network latency is high.
  219.  
  220.    The version 3 READDIRPLUS request allows the client to retrieve not
  221.    only the names of the directory entries, but also their file
  222.    attributes and filehandles in a single call.  WebNFS clients that
  223.  
  224.  
  225.  
  226. Callaghan                    Informational                      [Page 4]
  227.  
  228. RFC 2054              WebNFS Client Specification           October 1996
  229.  
  230.  
  231.    require attribute information for directory entries should use
  232.    READDIRPLUS in preference to READDIR.
  233.  
  234. 5. Public Filehandle
  235.  
  236.    NFS filehandles are normally created by the server and used to
  237.    identify uniquely a particular file or directory on the server.  The
  238.    client does not normally create filehandles or have any knowledge of
  239.    the contents of a filehandle.
  240.  
  241.    The public filehandle is an an exception.  It is an NFS filehandle
  242.    with a reserved value and special semantics that allow an initial
  243.    filehandle to be obtained.  A WebNFS client can use the public
  244.    filehandle as an initial filehandle rather than using the MOUNT
  245.    protocol.  Since NFS version 2 and version 3 have different
  246.    filehandle formats, the public filehandle is defined differently for
  247.    each.
  248.  
  249.    The public filehandle is a zero filehandle.  For NFS version 2 this
  250.    is a filehandle with 32 zero octets.  A version 3 public filehandle
  251.    has zero length.
  252.  
  253. 5.1 NFS Version 2 Public Filehandle
  254.  
  255.    A version 2 filehandle is defined in RFC 1094 as an opaque value
  256.    occupying 32 octets.  A version 2 public filehandle has a zero in
  257.    each octet, i.e. all zeros.
  258.  
  259.     1                                                             32
  260.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  261.    |0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|
  262.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  263.  
  264. 5.2 NFS Version 3 Public Filehandle
  265.  
  266.    A version 3 filehandle is defined in RFC 1813 as a variable length
  267.    opaque value occupying up to 64 octets.  The length of the filehandle
  268.    is indicated by an integer value contained in a 4 octet value which
  269.    describes the number of valid octets that follow. A version 3 public
  270.    filehandle has a length of zero.
  271.  
  272.    +-+-+-+-+
  273.    |   0   |
  274.    +-+-+-+-+
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Callaghan                    Informational                      [Page 5]
  283.  
  284. RFC 2054              WebNFS Client Specification           October 1996
  285.  
  286.  
  287. 6. Multi-component Lookup
  288.  
  289.    Normally the NFS LOOKUP request (version 2 or 3) takes a directory
  290.    filehandle along with the name of a directory member, and returns the
  291.    filehandle of the directory member.  If a client needs to evaluate a
  292.    pathname that contains a sequence of components, then beginning with
  293.    the directory filehandle of the first component it must issue a
  294.    series of LOOKUP requests one component at a time.  For instance,
  295.    evaluation of the Unix path  "a/b/c" will generate separate LOOKUP
  296.    requests for each component of the pathname "a", "b", and "c".
  297.  
  298.    A LOOKUP request that uses the public filehandle can provide a
  299.    pathname containing multiple components.  The server is expected to
  300.    evaluate the entire pathname and return a filehandle for the final
  301.    component. Both canonical (slash-separated) and server native
  302.    pathnames are supported.
  303.  
  304.    For example, rather than evaluate the path "a/b/c" as:
  305.  
  306.         LOOKUP  FH=0x0  "a"  --->
  307.                              <---  FH=0x1
  308.         LOOKUP  FH=0x1  "b"  --->
  309.                              <---  FH=0x2
  310.         LOOKUP  FH=0x2  "c"  --->
  311.                              <---  FH=0x3
  312.  
  313.    Relative to the public filehandle these three LOOKUP requests can be
  314.    replaced by a single multi-component lookup:
  315.  
  316.         LOOKUP  FH=0x0  "a/b/c"  --->
  317.                                  <---  FH=0x3
  318.  
  319.    Multi-component lookup is supported only for LOOKUP requests relative
  320.    to the public filehandle.
  321.  
  322. 6.1 Canonical Path vs. Native Path
  323.  
  324.    If the pathname in a multi-component LOOKUP request begins with an
  325.    ASCII character, then it must be a canonical path.  A canonical path
  326.    is a hierarchically-related, slash-separated sequence of components,
  327.    <directory>/<directory>/.../<name>.  Occurrences of the "/" character
  328.    within a component must be escaped using the escape code %2f.  Non-
  329.    ascii characters within components must also be escaped using the "%"
  330.    character to introduce a two digit hexadecimal code. Occurrences of
  331.    the "%" character that do not introduce an encoded character must
  332.    themselves be encoded with %25.
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Callaghan                    Informational                      [Page 6]
  339.  
  340. RFC 2054              WebNFS Client Specification           October 1996
  341.  
  342.  
  343.    If the first character of the path is a slash, then the canonical
  344.    path will be evaluated relative to the server's root directory.  If
  345.    the first character is not a slash, then the path will be evaluated
  346.    relative to the directory with which the public filehandle is
  347.    associated.
  348.  
  349.    Not all WebNFS servers can support arbitrary use of absolute paths.
  350.    Clearly, the server cannot return a filehandle if the path identifies
  351.    a file or directory that is not exported by the server.  In addition,
  352.    some servers will not return a filehandle if the path names a file or
  353.    directory in an exported filesystem different from the one that is
  354.    associated with the public filehandle.
  355.  
  356.    If the first character of the path is 0x80 (non-ascii) then the
  357.    following character is the first in a native path.  A native path
  358.    conforms to the normal pathname syntax of the server. For example:
  359.  
  360.         Lookup for Canonical Path:
  361.  
  362.                 LOOKUP FH=0x0 "/a/b/c"
  363.  
  364.         Lookup for Native Path:
  365.  
  366.                 LOOKUP FH=0x0  0x80 "a:b:c"
  367.  
  368. 6.2 Symbolic Links
  369.  
  370.    On Unix servers, components within a pathname may be symbolic links.
  371.    The server will evaluate these symbolic links as a part of the normal
  372.    pathname evaluation process.  If the final component is a symbolic
  373.    link, the server will return its filehandle, rather than evaluate it.
  374.  
  375.    If the attributes returned with a filehandle indicate that it refers
  376.    to a symbolic link, then it is the client's responsibility to deal
  377.    with the link by fetching the contents of the link using the READLINK
  378.    procedure. What follows is determined by the contents of the link.
  379.  
  380.    Evaluation of symbolic links by the client is defined only if the
  381.    symbolic link is retrieved via the multi-component lookup of a
  382.    canonical path.
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Callaghan                    Informational                      [Page 7]
  395.  
  396. RFC 2054              WebNFS Client Specification           October 1996
  397.  
  398.  
  399. 6.2.1 Absolute Link
  400.  
  401.    If the first character of the link text is a slash "/", then the
  402.    following path can be assumed to be absolute.  The entire path must
  403.    be evaluated by the server relative to the public filehandle:
  404.  
  405.         LOOKUP  FH=0x0  "a/b"  --->
  406.                                <---  FH=0x1 (symbolic link)
  407.         READLINK FH=0x1        --->
  408.                                <---  "/x/y"
  409.         LOOKUP  FH=0x0  "/x/y"
  410.                                <---  FH=0x2
  411.  
  412.    So in this case the client just passes the link text back to the
  413.    server for evaluation.
  414.  
  415. 6.2.2 Relative Link
  416.  
  417.    If the first character of the link text is not a slash, then the
  418.    following path can be assumed to be relative to the location of the
  419.    symbolic link.  To evaluate this correctly, the client must
  420.    substitute the link text in place of the final pathname component
  421.    that named the link and issue a another LOOKUP relative to the public
  422.    filehandle.
  423.  
  424.         LOOKUP  FH=0x0  "a/b"  --->
  425.                                <---  FH=0x1 (symbolic link)
  426.         READLINK FH=0x1        --->
  427.                                <---  "x/y"
  428.         LOOKUP  FH=0x0  "a/x/y"
  429.                                <---  FH=0x2
  430.  
  431.    By substituting the link text in the link path and having the server
  432.    evaluate the new path, the server effectively gets to evaluate the
  433.    link relative to the link's location.
  434.  
  435.    The client may also "clean up" the resulting pathname by removing
  436.    redundant components as described in Section 4. of RFC 1808.
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450. Callaghan                    Informational                      [Page 8]
  451.  
  452. RFC 2054              WebNFS Client Specification           October 1996
  453.  
  454.  
  455. 6.3 Filesystem Spanning Pathnames
  456.  
  457.    NFS LOOKUP requests normally do not cross from one filesystem to
  458.    another on the server.  For instance if the server has the following
  459.    export and mounts:
  460.  
  461.       /export           (exported)
  462.  
  463.       /export/bigdata   (mountpoint)
  464.  
  465.    then an NFS LOOKUP for "bigdata" using the filehandle for "/export"
  466.    will return a "no file" error because the LOOKUP request did not
  467.    cross the mountpoint on the server.  There is a practical reason for
  468.    this limitation: if the server permitted the mountpoint crossing to
  469.    occur, then a Unix client might receive ambiguous fileid information
  470.    inconsistent with it's view of a single remote mount for "/export".
  471.    It is expected that the client resolve this by mirroring the
  472.    additional server mount, e.g.
  473.  
  474.       Client                           Server
  475.  
  476.       /mnt         <--- mounted on --- /export
  477.  
  478.       /mnt/bigdata <--- mounted on --- /export/bigdata
  479.  
  480.    However, this semantic changes if the client issues the filesystem
  481.    spanning LOOKUP relative to the public filehandle. If the following
  482.    filesystems are exported:
  483.  
  484.       /export           (exported public)
  485.  
  486.       /export/bigdata   (exported mountpoint)
  487.  
  488.    then an NFS LOOKUP for "bigdata" relative to the public filehandle
  489.    will cross the mountpoint - just as if the client had issued a MOUNT
  490.    request - but only if the new filesystem is exported, and only if the
  491.    server supports Export Spanning Pathnames described in Section 6.3 of
  492.    RFC 2055 [RFC2055].
  493.  
  494. 7. Contacting the Server
  495.  
  496.    WebNFS clients should be optimistic in assuming that the server
  497.    supports WebNFS, but should be capable of fallback to conventional
  498.    methods for server access if the server does not support WebNFS.
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506. Callaghan                    Informational                      [Page 9]
  507.  
  508. RFC 2054              WebNFS Client Specification           October 1996
  509.  
  510.  
  511.    The client should start with the assumption that the server supports:
  512.  
  513.      - NFS version 3.
  514.  
  515.      - NFS TCP connections.
  516.  
  517.      - Public Filehandles.
  518.  
  519.    If these assumptions are not met, the client should fall back
  520.    gracefully with a minimum number of messages. The following steps are
  521.    recommended:
  522.  
  523.    1. Attempt to create a TCP connection to the server's
  524.       port 2049.
  525.  
  526.       If the connection fails then assume that a request
  527.       sent over UDP will work.  Use UDP port 2049.
  528.  
  529.       Do not use the PORTMAP protocol to determine the
  530.       server's port unless the server does not respond to
  531.       port 2049 for both TCP and UDP.
  532.  
  533.    2. Assume WebNFS and V3 are supported.
  534.       Send an NFS version 3 LOOKUP with the public filehandle
  535.       for the requested pathname.
  536.  
  537.       If the server returns an RPC PROG_MISMATCH error then
  538.       assume that NFS version 3 is not supported.  Retry
  539.       the LOOKUP with an NFS version 2 public filehandle.
  540.  
  541.       Note: The first call may not necessarily be a LOOKUP
  542.       if the operation is directed at the public filehandle
  543.       itself, e.g. a READDIR or READDIRPLUS of the directory
  544.       that is associated with the public filehandle.
  545.  
  546.       If the server returns an NFS3ERR_STALE, NFS3ERR_INVAL, or
  547.       NFS3ERR_BADHANDLE error, then assume that the server does
  548.       not support WebNFS since it does not recognize the public
  549.       filehandle. The client must use the server's portmap
  550.       service to locate and use the MOUNT protocol to obtain an
  551.       initial filehandle for the requested path.
  552.  
  553.    WebNFS clients can benefit by caching information about the server:
  554.    whether the server supports TCP connections (if TCP is supported then
  555.    the client should cache the TCP connection as well), which protocol
  556.    the server supports and whether the server supports public
  557.    filehandles.  If the server does not support public filehandles, the
  558.    client may choose to cache the port assignment of the MOUNT service
  559.  
  560.  
  561.  
  562. Callaghan                    Informational                     [Page 10]
  563.  
  564. RFC 2054              WebNFS Client Specification           October 1996
  565.  
  566.  
  567.    as well as previously used pathnames and their filehandles.
  568.  
  569. 8. Mount Protocol
  570.  
  571.    If the server returns an error to the client that indicates no
  572.    support for public filehandles, the client must use the MOUNT
  573.    protocol to convert the given pathname to a filehandle.  Version 1 of
  574.    the MOUNT protocol is described in Appendix A of RFC 1094 and version
  575.    3 in Appendix I of RFC 1813. Version 2 of the MOUNT protocol is
  576.    identical to version 1 except for the addition of a procedure
  577.    MOUNTPROC_PATHCONF which returns POSIX pathconf information from the
  578.    server.
  579.  
  580.    At this point the client must already have some indication as to
  581.    which version of the NFS protocol is supported on the server.  Since
  582.    the filehandle format differs between NFS versions 2 and 3, the
  583.    client must select the appropriate version of the MOUNT protocol.
  584.    MOUNT versions 1 and 2 return only NFS version 2 filehandles, whereas
  585.    MOUNT version 3 returns NFS version 3 filehandles.
  586.  
  587.    Unlike the NFS service, the MOUNT service is not registered on a
  588.    well-known port.  The client must use the PORTMAP service to locate
  589.    the server's MOUNT port before it can transmit a MOUNTPROC_MNT
  590.    request to retrieve the filehandle corresponding to the requested
  591.    path.
  592.  
  593.        Client                                       Server
  594.        ------                                       ------
  595.  
  596.        -------------- MOUNT port ? -------------->  Portmapper
  597.        <-------------- Port=984 ------------------
  598.  
  599.        ------- Filehandle for /export/foo ?  ---->  Mountd @ port 984
  600.        <--------- Filehandle=0xf82455ce0..  ------
  601.  
  602.    NFS servers commonly use a client's successful MOUNTPROC_MNT request
  603.    request as an indication that the client has "mounted" the filesystem
  604.    and may maintain this information in a file that lists the
  605.    filesystems that clients currently have mounted.  This information is
  606.    removed from the file when the client transmits an MOUNTPROC_UMNT
  607.    request.  Upon receiving a successful reply to a MOUNTPROC_MNT
  608.    request, a WebNFS client should send a MOUNTPROC_UMNT request to
  609.    prevent an accumulation of "mounted" records on the server.
  610.  
  611.    Note that the additional overhead of the PORTMAP and MOUNT protocols
  612.    will have an effect on the client's binding time to the server and
  613.    the dynamic port assignment of the MOUNT protocol may preclude easy
  614.    firewall or proxy server transit.
  615.  
  616.  
  617.  
  618. Callaghan                    Informational                     [Page 11]
  619.  
  620. RFC 2054              WebNFS Client Specification           October 1996
  621.  
  622.  
  623.    The client may regain some performance improvement by utilizing a
  624.    pathname prefix cache.  For instance, if the client already has a
  625.    filehandle for the pathname "a/b" then there is a good chance that
  626.    the filehandle for "a/b/c" can be recovered by by a lookup of "c"
  627.    relative to the filehandle for "a/b", eliminating the need to have
  628.    the MOUNT protocol translate the pathname.  However, there are risks
  629.    in doing this.  Since the LOOKUP response provides no indication of
  630.    filesystem mountpoint crossing on the server, the relative LOOKUP may
  631.    fail, since NFS requests do not normally cross mountpoints on the
  632.    server.  The MOUNT service can be relied upon to evaluate the
  633.    pathname correctly - including the crossing of mountpoints where
  634.    necessary.
  635.  
  636. 9. Exploiting Concurrency
  637.  
  638.    NFS servers are known for their high capacity and their
  639.    responsiveness to clients transmitting multiple concurrent requests.
  640.    For best performance, a WebNFS client should take advantage of server
  641.    concurrency. The RPC protocol on which the NFS protocol is based,
  642.    provides transport-independent support for this concurrency via a
  643.    unique transaction ID (XID) in every NFS request.
  644.  
  645.    There is no need for a client to open multiple TCP connections to
  646.    transmit concurrent requests.  The RPC record marking protocol allows
  647.    the client to transmit and receive a stream of NFS requests and
  648.    replies over a single connection.
  649.  
  650. 9.1 Read-ahead
  651.  
  652.    To keep the number of READ requests to a minimum, a  WebNFS client
  653.    should use the maximum transfer size that it and the server can
  654.    support.  The client can often optimize utilization of the link
  655.    bandwidth by transmitting concurrent READ requests.  The optimum
  656.    number of READ requests needs to be determined dynamically taking
  657.    into account the available bandwidth, link latency, and I/O bandwidth
  658.    of the client and server, e.g.  the following series of READ requests
  659.    show a client using a single read-ahead to transfer a 128k file from
  660.    the server with 32k READ requests:
  661.  
  662.         READ XID=77 offset=0   for 32k  -->
  663.         READ XID=78 offset=32k for 32k  -->
  664.                                  <-- Data for XID 77
  665.         READ XID=79 offset=64k for 32k  -->
  666.                                  <-- Data for XID 78
  667.         READ XID=80 offset=96k for 32k  -->
  668.                                  <-- Data for XID 79
  669.                                  <-- Data for XID 80
  670.  
  671.  
  672.  
  673.  
  674. Callaghan                    Informational                     [Page 12]
  675.  
  676. RFC 2054              WebNFS Client Specification           October 1996
  677.  
  678.  
  679.    The client must be able to handle the return of data out of order.
  680.    For instance, in the above example the data for XID 78 may be
  681.    received before the data for XID 77.
  682.  
  683.    The client should be careful not to use read-ahead beyond the
  684.    capacity of the server, network, or client, to handle the data. This
  685.    might be determined by a heuristic that measures throughput as the
  686.    download proceeds.
  687.  
  688. 9.2 Concurrent File Download
  689.  
  690.    A client may combine read-ahead with concurrent download of multiple
  691.    files.  A practical example is that of Web pages that contain
  692.    multiple images, or a Java Applet that imports multiple class files
  693.    from the server.
  694.  
  695.    Omitting read-ahead for clarity, the download of multiple files,
  696.    "file1", "file2", and "file3" might look something like this:
  697.  
  698.         LOOKUP XID=77 0x0 "file1"         -->
  699.         LOOKUP XID=78 0x0 "file2"         -->
  700.         LOOKUP XID=79 0x0 "file3"         -->
  701.                                           <-- FH=0x01 for XID 77
  702.         READ XID=80 0x01 offset=0 for 32k -->
  703.                                           <-- FH=0x02 for XID 78
  704.         READ XID=81 0x02 offset=0 for 32k -->
  705.                                           <-- FH=0x03 for XID 79
  706.         READ XID=82 0x03 offset=0 for 32k -->
  707.                                           <-- Data for XID 80
  708.                                           <-- Data for XID 81
  709.                                           <-- Data for XID 82
  710.  
  711.    Note that the replies may be received in a different order from the
  712.    order in which the requests were transmitted. This is not a problem,
  713.    since RPC uses the XID to match requests with replies.  A benefit of
  714.    the request/reply multiplexing provided by the RPC protocol is that
  715.    the download of a large file that requires many READ requests will
  716.    not delay the concurrent download of smaller files.
  717.  
  718.    Again, the client must be careful not to drown the server with
  719.    download requests.
  720.  
  721. 10.0 Timeout and Retransmission
  722.  
  723.    A WebNFS client should follow the example of conventional NFS clients
  724.    and handle server or network outages gracefully.  If a reply is not
  725.    received within a given timeout, the client should retransmit the
  726.    request with its original XID (described in Section 8 of RFC 1831).
  727.  
  728.  
  729.  
  730. Callaghan                    Informational                     [Page 13]
  731.  
  732. RFC 2054              WebNFS Client Specification           October 1996
  733.  
  734.  
  735.    The XID can be used by the server to detect duplicate requests and
  736.    avoid unnecessary work.
  737.  
  738.    While it would seem that retransmission over a TCP connection is
  739.    unnecessary (since TCP is responsible for detecting and
  740.    retransmitting lost data), at the RPC layer retransmission is still
  741.    required for recovery from a lost TCP connection, perhaps due to a
  742.    server crash or, because of resource limitations, the server has
  743.    closed the connection.  When the TCP connection is lost, the client
  744.    must re-establish the connection and retransmit pending requests.
  745.  
  746.    The client should set the request timeout according to the following
  747.    guidelines:
  748.  
  749.         - A timeout that is too small may result in the
  750.           wasteful transmission of duplicate requests.
  751.           The server may be just slow to respond, either because
  752.           it is heavily loaded, or because the link latency is high.
  753.  
  754.         - A timeout that is too large may harm throughput if
  755.           the request is lost and the connection is idle waiting
  756.           for the retransmission to occur.
  757.  
  758.         - The optimum timeout may vary with the server's
  759.           responsiveness over time, and with the congestion
  760.           and latency of the network.
  761.  
  762.         - The optimum timeout will vary with the type of NFS
  763.           request.  For instance, the response to a LOOKUP
  764.           request will be received more quickly than the response
  765.           to a READ request.
  766.  
  767.         - The timeout should be increased according to an
  768.           exponential backoff until a limit is reached.
  769.           For instance, if the timeout is 1 second, the
  770.           first retransmitted request should have a timeout of
  771.           two seconds, the second retransmission 4 seconds, and
  772.           so on until the timeout reaches a limit, say 30 seconds.
  773.           This avoids flooding the network with retransmission
  774.           requests when the server is down, or overloaded.
  775.  
  776.    As a general rule of thumb, the client should start with a long
  777.    timeout until the server's responsiveness is determined.  The timeout
  778.    can then be set to a value that reflects the server's responsiveness
  779.    to previous requests.
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786. Callaghan                    Informational                     [Page 14]
  787.  
  788. RFC 2054              WebNFS Client Specification           October 1996
  789.  
  790.  
  791. 11.0 Bibliography
  792.  
  793.    [RFC1808]       Fielding, R.,
  794.                    "Relative Uniform Resource Locators", RFC 1808,
  795.                    June 1995.
  796.                    http://www.internic.net/rfc/rfc1808.txt
  797.  
  798.    [RFC1831]       Srinivasan, R., "RPC: Remote Procedure Call
  799.                    Protocol Specification Version 2", RFC 1831,
  800.                    August 1995.
  801.                    http://www.internic.net/rfc/rfc1831.txt
  802.  
  803.    [RFC1832]       Srinivasan, R, "XDR: External Data Representation
  804.                    Standard", RFC 1832, August 1995.
  805.                    http://www.internic.net/rfc/rfc1832.txt
  806.  
  807.    [RFC1833]       Srinivasan, R., "Binding Protocols for ONC RPC
  808.                    Version 2", RFC 1833, August 1995.
  809.                    http://www.internic.net/rfc/rfc1833.txt
  810.  
  811.    [RFC1094]       Sun Microsystems, Inc., "Network Filesystem
  812.                    Specification", RFC 1094, March 1989.  NFS
  813.                    version 2 protocol specification.
  814.                    http://www.internic.net/rfc/rfc1094.txt
  815.  
  816.    [RFC1813]       Sun Microsystems, Inc., "NFS Version 3 Protocol
  817.                    Specification," RFC 1813, June 1995.  NFS version
  818.                    3 protocol specification.
  819.                    http://www.internic.net/rfc/rfc1813.txt
  820.  
  821.    [RFC2055]       Callaghan, B., "WebNFS Server Specification",
  822.                    RFC 2055, October 1996.
  823.                    http://www.internic.net/rfc/rfc2055.txt
  824.  
  825.    [Sandberg]      Sandberg, R., D. Goldberg, S. Kleiman, D. Walsh,
  826.                    B.  Lyon, "Design and Implementation of the Sun
  827.                    Network Filesystem," USENIX Conference
  828.                    Proceedings, USENIX Association, Berkeley, CA,
  829.                    Summer 1985.  The basic paper describing the
  830.                    SunOS implementation of the NFS version 2
  831.                    protocol, and discusses the goals, protocol
  832.                    specification and trade-offs.
  833.  
  834.    [X/OpenNFS]     X/Open Company, Ltd., X/Open CAE Specification:
  835.                    Protocols for X/Open Internetworking: XNFS,
  836.                    X/Open Company, Ltd., Apex Plaza, Forbury Road,
  837.                    Reading Berkshire, RG1 1AX, United Kingdom,
  838.                    1991.  This is an indispensable reference for
  839.  
  840.  
  841.  
  842. Callaghan                    Informational                     [Page 15]
  843.  
  844. RFC 2054              WebNFS Client Specification           October 1996
  845.  
  846.  
  847.                    NFS version 2 protocol and accompanying
  848.                    protocols, including the Lock Manager and the
  849.                    Portmapper.
  850.  
  851.    [X/OpenPCNFS]   X/Open Company, Ltd., X/Open CAE Specification:
  852.                    Protocols for X/Open Internetworking: (PC)NFS,
  853.                    Developer's Specification, X/Open Company, Ltd.,
  854.                    Apex Plaza, Forbury Road, Reading Berkshire, RG1
  855.                    1AX, United Kingdom, 1991.  This is an
  856.                    indispensable reference for NFS version 2
  857.                    protocol and accompanying protocols, including
  858.                    the Lock Manager and the Portmapper.
  859.  
  860. 12. Security Considerations
  861.  
  862.    Since the WebNFS server features are based on NFS protocol versions 2
  863.    and 3, the RPC based security considerations described in RFC 1094,
  864.    RFC 1831, and RFC 1832 apply here also.
  865.  
  866.    Clients and servers may separately negotiate secure connection
  867.    schemes for authentication, data integrity, and privacy.
  868.  
  869. 13. Acknowledgements
  870.  
  871.    This specification was extensively reviewed by the NFS group at
  872.    SunSoft and brainstormed by Michael Eisler.
  873.  
  874. 14. Author's Address
  875.  
  876.    Address comments related to this document to:
  877.  
  878.    nfs@eng.sun.com
  879.  
  880.  
  881.    Brent Callaghan
  882.    Sun Microsystems, Inc.
  883.    2550 Garcia Avenue
  884.    Mailstop Mpk17-201
  885.    Mountain View, CA 94043-1100
  886.  
  887.    Phone: 1-415-786-5067
  888.    Fax:   1-415-786-5896
  889.    EMail: brent.callaghan@eng.sun.com
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898. Callaghan                    Informational                     [Page 16]
  899.  
  900.