diff -urN ref/fs/namei.c new/fs/namei.c --- ref/fs/namei.c Sat Jun 9 00:04:49 2001 +++ new/fs/namei.c Tue Jun 12 15:37:51 2001 @@ -418,9 +418,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) @@ -489,6 +493,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)) @@ -552,6 +559,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)) @@ -884,6 +894,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 new/include/asm-alpha/fcntl.h --- ref/include/asm-alpha/fcntl.h Thu Nov 16 15:37:42 2000 +++ new/include/asm-alpha/fcntl.h Tue Jun 12 15:37:51 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 new/include/asm-i386/fcntl.h --- ref/include/asm-i386/fcntl.h Tue Jun 12 15:35:04 2001 +++ new/include/asm-i386/fcntl.h Tue Jun 12 15:37:51 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 new/include/asm-ia64/fcntl.h --- ref/include/asm-ia64/fcntl.h Thu Nov 16 15:37:42 2000 +++ new/include/asm-ia64/fcntl.h Tue Jun 12 15:37:51 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 new/include/asm-sparc/fcntl.h --- ref/include/asm-sparc/fcntl.h Tue Jun 12 15:35:04 2001 +++ new/include/asm-sparc/fcntl.h Tue Jun 12 15:39:42 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 ref/include/asm-sparc64/fcntl.h new/include/asm-sparc64/fcntl.h --- ref/include/asm-sparc64/fcntl.h Tue Jun 12 15:35:04 2001 +++ new/include/asm-sparc64/fcntl.h Tue Jun 12 15:39:59 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 ref/include/linux/errno.h new/include/linux/errno.h --- ref/include/linux/errno.h Fri Feb 23 21:20:14 2001 +++ new/include/linux/errno.h Tue Jun 12 15:37:51 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 new/include/linux/fs.h --- ref/include/linux/fs.h Tue Jun 12 15:35:04 2001 +++ new/include/linux/fs.h Tue Jun 12 15:37:51 2001 @@ -1202,6 +1202,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 */