--- samba-4.14.0rc4/source3/modules/vfs_zfsacl.c.ORIG	2021-03-01 12:50:53.841019000 +0100
+++ samba-4.14.0rc4/source3/modules/vfs_zfsacl.c	2021-03-01 12:52:14.721679000 +0100
@@ -162,7 +162,7 @@
 static bool zfs_process_smbacl(vfs_handle_struct *handle, files_struct *fsp,
 			       struct SMB4ACL_T *smbacl)
 {
-	int naces = smb_get_naces(smbacl), i, rv;
+	int naces = smb_get_naces(smbacl), i, rv, fd;
 	ace_t *acebuf;
 	struct SMB4ACE_T *smbace;
 	TALLOC_CTX	*mem_ctx;
@@ -235,8 +235,9 @@
 	SMB_ASSERT(i == naces);
 
 	/* store acl */
-	if (fsp->fh->fd != -1) {
-		rv = facl(fsp->fh->fd, ACE_SETACL, naces, acebuf);
+	fd = fsp_get_pathref_fd(fsp);
+	if (fd != -1) {
+		rv = facl(fd, ACE_SETACL, naces, acebuf);
 	}
 	else {
 		rv = acl(fsp->fsp_name->base_name, ACE_SETACL, naces, acebuf);
@@ -317,14 +318,15 @@
 		       struct files_struct *fsp,
 		       ace_t **outbuf)
 {
-	int naces, rv;
+	int naces, rv, fd;
 	ace_t *acebuf = NULL;
 
-	if (fsp->fh->fd == -1) {
+	fd = fsp_get_pathref_fd(fsp);
+	if (fd == -1) {
 		return get_zfsacl(mem_ctx, fsp->fsp_name, outbuf);
 	}
 
-	naces = facl(fsp->fh->fd, ACE_GETACLCNT, 0, NULL);
+	naces = facl(fd, ACE_GETACLCNT, 0, NULL);
 	if (naces == -1) {
 		int dbg_level = 10;
 
@@ -342,7 +344,7 @@
 		return -1;
 	}
 
-	rv = facl(fsp->fh->fd, ACE_GETACL, naces, acebuf);
+	rv = facl(fd, ACE_GETACL, naces, acebuf);
 	if (rv == -1) {
 		DBG_DEBUG("acl(ACE_GETACL, %s): %s ",
 			  fsp_str_dbg(fsp), strerror(errno));
