]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: change_dir_owner_to_parent_fsp(). Don't re-stat the pathref.
authorJeremy Allison <jra@samba.org>
Wed, 9 Jun 2021 23:40:08 +0000 (16:40 -0700)
committerRalph Boehme <slow@samba.org>
Fri, 18 Jun 2021 16:32:28 +0000 (16:32 +0000)
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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/open.c

index 7e86ed28d0671b3f0ffebe222dc7c6ff204f9cd7..1ab8c668cfac2012e979daaed687e730183e659e 100644 (file)
@@ -987,15 +987,6 @@ static NTSTATUS change_dir_owner_to_parent_fsp(struct files_struct *parent_fsp,
        NTSTATUS status;
        int ret;
 
-       ret = SMB_VFS_FSTAT(parent_fsp, &parent_fsp->fsp_name->st);
-       if (ret == -1) {
-               status = map_nt_error_from_unix(errno);
-               DBG_ERR("failed to stat parent directory %s. Error was %s\n",
-                        fsp_str_dbg(parent_fsp),
-                        nt_errstr(status));
-               return status;
-       }
-
        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("directory %s is already owned by uid %u\n",