In aio_fork, we have to close all fd's, we might hold a gpfs share mode
[kai/samba-autobuild/.git] / source3 / modules / vfs_acl_xattr.c
index 3c8f241ad962dc146d8303ec463112a977eb588c..49e48998790872fa146188f36476c252fa3140ce 100644 (file)
@@ -328,10 +328,7 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
        size_t size;
        char *parent_name;
 
-       if (!parent_dirname_talloc(ctx,
-                               fname,
-                               &parent_name,
-                               NULL)) {
+       if (!parent_dirname(ctx, fname, &parent_name, NULL)) {
                return NT_STATUS_NO_MEMORY;
        }
 
@@ -384,7 +381,11 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
                if (fsp && !fsp->is_directory && fsp->fh->fd != -1) {
                        ret = SMB_VFS_FSTAT(fsp, &sbuf);
                } else {
-                       ret = SMB_VFS_STAT(handle->conn,fname, &sbuf);
+                       if (fsp && fsp->posix_open) {
+                               ret = SMB_VFS_LSTAT(handle->conn,fname, &sbuf);
+                       } else {
+                               ret = SMB_VFS_STAT(handle->conn,fname, &sbuf);
+                       }
                }
                if (ret == -1) {
                        return map_nt_error_from_unix(errno);
@@ -562,7 +563,11 @@ static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
                        return NT_STATUS_OK;
                }
                if (fsp->is_directory || fsp->fh->fd == -1) {
-                       ret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf);
+                       if (fsp->posix_open) {
+                               ret = SMB_VFS_LSTAT(fsp->conn,fsp->fsp_name, &sbuf);
+                       } else {
+                               ret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf);
+                       }
                } else {
                        ret = SMB_VFS_FSTAT(fsp, &sbuf);
                }