summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_aio_fork.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-18 09:49:23 +0200
committerVolker Lendecke <vl@samba.org>2009-05-18 10:42:22 +0200
commit67a2e629919bdc5a783e64636890fec2a7dfa9f8 (patch)
tree07e0c948f99c396170da08148914af9e863b577d /source3/modules/vfs_aio_fork.c
parent22085c59cb31e90bd7fb555f54836f057bf4018b (diff)
downloadsamba-67a2e629919bdc5a783e64636890fec2a7dfa9f8.tar.gz
samba-67a2e629919bdc5a783e64636890fec2a7dfa9f8.tar.bz2
samba-67a2e629919bdc5a783e64636890fec2a7dfa9f8.zip
In aio_fork, we have to close all fd's, we might hold a gpfs share mode
Keeping such an fd open prohibits another open of that same file.
Diffstat (limited to 'source3/modules/vfs_aio_fork.c')
-rw-r--r--source3/modules/vfs_aio_fork.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index e706495a56..cb4ad0cf82 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -423,6 +423,21 @@ static int aio_child_destructor(struct aio_child *child)
return 0;
}
+/*
+ * We have to close all fd's in open files, we might incorrectly hold a system
+ * level share mode on a file.
+ */
+
+static struct files_struct *close_fsp_fd(struct files_struct *fsp,
+ void *private_data)
+{
+ if ((fsp->fh != NULL) && (fsp->fh->fd != -1)) {
+ close(fsp->fh->fd);
+ fsp->fh->fd = -1;
+ }
+ return NULL;
+}
+
static NTSTATUS create_aio_child(struct aio_child_list *children,
size_t map_size,
struct aio_child **presult)
@@ -461,6 +476,7 @@ static NTSTATUS create_aio_child(struct aio_child_list *children,
if (result->pid == 0) {
close(fdpair[0]);
result->sockfd = fdpair[1];
+ file_walk_table(close_fsp_fd, NULL);
aio_child_loop(result->sockfd, result->map);
}