• Xiubo Li's avatar
    ceph: remove the extra slashes in the server path · 4fbc0c71
    Xiubo Li authored
    It's possible to pass the mount helper a server path that has more
    than one contiguous slash character. For example:
    
      $ mount -t ceph 192.168.195.165:40176:/// /mnt/cephfs/
    
    In the MDS server side the extra slashes of the server path will be
    treated as snap dir, and then we can get the following debug logs:
    
      ceph:  mount opening path //
      ceph:  open_root_inode opening '//'
      ceph:  fill_trace 0000000059b8a3bc is_dentry 0 is_target 1
      ceph:  alloc_inode 00000000dc4ca00b
      ceph:  get_inode created new inode 00000000dc4ca00b 1.ffffffffffffffff ino 1
      ceph:  get_inode on 1=1.ffffffffffffffff got 00000000dc4ca00b
    
    And then when creating any new file or directory under the mount
    point, we can hit the following BUG_ON in ceph_fill_trace():
    
      BUG_ON(ceph_snap(dir) != dvino.snap);
    
    Have the client ignore the extra slashes in the server path when
    mounting. This will also canonicalize the path, so that identical mounts
    can be consilidated.
    
    1) "//mydir1///mydir//"
    2) "/mydir1/mydir"
    3) "/mydir1/mydir/"
    
    Regardless of the internal treatment of these paths, the kernel still
    stores the original string including the leading '/' for presentation
    to userland.
    
    URL: https://tracker.ceph.com/issues/42771Signed-off-by: default avatarXiubo Li <xiubli@redhat.com>
    Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
    Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
    4fbc0c71
super.c 32.1 KB