linux-stable/fs/ceph
Alex Elder c98f533c94 ceph: let path portion of mount "device" be optional
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/2919

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
2012-10-01 14:30:49 -05:00
..
addr.c ceph: Push file_update_time() into ceph_page_mkwrite() 2012-07-31 01:02:45 +04:00
caps.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client 2012-02-02 15:47:33 -08:00
ceph_frag.c ceph: factor out libceph from Ceph file system 2010-10-20 15:37:28 -07:00
debugfs.c libceph: delay debugfs initialization until we learn global_id 2012-08-20 10:03:15 -07:00
dir.c ceph: simplify+fix atomic_open 2012-08-02 09:11:19 -07:00
export.c ceph: move encode_fh to new API 2012-05-29 23:28:33 -04:00
file.c ceph: simplify+fix atomic_open 2012-08-02 09:11:19 -07:00
inode.c ceph: tolerate (and warn on) extraneous dentry from mds 2012-08-21 15:55:25 -07:00
ioctl.c ceph: avoid divide by zero in __validate_layout() 2012-08-21 15:55:28 -07:00
ioctl.h ceph: fully initialize new layout 2012-05-16 14:28:27 -05:00
Kconfig ceph: factor out libceph from Ceph file system 2010-10-20 15:37:28 -07:00
locks.c ceph: unwind canceled flock state 2011-06-07 21:36:45 -07:00
Makefile ceph: Makefile: Remove unnessary code 2011-01-12 15:15:13 -08:00
mds_client.c ceph: close old con before reopening on mds reconnect 2012-07-30 18:15:32 -07:00
mds_client.h ceph: define ceph_auth_handshake type 2012-05-17 08:18:12 -05:00
mdsmap.c ceph: factor out libceph from Ceph file system 2010-10-20 15:37:28 -07:00
snap.c ceph: define snap counts as u32 everywhere 2012-07-30 18:15:47 -07:00
strings.c ceph: factor out libceph from Ceph file system 2010-10-20 15:37:28 -07:00
super.c ceph: let path portion of mount "device" be optional 2012-10-01 14:30:49 -05:00
super.h ceph: simplify+fix atomic_open 2012-08-02 09:11:19 -07:00
xattr.c ceph: fix potential double free 2012-07-30 18:15:35 -07:00