summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_aio_fork.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-18 09:36:16 +0200
committerVolker Lendecke <vl@samba.org>2009-05-18 10:42:22 +0200
commit8b9c5f04831216aa3d3b89fd2a81be12ac8592dd (patch)
treed5c96e7e84d7b09a35ff759ab5ce11f6a656a89e /source3/modules/vfs_aio_fork.c
parentf140bf2e6578e45b8603d4a6c5feef9a3b735804 (diff)
downloadsamba-8b9c5f04831216aa3d3b89fd2a81be12ac8592dd.tar.gz
samba-8b9c5f04831216aa3d3b89fd2a81be12ac8592dd.tar.bz2
samba-8b9c5f04831216aa3d3b89fd2a81be12ac8592dd.zip
Fix a race condition in vfs_aio_fork with gpfs share modes
Diffstat (limited to 'source3/modules/vfs_aio_fork.c')
-rw-r--r--source3/modules/vfs_aio_fork.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index 8568ec3916..e706495a56 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -357,6 +357,14 @@ static void aio_child_loop(int sockfd, struct mmap_area *map)
ret_struct.ret_errno = errno;
}
+ /*
+ * Close the fd before telling our parent we're done. The
+ * parent might close and re-open the file very quickly, and
+ * with system-level share modes (GPFS) we would get an
+ * unjustified SHARING_VIOLATION.
+ */
+ close(fd);
+
ret = write_data(sockfd, (char *)&ret_struct,
sizeof(ret_struct));
if (ret != sizeof(ret_struct)) {
@@ -364,8 +372,6 @@ static void aio_child_loop(int sockfd, struct mmap_area *map)
strerror(errno)));
exit(2);
}
-
- close(fd);
}
}