diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 4c380c3ad20..ee5d1caa793 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -365,26 +365,12 @@ static int cephwrap_mkdirat(struct vfs_handle_struct *handle,
 			mode_t mode)
 {
 	int result;
-	struct smb_filename *parent = NULL;
-	bool ok;
 
 	DBG_DEBUG("[CEPH] mkdir(%p, %s)\n",
 		  handle, smb_fname_str_dbg(smb_fname));
 
 	SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
 
-	if (lp_inherit_acls(SNUM(handle->conn))) {
-		ok = parent_smb_fname(talloc_tos(), smb_fname, &parent, NULL);
-		if (ok && directory_has_default_acl(handle->conn,
-				dirfsp,
-				parent))
-		{
-			mode = 0777;
-		}
-	}
-
-	TALLOC_FREE(parent);
-
 	result = ceph_mkdir(handle->data, smb_fname->base_name, mode);
 	return WRAP_RETURN(result);
 }
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index df52856cd1e..4aaafedac56 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -670,25 +670,11 @@ static int vfswrap_mkdirat(vfs_handle_struct *handle,
 			mode_t mode)
 {
 	int result;
-	struct smb_filename *parent = NULL;
-	bool ok;
 
 	START_PROFILE(syscall_mkdirat);
 
 	SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
 
-	if (lp_inherit_acls(SNUM(handle->conn))) {
-		ok = parent_smb_fname(talloc_tos(), smb_fname, &parent, NULL);
-		if (ok && directory_has_default_acl(handle->conn,
-				dirfsp,
-				parent))
-		{
-			mode = (0777 & lp_directory_mask(SNUM(handle->conn)));
-		}
-	}
-
-	TALLOC_FREE(parent);
-
 	result = mkdirat(fsp_get_pathref_fd(dirfsp), smb_fname->base_name, mode);
 
 	END_PROFILE(syscall_mkdirat);
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 801885fe26d..35949f4b17c 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -4364,6 +4364,14 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
 		return status;
 	}
 
+	if (lp_inherit_acls(SNUM(conn))) {
+		if (directory_has_default_acl(conn,
+					      conn->cwd_fsp,
+					      parent_dir_fname)) {
+			mode = (0777 & lp_directory_mask(SNUM(conn)));
+		}
+	}
+
 	ret = SMB_VFS_MKDIRAT(conn,
 			      conn->cwd_fsp,
 			      smb_dname,