diff -urN ref/fs/namei.c atomic-lookup/fs/namei.c --- ref/fs/namei.c Sat Apr 28 05:24:43 2001 +++ atomic-lookup/fs/namei.c Sun Apr 29 17:24:28 2001 @@ -423,9 +423,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) @@ -494,6 +498,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)) @@ -557,6 +564,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)) @@ -891,6 +901,8 @@ if (f & O_DIRECTORY) retval |= LOOKUP_DIRECTORY; + if (f & O_ATOMICLOOKUP) + retval |= LOOKUP_ATOMIC; return retval; } diff -urN ref/include/asm-alpha/fcntl.h atomic-lookup/include/asm-alpha/fcntl.h --- ref/include/asm-alpha/fcntl.h Thu Nov 16 15:37:42 2000 +++ atomic-lookup/include/asm-alpha/fcntl.h Sun Apr 29 17:24:28 2001 @@ -21,6 +21,8 @@ #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 F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -urN ref/include/asm-i386/fcntl.h atomic-lookup/include/asm-i386/fcntl.h --- ref/include/asm-i386/fcntl.h Sat Apr 28 18:37:45 2001 +++ atomic-lookup/include/asm-i386/fcntl.h Sun Apr 29 17:24:28 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 ref/include/asm-ia64/fcntl.h atomic-lookup/include/asm-ia64/fcntl.h --- ref/include/asm-ia64/fcntl.h Thu Nov 16 15:37:42 2000 +++ atomic-lookup/include/asm-ia64/fcntl.h Sun Apr 29 17:24:28 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 ref/include/asm-sparc/fcntl.h atomic-lookup/include/asm-sparc/fcntl.h --- ref/include/asm-sparc/fcntl.h Thu Nov 16 15:37:42 2000 +++ atomic-lookup/include/asm-sparc/fcntl.h Sun Apr 29 17:24:28 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 F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -urN ref/include/asm-sparc64/fcntl.h atomic-lookup/include/asm-sparc64/fcntl.h --- ref/include/asm-sparc64/fcntl.h Thu Nov 16 15:37:42 2000 +++ atomic-lookup/include/asm-sparc64/fcntl.h Sun Apr 29 17:24:28 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 F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -urN ref/include/linux/errno.h atomic-lookup/include/linux/errno.h --- ref/include/linux/errno.h Fri Feb 23 21:20:14 2001 +++ atomic-lookup/include/linux/errno.h Sun Apr 29 17:24:28 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 ref/include/linux/fs.h atomic-lookup/include/linux/fs.h --- ref/include/linux/fs.h Sat Apr 28 20:29:48 2001 +++ atomic-lookup/include/linux/fs.h Sun Apr 29 17:24:28 2001 @@ -1176,6 +1176,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 */