• Alex Elder's avatar
    ceph: let path portion of mount "device" be optional · c98f533c
    Alex Elder authored
    A recent change to /sbin/mountall causes any trailing '/' character
    in the "device" (or fs_spec) field in /etc/fstab to be stripped.  As
    a result, an entry for a ceph mount that intends to mount the root
    of the name space ends up with now path portion, and the ceph mount
    option processing code rejects this.
    
    That is, an entry in /etc/fstab like:
        cephserver:port:/ /mnt ceph defaults 0 0
    provides to the ceph code just "cephserver:port:" as the "device,"
    and that gets rejected.
    
    Although this is a bug in /sbin/mountall, we can have the ceph mount
    code support an empty/nonexistent path, interpreting it to mean the
    root of the name space.
    
    RFC 5952 offers recommendations for how to express IPv6 addresses,
    and recommends the usage found in RFC 3986 (which specifies the
    format for URI's) for representing both IPv4 and IPv6 addresses that
    include port numbers.  (See in particular the definition of
    "authority" found in the Appendix of RFC 3986.)
    
    According to those standards, no host specification will ever
    contain a '/' character.  As a result, it is sufficient to scan a
    provided "device" from an /etc/fstab entry for the first '/'
    character, and if it's found, treat that as the beginning of the
    path.  If no '/' character is present, we can treat the entire
    string as the monitor host specification(s), and assume the path
    to be the root of the name space.  We'll still require a ':' to
    separate the host portion from the (possibly empty) path portion.
    
    This means that we can more formally define how ceph will interpret
    the "device" it's provided when processing a mount request:
    
        "device" will look like:
            <server_spec>[,<server_spec>...]:[<path>]
        where
            <server_spec> is <ip>[:<port>]
            <path> is optional, but if present must begin with '/'
    
    This addresses http://tracker.newdream.net/issues/2919Signed-off-by: default avatarAlex Elder <elder@inktank.com>
    Reviewed-by: default avatarDan Mick <dan.mick@inktank.com>
    c98f533c
super.c 23.7 KB