From: Anoop C S Date: Fri, 19 Aug 2022 06:41:54 +0000 (+0530) Subject: vfs_glusterfs: Use glfs_unlinkat() for SMB_VFS_UNLINKAT X-Git-Tag: talloc-2.4.0~1288 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2fa71202ab347fd057bb9b42740e57344e2679e1;p=thirdparty%2Fsamba.git vfs_glusterfs: Use glfs_unlinkat() for SMB_VFS_UNLINKAT BUG: https://bugzilla.samba.org/show_bug.cgi?id=15157 Signed-off-by: Anoop C S Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 3d4a0af93b2..dfed5c739cc 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -1581,9 +1581,24 @@ static int vfs_gluster_unlinkat(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname, int flags) { - struct smb_filename *full_fname = NULL; int ret; +#ifdef HAVE_GFAPI_VER_7_11 + glfs_fd_t *pglfd = NULL; + + START_PROFILE(syscall_unlinkat); + + pglfd = vfs_gluster_fetch_glfd(handle, dirfsp); + if (pglfd == NULL) { + END_PROFILE(syscall_unlinkat); + DBG_ERR("Failed to fetch gluster fd\n"); + return -1; + } + + ret = glfs_unlinkat(pglfd, smb_fname->base_name, flags); +#else + struct smb_filename *full_fname = NULL; + START_PROFILE(syscall_unlinkat); full_fname = full_path_from_dirfsp_atname(talloc_tos(), @@ -1599,7 +1614,10 @@ static int vfs_gluster_unlinkat(struct vfs_handle_struct *handle, } else { ret = glfs_unlink(handle->data, full_fname->base_name); } + TALLOC_FREE(full_fname); +#endif + END_PROFILE(syscall_unlinkat); return ret;