In aio_fork, we have to close all fd's, we might hold a gpfs share mode
authorVolker Lendecke <vl@samba.org>
Mon, 18 May 2009 07:49:23 +0000 (09:49 +0200)
committerMichael Adam <obnox@samba.org>
Mon, 18 May 2009 09:56:19 +0000 (11:56 +0200)
Keeping such an fd open prohibits another open of that same file.

Signed-off-by: Michael Adam <obnox@samba.org>
source/modules/vfs_aio_fork.c

index 864fd4229d83e319732fbc798eca605199a4dac7..ca4ee609db414d5fd267de0ffe00153d0e7a119c 100644 (file)
@@ -426,6 +426,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)
@@ -465,6 +480,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);
        }