[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Wed Oct 12 12:49:01 UTC 2022


The branch, master has been updated
       via  cc397175cb9 vfs_glusterfs: Simplify SMB_VFS_FDOPENDIR implementation
       via  7af4bfe8285 vfs_glusterfs: Add path based fallback mechanism for SMB_VFS_FGETXATTR
       via  6a6bd1a0530 vfs_glusterfs: Do not use glfs_fgetxattr() for SMB_VFS_GET_REAL_FILENAME_AT
       via  8cbd9e63724 vfs_glusterfs: Simplify SMB_VFS_GET_REAL_FILENAME_AT implementation
      from  0bf8d136769 docs-xml: some fixes to acl parameter documentation

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit cc397175cb9a1b06f268ecf6b3d62f621947cbba
Author: Anoop C S <anoopcs at samba.org>
Date:   Tue Oct 11 23:02:48 2022 +0530

    vfs_glusterfs: Simplify SMB_VFS_FDOPENDIR implementation
    
    It was unnecessary to construct full directory path as "dir/." which is
    same as "dir". We could just directly use fsp->fsp_name->base_name and
    return directory stream obtained from glfs_opendir().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15198
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Wed Oct 12 12:48:50 UTC 2022 on sn-devel-184

commit 7af4bfe8285714c137b6347b17305c9cd0702bdd
Author: Anoop C S <anoopcs at samba.org>
Date:   Mon Oct 10 20:29:13 2022 +0530

    vfs_glusterfs: Add path based fallback mechanism for SMB_VFS_FGETXATTR
    
    Fallback mechanism was missing in vfs_gluster_fgetxattr() for path based
    call. Therefore adding a similar mechanism as seen with other calls like
    vfs_gluster_fsetxattr, vfs_gluster_flistxattr etc.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15198
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 6a6bd1a0530424def64d2d462b54e4c1f4f9bebb
Author: Anoop C S <anoopcs at samba.org>
Date:   Tue Oct 11 23:27:37 2022 +0530

    vfs_glusterfs: Do not use glfs_fgetxattr() for SMB_VFS_GET_REAL_FILENAME_AT
    
    glfs_fgetxattr() or generally fgetxattr() will return EBADF as dirfsp
    here is a pathref fsp. GlusterFS client log had following entries
    indicating the error:
    
    W [MSGID: 114031] [client-rpc-fops_v2.c:993:client4_0_fgetxattr_cbk] \
      0-vol-client-0: remote operation failed. [{errno=9}, {error=Bad file descriptor}]
    
    Therefore use glfs_getxattr() only for implementing get_real_filename_at
    logic.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15198
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 8cbd9e63724d80c06565d0c90bd107166dfd9bbe
Author: Anoop C S <anoopcs at samba.org>
Date:   Tue Oct 11 23:25:46 2022 +0530

    vfs_glusterfs: Simplify SMB_VFS_GET_REAL_FILENAME_AT implementation
    
    It was unnecessary to construct full directory path as "dir/." which is
    same as "dir". We could just directly use dirfsp->fsp_name->base_name
    for glfs_getxattr() and return the result.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15198
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_glusterfs.c | 89 ++++++++++-------------------------------
 1 file changed, 21 insertions(+), 68 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 4284d7dea1d..4b309de1377 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -627,38 +627,12 @@ static DIR *vfs_gluster_fdopendir(struct vfs_handle_struct *handle,
 				  uint32_t attributes)
 {
 	glfs_fd_t *glfd = NULL;
-	struct smb_filename *full_fname = NULL;
-	struct smb_filename *smb_fname_dot = NULL;
-
-	smb_fname_dot = synthetic_smb_fname(fsp->fsp_name,
-					    ".",
-					    NULL,
-					    NULL,
-					    0,
-					    0);
-
-	if (smb_fname_dot == NULL) {
-		return NULL;
-	}
-
-	full_fname = full_path_from_dirfsp_atname(talloc_tos(),
-						  fsp,
-						  smb_fname_dot);
-	if (full_fname == NULL) {
-		TALLOC_FREE(smb_fname_dot);
-		return NULL;
-	}
 
-	glfd = glfs_opendir(handle->data, full_fname->base_name);
+	glfd = glfs_opendir(handle->data, fsp->fsp_name->base_name);
 	if (glfd == NULL) {
-		TALLOC_FREE(full_fname);
-		TALLOC_FREE(smb_fname_dot);
 		return NULL;
 	}
 
-	TALLOC_FREE(full_fname);
-	TALLOC_FREE(smb_fname_dot);
-
 	return (DIR *)glfd;
 }
 
@@ -2267,12 +2241,6 @@ static NTSTATUS vfs_gluster_get_real_filename_at(
 	int ret;
 	char key_buf[GLUSTER_NAME_MAX + 64];
 	char val_buf[GLUSTER_NAME_MAX + 1];
-#ifdef HAVE_GFAPI_VER_7_11
-	glfs_fd_t *pglfd = NULL;
-#else
-	struct smb_filename *smb_fname_dot = NULL;
-	struct smb_filename *full_fname = NULL;
-#endif
 
 	if (strlen(name) >= GLUSTER_NAME_MAX) {
 		return NT_STATUS_OBJECT_NAME_INVALID;
@@ -2281,40 +2249,11 @@ static NTSTATUS vfs_gluster_get_real_filename_at(
 	snprintf(key_buf, GLUSTER_NAME_MAX + 64,
 		 "glusterfs.get_real_filename:%s", name);
 
-#ifdef HAVE_GFAPI_VER_7_11
-	pglfd = vfs_gluster_fetch_glfd(handle, dirfsp);
-	if (pglfd == NULL) {
-		DBG_ERR("Failed to fetch gluster fd\n");
-		return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-	}
-
-	ret = glfs_fgetxattr(pglfd, key_buf, val_buf, GLUSTER_NAME_MAX + 1);
-#else
-	smb_fname_dot = synthetic_smb_fname(mem_ctx,
-					    ".",
-					    NULL,
-					    NULL,
-					    0,
-					    0);
-	if (smb_fname_dot == NULL) {
-		return NT_STATUS_NO_MEMORY;
-	}
-
-	full_fname = full_path_from_dirfsp_atname(talloc_tos(),
-						  dirfsp,
-						  smb_fname_dot);
-	if (full_fname == NULL) {
-		TALLOC_FREE(smb_fname_dot);
-		return NT_STATUS_NO_MEMORY;
-	}
-
-	ret = glfs_getxattr(handle->data, full_fname->base_name,
-			    key_buf, val_buf, GLUSTER_NAME_MAX + 1);
-
-	TALLOC_FREE(smb_fname_dot);
-	TALLOC_FREE(full_fname);
-#endif
-
+	ret = glfs_getxattr(handle->data,
+			    dirfsp->fsp_name->base_name,
+			    key_buf,
+			    val_buf,
+			    GLUSTER_NAME_MAX + 1);
 	if (ret == -1) {
 		if (errno == ENOATTR) {
 			errno = ENOENT;
@@ -2350,7 +2289,21 @@ static ssize_t vfs_gluster_fgetxattr(struct vfs_handle_struct *handle,
 		return -1;
 	}
 
-	return glfs_fgetxattr(glfd, name, value, size);
+	if (!fsp->fsp_flags.is_pathref) {
+		/*
+		 * We can use an io_fd to retrieve xattr value.
+		 */
+		return glfs_fgetxattr(glfd, name, value, size);
+	}
+
+	/*
+	 * This is no longer a handle based call.
+	 */
+	return glfs_getxattr(handle->data,
+			     fsp->fsp_name->base_name,
+			     name,
+			     value,
+			     size);
 }
 
 static ssize_t vfs_gluster_flistxattr(struct vfs_handle_struct *handle,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list