From: Jeremy Allison Date: Wed, 9 Jun 2021 23:43:04 +0000 (-0700) Subject: s3: smbd: change_file_owner_to_parent_fsp(). Don't re-stat the pathref. X-Git-Tag: tevent-0.11.0~324 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c8e8633b98a2d68e51b0b271bf6f0ee36ddb6283;p=thirdparty%2Fsamba.git s3: smbd: change_file_owner_to_parent_fsp(). Don't re-stat the pathref. Optimization now becomes clear. We already have a valid stat of the parent directory so we don't need to re-do a system call. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 22bd6050eb8..3d7fea75252 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -944,15 +944,6 @@ static void change_file_owner_to_parent_fsp(struct files_struct *parent_fsp, { int ret; - ret = SMB_VFS_FSTAT(parent_fsp, &parent_fsp->fsp_name->st); - if (ret == -1) { - DBG_ERR("failed to stat parent " - "directory %s. Error was %s\n", - fsp_str_dbg(parent_fsp), - strerror(errno)); - return; - } - if (parent_fsp->fsp_name->st.st_ex_uid == fsp->fsp_name->st.st_ex_uid) { /* Already this uid - no need to change. */ DBG_DEBUG("file %s is already owned by uid %u\n",