diff options
author | Volker Lendecke <vl@samba.org> | 2009-11-15 10:46:23 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-11-18 23:16:13 +0100 |
commit | d1c34d405421e2969d6cf4fc7438f783e7d6b0a5 (patch) | |
tree | 031d6a32c255db2a6a13d3a04bc4ea881129585d /source3/smbd/posix_acls.c | |
parent | f6650f5d19ad90b8e1f392efbe211c4ffa0e70c0 (diff) | |
download | samba-d1c34d405421e2969d6cf4fc7438f783e7d6b0a5.tar.gz samba-d1c34d405421e2969d6cf4fc7438f783e7d6b0a5.tar.bz2 samba-d1c34d405421e2969d6cf4fc7438f783e7d6b0a5.zip |
s3: Replace some create_synthetic_smb_fname() calls
In very hot codepaths like the statcache copy_smb_filename and the subsequent
recursive talloc_free is noticable in the CPU load.
Diffstat (limited to 'source3/smbd/posix_acls.c')
-rw-r--r-- | source3/smbd/posix_acls.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 15ea4d5fb2..65d0929024 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -3460,49 +3460,41 @@ NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name, SMB_ACL_T posix_acl = NULL; SMB_ACL_T def_acl = NULL; struct pai_val *pal; - struct smb_filename *smb_fname = NULL; - NTSTATUS status; + struct smb_filename smb_fname; int ret; *ppdesc = NULL; DEBUG(10,("posix_get_nt_acl: called for file %s\n", name )); - status = create_synthetic_smb_fname(talloc_tos(), name, NULL, NULL, - &smb_fname); - if (!NT_STATUS_IS_OK(status)) { - return status; - } + ZERO_STRUCT(smb_fname); + smb_fname.base_name = discard_const_p(char, name); /* Get the stat struct for the owner info. */ if (lp_posix_pathnames()) { - ret = SMB_VFS_LSTAT(conn, smb_fname); + ret = SMB_VFS_LSTAT(conn, &smb_fname); } else { - ret = SMB_VFS_STAT(conn, smb_fname); + ret = SMB_VFS_STAT(conn, &smb_fname); } if (ret == -1) { - status = map_nt_error_from_unix(errno); - goto out; + return map_nt_error_from_unix(errno); } /* Get the ACL from the path. */ posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, SMB_ACL_TYPE_ACCESS); /* If it's a directory get the default POSIX ACL. */ - if(S_ISDIR(smb_fname->st.st_ex_mode)) { + if(S_ISDIR(smb_fname.st.st_ex_mode)) { def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, SMB_ACL_TYPE_DEFAULT); def_acl = free_empty_sys_acl(conn, def_acl); } pal = load_inherited_info(conn, name); - status = posix_get_nt_acl_common(conn, name, &smb_fname->st, pal, - posix_acl, def_acl, security_info, - ppdesc); - out: - TALLOC_FREE(smb_fname); - return status; + return posix_get_nt_acl_common(conn, name, &smb_fname.st, pal, + posix_acl, def_acl, security_info, + ppdesc); } /**************************************************************************** |