diff -urN atomiclookup-ref/fs/namei.c atomiclookup/fs/namei.c --- atomiclookup-ref/fs/namei.c Wed Jun 13 15:52:34 2001 +++ atomiclookup/fs/namei.c Wed Jun 20 05:08:37 2001 @@ -412,9 +412,13 @@ { struct dentry *dentry; struct inode *inode; - int err; + int err, atomic; unsigned int lookup_flags = nd->flags; + atomic = 0; + if (lookup_flags & LOOKUP_ATOMIC) + atomic = 1; + while (*name=='/') name++; if (!*name) @@ -483,6 +487,9 @@ /* This does the actual lookups.. */ dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE); if (!dentry) { + err = -EWOULDBLOCKIO; + if (atomic) + break; dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE); err = PTR_ERR(dentry); if (IS_ERR(dentry)) @@ -546,6 +553,9 @@ } dentry = cached_lookup(nd->dentry, &this, 0); if (!dentry) { + err = -EWOULDBLOCKIO; + if (atomic) + break; dentry = real_lookup(nd->dentry, &this, 0); err = PTR_ERR(dentry); if (IS_ERR(dentry)) @@ -878,6 +888,8 @@ if (f & O_DIRECTORY) retval |= LOOKUP_DIRECTORY; + if (f & O_ATOMICLOOKUP) + retval |= LOOKUP_ATOMIC; return retval; } diff -urN atomiclookup-ref/include/asm-alpha/fcntl.h atomiclookup/include/asm-alpha/fcntl.h --- atomiclookup-ref/include/asm-alpha/fcntl.h Wed Jun 20 05:08:24 2001 +++ atomiclookup/include/asm-alpha/fcntl.h Wed Jun 20 05:08:37 2001 @@ -20,6 +20,7 @@ #define O_DIRECTORY 0100000 /* must be a directory */ #define O_NOFOLLOW 0200000 /* don't follow links */ #define O_LARGEFILE 0400000 /* will be set by the kernel on every open */ +#define O_ATOMICLOOKUP 01000000 /* do atomic file lookup */ #define O_DIRECT 02000000 /* direct disk access - should check with OSF/1 */ #define F_DUPFD 0 /* dup */ diff -urN atomiclookup-ref/include/asm-i386/fcntl.h atomiclookup/include/asm-i386/fcntl.h --- atomiclookup-ref/include/asm-i386/fcntl.h Wed Jun 20 05:08:24 2001 +++ atomiclookup/include/asm-i386/fcntl.h Wed Jun 20 05:08:37 2001 @@ -20,6 +20,7 @@ #define O_LARGEFILE 0100000 #define O_DIRECTORY 0200000 /* must be a directory */ #define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_ATOMICLOOKUP 01000000 /* do atomic file lookup */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -urN atomiclookup-ref/include/asm-ia64/fcntl.h atomiclookup/include/asm-ia64/fcntl.h --- atomiclookup-ref/include/asm-ia64/fcntl.h Thu Nov 16 15:37:42 2000 +++ atomiclookup/include/asm-ia64/fcntl.h Wed Jun 20 05:08:37 2001 @@ -28,6 +28,7 @@ #define O_LARGEFILE 0100000 #define O_DIRECTORY 0200000 /* must be a directory */ #define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_ATOMICLOOKUP 01000000 /* do atomic file lookup */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -urN atomiclookup-ref/include/asm-ppc/fcntl.h atomiclookup/include/asm-ppc/fcntl.h --- atomiclookup-ref/include/asm-ppc/fcntl.h Sat May 26 04:03:48 2001 +++ atomiclookup/include/asm-ppc/fcntl.h Wed Jun 20 05:08:40 2001 @@ -23,6 +23,7 @@ #define O_NOFOLLOW 0100000 /* don't follow links */ #define O_LARGEFILE 0200000 #define O_DIRECT 0400000 /* direct disk access hint - currently ignored */ +#define O_ATOMICLOOKUP 01000000 /* do atomic file lookup */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -urN atomiclookup-ref/include/asm-sparc/fcntl.h atomiclookup/include/asm-sparc/fcntl.h --- atomiclookup-ref/include/asm-sparc/fcntl.h Wed Jun 20 05:08:24 2001 +++ atomiclookup/include/asm-sparc/fcntl.h Wed Jun 20 05:08:37 2001 @@ -20,6 +20,7 @@ #define O_DIRECTORY 0x10000 /* must be a directory */ #define O_NOFOLLOW 0x20000 /* don't follow links */ #define O_LARGEFILE 0x40000 +#define O_ATOMICLOOKUP 0x80000 /* do atomic file lookup */ #define O_DIRECT 0x100000 /* direct disk access hint */ #define F_DUPFD 0 /* dup */ diff -urN atomiclookup-ref/include/asm-sparc64/fcntl.h atomiclookup/include/asm-sparc64/fcntl.h --- atomiclookup-ref/include/asm-sparc64/fcntl.h Wed Jun 20 05:08:24 2001 +++ atomiclookup/include/asm-sparc64/fcntl.h Wed Jun 20 05:08:37 2001 @@ -20,6 +20,7 @@ #define O_DIRECTORY 0x10000 /* must be a directory */ #define O_NOFOLLOW 0x20000 /* don't follow links */ #define O_LARGEFILE 0x40000 +#define O_ATOMICLOOKUP 0x80000 /* do atomic file lookup */ #define O_DIRECT 0x100000 /* direct disk access hint */ diff -urN atomiclookup-ref/include/linux/errno.h atomiclookup/include/linux/errno.h --- atomiclookup-ref/include/linux/errno.h Fri Feb 23 21:20:14 2001 +++ atomiclookup/include/linux/errno.h Wed Jun 20 05:08:37 2001 @@ -21,6 +21,9 @@ #define EBADTYPE 527 /* Type not supported by server */ #define EJUKEBOX 528 /* Request initiated, but will not complete before timeout */ +/* Defined for TUX async IO */ +#define EWOULDBLOCKIO 530 /* Would block due to block-IO */ + #endif #endif diff -urN atomiclookup-ref/include/linux/fs.h atomiclookup/include/linux/fs.h --- atomiclookup-ref/include/linux/fs.h Wed Jun 20 05:08:24 2001 +++ atomiclookup/include/linux/fs.h Wed Jun 20 05:08:37 2001 @@ -1227,6 +1227,7 @@ #define LOOKUP_POSITIVE (8) #define LOOKUP_PARENT (16) #define LOOKUP_NOALT (32) +#define LOOKUP_ATOMIC (64) /* * Type of the last component on LOOKUP_PARENT */