kernel-ark/fs
Peter Staubach a1a5b3d93c [PATCH] open returns ENFILE but creates file anyway
When open(O_CREAT) is called and the error, ENFILE, is returned, the file
may be created anyway.  This is counter intuitive, against the SUS V3
specification, and may cause applications to misbehave if they are not
coded correctly to handle this semantic.  The SUS V3 specification
explicitly states "No files shall be created or modified if the function
returns -1.".

The error, ENFILE, is used to indicate the system wide open file table is
full and no more file structs can be allocated.

This is due to an ordering problem.  The entry in the directory is created
before the file struct is allocated.  If the allocation for the file struct
fails, then the system call must return an error, but the directory entry
was already created and can not be safely removed.

The solution to this situation is relatively easy.  The file struct should
be allocated before the directory entry is created.  If the allocation
fails, then the error can be returned directly.  If the creation of the
directory entry fails, then the file struct can be easily freed.

Signed-off-by: Peter Staubach <staubach@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-13 08:22:28 -07:00
..
9p [PATCH] v9fs: fix handling of malformed 9P messages 2005-09-09 13:57:58 -07:00
adfs
affs
afs
autofs
autofs4
befs
bfs
cifs [PATCH] fs: fix-up schedule_timeout() usage 2005-09-10 10:06:36 -07:00
coda
cramfs [PATCH] fs/cramfs/uncompress.c should #include <linux/cramfs_fs.h> 2005-09-10 10:06:35 -07:00
debugfs
devfs
devpts
efs
exportfs
ext2
ext3
fat
freevxfs
fuse [PATCH] FUSE: don't allow restarting of system calls 2005-09-09 14:03:48 -07:00
hfs
hfsplus
hostfs
hpfs
hppfs
hugetlbfs
isofs
jbd [PATCH] fs: fix-up schedule_timeout() usage 2005-09-10 10:06:36 -07:00
jffs [PATCH] janitor: jffs/intrep: list_for_each_entry 2005-09-10 10:06:32 -07:00
jffs2
jfs Merge branch 'for-linus' from kernel.org:/.../shaggy/jfs-2.6 manually 2005-09-11 10:14:54 -07:00
lockd [PATCH] fs: fix-up schedule_timeout() usage 2005-09-10 10:06:36 -07:00
minix
msdos
ncpfs
nfs [PATCH] fs: fix-up schedule_timeout() usage 2005-09-10 10:06:36 -07:00
nfs_common
nfsd
nls
ntfs NTFS: Mask out __GFP_HIGHMEM when doing kmalloc() in __ntfs_malloc() as it 2005-09-12 15:43:03 +01:00
openpromfs
partitions
proc
qnx4
ramfs
reiserfs [PATCH] fs: fix-up schedule_timeout() usage 2005-09-10 10:06:36 -07:00
relayfs
romfs
smbfs [PATCH] fs: fix-up schedule_timeout() usage 2005-09-10 10:06:36 -07:00
sysfs
sysv
udf
ufs
vfat
xfs [PATCH] fs: fix-up schedule_timeout() usage 2005-09-10 10:06:36 -07:00
aio.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf_fdpic.c
binfmt_elf.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio.c
block_dev.c
buffer.c [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
char_dev.c
compat_ioctl.c [PATCH] Lost sockfd_put() in routing_ioctl() 2005-09-09 14:24:05 -07:00
compat.c Preempt-safe RCU file usage 2005-09-09 15:42:34 -07:00
dcache.c [PATCH] janitor: fs/dcache.c: list_for_each* 2005-09-10 10:06:32 -07:00
dcookies.c
direct-io.c
dnotify.c
dquot.c
eventpoll.c
exec.c
fcntl.c
fifo.c
file_table.c
file.c
filesystems.c
fs-writeback.c
inode.c
inotify.c
ioctl.c
ioprio.c
Kconfig [PATCH] FUSE - MAINTAINERS, Kconfig and Makefile changes 2005-09-09 14:03:44 -07:00
Kconfig.binfmt
libfs.c
locks.c
Makefile [PATCH] FUSE - MAINTAINERS, Kconfig and Makefile changes 2005-09-09 14:03:44 -07:00
mbcache.c
mpage.c
namei.c
namespace.c [PATCH] janitor: fs/namespace.c: list_for_each_entry 2005-09-10 10:06:32 -07:00
nfsctl.c
open.c [PATCH] open returns ENFILE but creates file anyway 2005-09-13 08:22:28 -07:00
pipe.c [PATCH] sched: TASK_NONINTERACTIVE 2005-09-10 10:06:22 -07:00
posix_acl.c
quota_v1.c
quota_v2.c
quota.c
read_write.c
readdir.c
select.c
seq_file.c
stat.c
super.c
xattr_acl.c
xattr.c