From ddb31110db8e1b5995d392ced988f34d2f9145d2 Mon Sep 17 00:00:00 2001 From: Santosh Kumar Pradhan Date: Tue, 22 Jul 2014 16:56:57 +0530 Subject: gNFS: Subdir mount does not work on UDP proto After enabling nfs.mount-udp, mounting a subdir on a volume over NFS fails. Because mountudpproc3_mnt_3_svc() invokes nfs3_rootfh() which internally calls mnt3_mntpath_to_export() to resolve the mount path. mnt3_mntpath_to_export() just works if the mount path requested is volume itself. It is not able to resolve, if the path is a subdir inside the volume. MOUNT over TCP uses mnt3_find_export() to resolve subdir path but UDP can't use this routine because mnt3_find_export() needs the req data (of type rpcsvc_request_t) and it's available only for TCP version of RPC. FIX: (1) Use syncop_lookup() framework to resolve the MOUNT PATH by breaking it into components and resolve component-by-component. i.e. glfs_resolve_at () API from libgfapi shared object. (2) If MOUNT PATH is subdir, then make sure subdir export is not disabled. (3) Add auth mechanism to respect nfs.rpc-auth-allow/reject and subdir auth i.e. nfs.export-dir (4) Enhanced error handling for MOUNT over UDP Change-Id: I42ee69415d064b98af4f49773026562824f684d1 BUG: 1118311 Signed-off-by: Santosh Kumar Pradhan Reviewed-on: http://review.gluster.org/8346 Reviewed-by: soumya k Tested-by: Gluster Build System Reviewed-by: Niels de Vos --- api/src/glfs-internal.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'api/src/glfs-internal.h') diff --git a/api/src/glfs-internal.h b/api/src/glfs-internal.h index 6fdec961a1c..ff875280ce6 100644 --- a/api/src/glfs-internal.h +++ b/api/src/glfs-internal.h @@ -226,4 +226,55 @@ int glfs_getxattr_process (void *value, size_t size, dict_t *xattr, /* Sends RPC call to glusterd to fetch required volume info */ int glfs_get_volume_info (struct glfs *fs); +/* + SYNOPSIS + + glfs_new_from_ctx: Creates a virtual mount object by taking a + glusterfs_ctx_t object. + + DESCRIPTION + + glfs_new_from_ctx() is not same as glfs_new(). It takes the + glusterfs_ctx_t object instead of creating one by glusterfs_ctx_new(). + Again the usage is restricted to NFS MOUNT over UDP i.e. in + glfs_resolve_at() which would take fs object as input but never use + (purpose is not to change the ABI of glfs_resolve_at()). + + PARAMETERS + + @ctx: glusterfs_ctx_t object + + RETURN VALUES + + fs : Pointer to the newly created glfs_t object. + NULL : Otherwise. +*/ + +struct glfs *glfs_new_from_ctx (glusterfs_ctx_t *ctx); + +/* + SYNOPSIS + + glfs_free_from_ctx: Free up the memory occupied by glfs_t object + created by glfs_new_from_ctx(). + + DESCRIPTION + + The glfs_t object allocated by glfs_new_from_ctx() must be released + by the caller using this routine. The usage is restricted to NFS + MOUNT over UDP i.e. + __mnt3udp_get_export_subdir_inode () + => glfs_resolve_at(). + + PARAMETERS + + @fs: The glfs_t object to be deallocated. + + RETURN VALUES + + void +*/ + +void glfs_free_from_ctx (struct glfs *fs); + #endif /* !_GLFS_INTERNAL_H */ -- cgit