Linux 2.2.02.2.0
commitf6cce5dae53e5176e35ae26b2711755c52dc01ea
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:18:06 +0000 (23 15:18 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:18:06 +0000 (23 15:18 -0500)
treeaf047cb6a217e455c0c124b9f33c9b52a8de2326
parent182f4220b795cb01d6ffd61552882f92f49b6051
Linux 2.2.0

> Compile this code
>
> ---- cut here ----
> #include <fcntlbits.h>
> void main( int argc, char *argv[] ) {
>         open( argv[ 1 ], O_WRONLY|O_CREAT|O_TRUNC, 0666 );
> }
> ---- and here  ----
>
> and run it like this
>
>     strace ./a.out >(cat - )
>
> with 2.0.36 & 2.2.0-pre[67] you get:
>
>     open("/dev/fd/63", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
>
> with 2.2.0-pre[89] you get:
>
>     open("/dev/fd/63", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No
> such file or directory)

Ok, this seems to be due to pre9 removing some rather bogus code that
happened to hide another problem in open_namei().
I haven't actually tested this, but it looks really obvious, so does this
patch fix it for you? (This should also fix a potential performance
bogosity - there's absolutely no reason why we should get the directory
lock when we don't need to for a normal open of an existing file).

                Linus
55 files changed:
Makefile
arch/alpha/Makefile
arch/alpha/kernel/entry.S
arch/alpha/kernel/sys_rx164.c
arch/alpha/kernel/sys_sio.c
arch/alpha/lib/semaphore.S
arch/i386/kernel/setup.c
arch/i386/kernel/smp.c
arch/i386/mm/init.c
drivers/block/ide-pci.c
drivers/char/bttv.c
drivers/char/bttv.h
drivers/char/mem.c
drivers/char/msp3400.c
drivers/char/pc_keyb.c
drivers/net/ibmtr.c
drivers/net/irda/irport.c
drivers/net/irda/uircc.c
drivers/net/ne2k-pci.c
drivers/scsi/megaraid.h
drivers/sound/ad1816.c
drivers/sound/sb_card.c
drivers/sound/sb_common.c
drivers/sound/sb_ess.c
drivers/sound/sb_mixer.c
fs/coda/cnode.c
fs/coda/coda_linux.c
fs/coda/dir.c
fs/dcache.c
fs/inode.c
fs/namei.c
fs/nfsd/nfscache.c
fs/proc/array.c
fs/vfat/namei.c
include/asm-alpha/core_polaris.h
include/asm-alpha/jensen.h
include/asm-alpha/unistd.h
include/asm-i386/cobalt.h
include/asm-i386/i82489.h
include/asm-i386/lithium.h
include/asm-i386/smp.h
include/linux/coda.h
include/linux/coda_linux.h
include/linux/videodev.h
include/net/irda/irda.h
mm/filemap.c
mm/page_alloc.c
mm/vmscan.c
net/decnet/README
net/ipv4/fib_semantics.c
net/ipv4/ip_masq_mfw.c
net/ipv4/tcp_input.c
net/irda/irlpt/irlpt_common.c
net/irda/irlpt/irlpt_srvr_fsm.c
net/irda/irsysctl.c