open files with O_NONBLOCK when available. This is necessary to
authorAndrew Tridgell <tridge@samba.org>
Thu, 15 Jun 2000 14:15:48 +0000 (14:15 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 15 Jun 2000 14:15:48 +0000 (14:15 +0000)
prevent possible deadlocks with kernel leases and harmless when kernel
leases are not used.

basically we don't ever want smbd to block

source/smbd/open.c

index 5a0493e625fdc350d0f6a8328a01cf1622b51d4b..e9d2f01e10475f65b1e708458ef5f14f5edd50ab 100644 (file)
@@ -36,7 +36,12 @@ extern BOOL global_client_failed_oplock_break;
 static int fd_open(struct connection_struct *conn, char *fname, 
                   int flags, mode_t mode)
 {
-       int fd = conn->vfs_ops.open(dos_to_unix(fname,False),flags,mode);
+       int fd;
+#ifdef O_NONBLOCK
+       flags |= O_NONBLOCK;
+#endif
+
+       fd = conn->vfs_ops.open(dos_to_unix(fname,False),flags,mode);
 
        /* Fix for files ending in '.' */
        if((fd == -1) && (errno == ENOENT) &&