On 64-bit machines the kernel currently forces O_LARGEFILE in open() even if the user didn't ask for it. So a subsequent fcntl(F_GETFL) returns flags which the user didn't expect to be set. So fix the old kludge by creating a new, kernel-only O_KERNEL_LARGEFILE instead. Force that to be on when it is the kernel which requests large files (as opposed to userspace, which sets O_LARGEFILE) and test for both flags in the appropriate places. --- 25-akpm/arch/ia64/ia32/sys_ia32.c | 3 +- 25-akpm/arch/ppc64/kernel/sys_ppc32.c | 2 - 25-akpm/arch/x86_64/ia32/sys_ia32.c | 2 - 25-akpm/fs/block_dev.c | 2 - 25-akpm/fs/exec.c | 3 +- 25-akpm/fs/ext3/file.c | 6 ++-- 25-akpm/fs/fcntl.c | 2 - 25-akpm/fs/ncpfs/file.c | 3 +- 25-akpm/fs/nfsd/vfs.c | 4 +-- 25-akpm/fs/open.c | 12 ++++----- 25-akpm/fs/udf/file.c | 5 ++- 25-akpm/fs/xfs/linux/xfs_file.c | 3 +- 25-akpm/fs/xfs/linux/xfs_ioctl.c | 2 - 25-akpm/include/asm-alpha/fcntl.h | 37 ++++++++++++++------------- 25-akpm/include/asm-arm/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-arm26/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-cris/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-h8300/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-i386/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-ia64/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-m68k/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-mips/fcntl.h | 33 ++++++++++++------------ 25-akpm/include/asm-parisc/fcntl.h | 45 +++++++++++++++++----------------- 25-akpm/include/asm-ppc/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-ppc64/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-s390/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-sh/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-sparc/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-sparc64/fcntl.h | 36 +++++++++++++-------------- 25-akpm/include/asm-v850/fcntl.h | 35 +++++++++++++------------- 25-akpm/include/asm-x86_64/fcntl.h | 35 +++++++++++++------------- 25-akpm/mm/filemap.c | 2 - arch/sparc64/kernel/sys_sparc32.c | 0 arch/sparc64/solaris/fs.c | 0 drivers/usb/gadget/file_storage.c | 0 fs/cifs/file.c | 0 36 files changed, 357 insertions(+), 335 deletions(-) diff -puN arch/sparc64/kernel/sys_sparc32.c~O_LARGEFILE-fix arch/sparc64/kernel/sys_sparc32.c diff -puN arch/sparc64/solaris/fs.c~O_LARGEFILE-fix arch/sparc64/solaris/fs.c diff -puN arch/ia64/ia32/sys_ia32.c~O_LARGEFILE-fix arch/ia64/ia32/sys_ia32.c --- 25/arch/ia64/ia32/sys_ia32.c~O_LARGEFILE-fix 2004-03-23 22:59:55.619601064 -0800 +++ 25-akpm/arch/ia64/ia32/sys_ia32.c 2004-03-23 22:59:55.674592704 -0800 @@ -2106,7 +2106,8 @@ sys32_brk (unsigned int brk) } /* - * Exactly like fs/open.c:sys_open(), except that it doesn't set the O_LARGEFILE flag. + * Exactly like fs/open.c:sys_open(), except that it doesn't set the + * O_KERNEL_LARGEFILE flag. */ asmlinkage long sys32_open (const char * filename, int flags, int mode) diff -puN arch/ppc64/kernel/sys_ppc32.c~O_LARGEFILE-fix arch/ppc64/kernel/sys_ppc32.c --- 25/arch/ppc64/kernel/sys_ppc32.c~O_LARGEFILE-fix 2004-03-23 22:59:55.621600760 -0800 +++ 25-akpm/arch/ppc64/kernel/sys_ppc32.c 2004-03-23 22:59:55.676592400 -0800 @@ -2400,7 +2400,7 @@ off_t ppc32_lseek(unsigned int fd, u32 o /* * This is just a version for 32-bit applications which does - * not force O_LARGEFILE on. + * not force O_KERNEL_LARGEFILE on. */ long sys32_open(const char * filename, int flags, int mode) { diff -puN arch/x86_64/ia32/sys_ia32.c~O_LARGEFILE-fix arch/x86_64/ia32/sys_ia32.c --- 25/arch/x86_64/ia32/sys_ia32.c~O_LARGEFILE-fix 2004-03-23 22:59:55.622600608 -0800 +++ 25-akpm/arch/x86_64/ia32/sys_ia32.c 2004-03-23 22:59:55.678592096 -0800 @@ -1783,7 +1783,7 @@ asmlinkage long sys32_open(const char * char * tmp; int fd, error; - /* don't force O_LARGEFILE */ + /* don't force O_KERNEL_LARGEFILE */ tmp = getname(filename); fd = PTR_ERR(tmp); if (!IS_ERR(tmp)) { diff -puN drivers/usb/gadget/file_storage.c~O_LARGEFILE-fix drivers/usb/gadget/file_storage.c diff -puN include/asm-ppc64/fcntl.h~O_LARGEFILE-fix include/asm-ppc64/fcntl.h --- 25/include/asm-ppc64/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.634598784 -0800 +++ 25-akpm/include/asm-ppc64/fcntl.h 2004-03-23 22:59:55.678592096 -0800 @@ -10,23 +10,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECTORY 040000 /* must be a directory */ -#define O_NOFOLLOW 0100000 /* don't follow links */ -#define O_LARGEFILE 0200000 -#define O_DIRECT 0400000 /* direct disk access hint */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECTORY 040000 /* must be a directory */ +#define O_NOFOLLOW 0100000 /* don't follow links */ +#define O_LARGEFILE 0200000 +#define O_DIRECT 0400000 /* direct disk access hint */ +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-x86_64/fcntl.h~O_LARGEFILE-fix include/asm-x86_64/fcntl.h --- 25/include/asm-x86_64/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.635598632 -0800 +++ 25-akpm/include/asm-x86_64/fcntl.h 2004-03-23 22:59:55.679591944 -0800 @@ -3,23 +3,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECT 040000 /* direct disk access hint */ -#define O_LARGEFILE 0100000 -#define O_DIRECTORY 0200000 /* must be a directory */ -#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECT 040000 /* direct disk access hint */ +#define O_LARGEFILE 0100000 +#define O_DIRECTORY 0200000 /* must be a directory */ +#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-ppc/fcntl.h~O_LARGEFILE-fix include/asm-ppc/fcntl.h --- 25/include/asm-ppc/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.636598480 -0800 +++ 25-akpm/include/asm-ppc/fcntl.h 2004-03-23 22:59:55.679591944 -0800 @@ -3,23 +3,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECTORY 040000 /* must be a directory */ -#define O_NOFOLLOW 0100000 /* don't follow links */ -#define O_LARGEFILE 0200000 -#define O_DIRECT 0400000 /* direct disk access hint */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECTORY 040000 /* must be a directory */ +#define O_NOFOLLOW 0100000 /* don't follow links */ +#define O_LARGEFILE 0200000 +#define O_DIRECT 0400000 /* direct disk access hint */ +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-m68k/fcntl.h~O_LARGEFILE-fix include/asm-m68k/fcntl.h --- 25/include/asm-m68k/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.637598328 -0800 +++ 25-akpm/include/asm-m68k/fcntl.h 2004-03-23 22:59:55.680591792 -0800 @@ -3,23 +3,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECTORY 040000 /* must be a directory */ -#define O_NOFOLLOW 0100000 /* don't follow links */ -#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ -#define O_LARGEFILE 0400000 +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECTORY 040000 /* must be a directory */ +#define O_NOFOLLOW 0100000 /* don't follow links */ +#define O_DIRECT 0200000 /* direct disk access hint */ +#define O_LARGEFILE 0400000 +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-ia64/fcntl.h~O_LARGEFILE-fix include/asm-ia64/fcntl.h --- 25/include/asm-ia64/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.638598176 -0800 +++ 25-akpm/include/asm-ia64/fcntl.h 2004-03-23 22:59:55.680591792 -0800 @@ -11,23 +11,24 @@ * open/fcntl - O_SYNC is only implemented on blocks devices and on * files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECT 040000 /* direct disk access hint - currently ignored */ -#define O_LARGEFILE 0100000 -#define O_DIRECTORY 0200000 /* must be a directory */ -#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECT 040000 /* direct disk access hint */ +#define O_LARGEFILE 0100000 +#define O_DIRECTORY 0200000 /* must be a directory */ +#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-parisc/fcntl.h~O_LARGEFILE-fix include/asm-parisc/fcntl.h --- 25/include/asm-parisc/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.640597872 -0800 +++ 25-akpm/include/asm-parisc/fcntl.h 2004-03-23 22:59:55.681591640 -0800 @@ -3,28 +3,29 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 00000003 -#define O_RDONLY 00000000 -#define O_WRONLY 00000001 -#define O_RDWR 00000002 -#define O_APPEND 00000010 -#define O_BLKSEEK 00000100 /* HPUX only */ -#define O_CREAT 00000400 /* not fcntl */ -#define O_TRUNC 00001000 /* not fcntl */ -#define O_EXCL 00002000 /* not fcntl */ -#define O_LARGEFILE 00004000 -#define O_SYNC 00100000 -#define O_NONBLOCK 00200004 /* HPUX has separate NDELAY & NONBLOCK */ -#define O_NDELAY O_NONBLOCK -#define O_NOCTTY 00400000 /* not fcntl */ -#define O_DSYNC 01000000 /* HPUX only */ -#define O_RSYNC 02000000 /* HPUX only */ - -#define FASYNC 00020000 /* fcntl, for BSD compatibility */ -#define O_DIRECT 00040000 /* direct disk access hint - currently ignored */ -#define O_DIRECTORY 00010000 /* must be a directory */ -#define O_NOFOLLOW 00000200 /* don't follow links */ -#define O_INVISIBLE 04000000 /* invisible I/O, for DMAPI/XDSM */ +#define O_ACCMODE 00000003 +#define O_RDONLY 00000000 +#define O_WRONLY 00000001 +#define O_RDWR 00000002 +#define O_APPEND 00000010 +#define O_BLKSEEK 00000100 /* HPUX only */ +#define O_CREAT 00000400 /* not fcntl */ +#define O_TRUNC 00001000 /* not fcntl */ +#define O_EXCL 00002000 /* not fcntl */ +#define O_LARGEFILE 00004000 +#define O_SYNC 00100000 +#define O_NONBLOCK 00200004 /* HPUX has separate NDELAY & NONBLOCK */ +#define O_NDELAY O_NONBLOCK +#define O_NOCTTY 00400000 /* not fcntl */ +#define O_DSYNC 01000000 /* HPUX only */ +#define O_RSYNC 02000000 /* HPUX only */ + +#define FASYNC 00020000 /* fcntl, for BSD compatibility */ +#define O_DIRECT 00040000 /* direct disk access hint */ +#define O_DIRECTORY 00010000 /* must be a directory */ +#define O_NOFOLLOW 00000200 /* don't follow links */ +#define O_INVISIBLE 04000000 /* invisible I/O, for DMAPI/XDSM */ +#define O_KERNEL_LARGEFILE 010000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get f_flags */ diff -puN include/asm-arm/fcntl.h~O_LARGEFILE-fix include/asm-arm/fcntl.h --- 25/include/asm-arm/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.641597720 -0800 +++ 25-akpm/include/asm-arm/fcntl.h 2004-03-23 22:59:55.681591640 -0800 @@ -3,23 +3,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECTORY 040000 /* must be a directory */ -#define O_NOFOLLOW 0100000 /* don't follow links */ -#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ -#define O_LARGEFILE 0400000 +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECTORY 040000 /* must be a directory */ +#define O_NOFOLLOW 0100000 /* don't follow links */ +#define O_DIRECT 0200000 /* direct disk access hint */ +#define O_LARGEFILE 0400000 +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-mips/fcntl.h~O_LARGEFILE-fix include/asm-mips/fcntl.h --- 25/include/asm-mips/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.642597568 -0800 +++ 25-akpm/include/asm-mips/fcntl.h 2004-03-23 22:59:55.682591488 -0800 @@ -10,22 +10,23 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0x0003 -#define O_RDONLY 0x0000 -#define O_WRONLY 0x0001 -#define O_RDWR 0x0002 -#define O_APPEND 0x0008 -#define O_SYNC 0x0010 -#define O_NONBLOCK 0x0080 -#define O_CREAT 0x0100 /* not fcntl */ -#define O_TRUNC 0x0200 /* not fcntl */ -#define O_EXCL 0x0400 /* not fcntl */ -#define O_NOCTTY 0x0800 /* not fcntl */ -#define FASYNC 0x1000 /* fcntl, for BSD compatibility */ -#define O_LARGEFILE 0x2000 /* allow large file opens */ -#define O_DIRECT 0x8000 /* direct disk access hint */ -#define O_DIRECTORY 0x10000 /* must be a directory */ -#define O_NOFOLLOW 0x20000 /* don't follow links */ +#define O_ACCMODE 0x0003 +#define O_RDONLY 0x0000 +#define O_WRONLY 0x0001 +#define O_RDWR 0x0002 +#define O_APPEND 0x0008 +#define O_SYNC 0x0010 +#define O_NONBLOCK 0x0080 +#define O_CREAT 0x0100 /* not fcntl */ +#define O_TRUNC 0x0200 /* not fcntl */ +#define O_EXCL 0x0400 /* not fcntl */ +#define O_NOCTTY 0x0800 /* not fcntl */ +#define FASYNC 0x1000 /* fcntl, for BSD compatibility */ +#define O_LARGEFILE 0x2000 /* allow large file opens */ +#define O_DIRECT 0x8000 /* direct disk access hint */ +#define O_DIRECTORY 0x10000 /* must be a directory */ +#define O_NOFOLLOW 0x20000 /* don't follow links */ +#define O_KERNEL_LARGEFILE 0x40000 /* kernel-internal large file hint */ #define O_NDELAY O_NONBLOCK diff -puN include/asm-sparc/fcntl.h~O_LARGEFILE-fix include/asm-sparc/fcntl.h --- 25/include/asm-sparc/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.643597416 -0800 +++ 25-akpm/include/asm-sparc/fcntl.h 2004-03-23 22:59:55.682591488 -0800 @@ -4,23 +4,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_RDONLY 0x0000 -#define O_WRONLY 0x0001 -#define O_RDWR 0x0002 -#define O_ACCMODE 0x0003 -#define O_APPEND 0x0008 -#define FASYNC 0x0040 /* fcntl, for BSD compatibility */ -#define O_CREAT 0x0200 /* not fcntl */ -#define O_TRUNC 0x0400 /* not fcntl */ -#define O_EXCL 0x0800 /* not fcntl */ -#define O_SYNC 0x2000 -#define O_NONBLOCK 0x4000 -#define O_NDELAY (0x0004 | O_NONBLOCK) -#define O_NOCTTY 0x8000 /* not fcntl */ -#define O_DIRECTORY 0x10000 /* must be a directory */ -#define O_NOFOLLOW 0x20000 /* don't follow links */ -#define O_LARGEFILE 0x40000 -#define O_DIRECT 0x100000 /* direct disk access hint */ +#define O_RDONLY 0x0000 +#define O_WRONLY 0x0001 +#define O_RDWR 0x0002 +#define O_ACCMODE 0x0003 +#define O_APPEND 0x0008 +#define FASYNC 0x0040 /* fcntl, for BSD compatibility */ +#define O_CREAT 0x0200 /* not fcntl */ +#define O_TRUNC 0x0400 /* not fcntl */ +#define O_EXCL 0x0800 /* not fcntl */ +#define O_SYNC 0x2000 +#define O_NONBLOCK 0x4000 +#define O_NDELAY (0x0004 | O_NONBLOCK) +#define O_NOCTTY 0x8000 /* not fcntl */ +#define O_DIRECTORY 0x10000 /* must be a directory */ +#define O_NOFOLLOW 0x20000 /* don't follow links */ +#define O_LARGEFILE 0x40000 +#define O_DIRECT 0x100000 /* direct disk access hint */ +#define O_KERNEL_LARGEFILE 0x200000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-alpha/fcntl.h~O_LARGEFILE-fix include/asm-alpha/fcntl.h --- 25/include/asm-alpha/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.645597112 -0800 +++ 25-akpm/include/asm-alpha/fcntl.h 2004-03-23 22:59:55.683591336 -0800 @@ -3,24 +3,25 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 01000 /* not fcntl */ -#define O_TRUNC 02000 /* not fcntl */ -#define O_EXCL 04000 /* not fcntl */ -#define O_NOCTTY 010000 /* not fcntl */ - -#define O_NONBLOCK 00004 -#define O_APPEND 00010 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 040000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#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_DIRECT 02000000 /* direct disk access - should check with OSF/1 */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 01000 /* not fcntl */ +#define O_TRUNC 02000 /* not fcntl */ +#define O_EXCL 04000 /* not fcntl */ +#define O_NOCTTY 010000 /* not fcntl */ + +#define O_NONBLOCK 00004 +#define O_APPEND 00010 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 040000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECTORY 0100000 /* must be a directory */ +#define O_NOFOLLOW 0200000 /* don't follow links */ +#define O_LARGEFILE 0400000 +#define O_DIRECT 02000000 /* direct access - check with OSF/1 */ +#define O_KERNEL_LARGEFILE 04000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-i386/fcntl.h~O_LARGEFILE-fix include/asm-i386/fcntl.h --- 25/include/asm-i386/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.646596960 -0800 +++ 25-akpm/include/asm-i386/fcntl.h 2004-03-23 22:59:55.683591336 -0800 @@ -3,23 +3,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECT 040000 /* direct disk access hint */ -#define O_LARGEFILE 0100000 -#define O_DIRECTORY 0200000 /* must be a directory */ -#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECT 040000 /* direct disk access hint */ +#define O_LARGEFILE 0100000 +#define O_DIRECTORY 0200000 /* must be a directory */ +#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-s390/fcntl.h~O_LARGEFILE-fix include/asm-s390/fcntl.h --- 25/include/asm-s390/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.648596656 -0800 +++ 25-akpm/include/asm-s390/fcntl.h 2004-03-23 22:59:55.684591184 -0800 @@ -10,23 +10,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECT 040000 /* direct disk access hint */ -#define O_LARGEFILE 0100000 -#define O_DIRECTORY 0200000 /* must be a directory */ -#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECT 040000 /* direct disk access hint */ +#define O_LARGEFILE 0100000 +#define O_DIRECTORY 0200000 /* must be a directory */ +#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-h8300/fcntl.h~O_LARGEFILE-fix include/asm-h8300/fcntl.h --- 25/include/asm-h8300/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.649596504 -0800 +++ 25-akpm/include/asm-h8300/fcntl.h 2004-03-23 22:59:55.685591032 -0800 @@ -3,23 +3,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECTORY 040000 /* must be a directory */ -#define O_NOFOLLOW 0100000 /* don't follow links */ -#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ -#define O_LARGEFILE 0400000 +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECTORY 040000 /* must be a directory */ +#define O_NOFOLLOW 0100000 /* don't follow links */ +#define O_DIRECT 0200000 /* direct disk access hint */ +#define O_LARGEFILE 0400000 +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-sparc64/fcntl.h~O_LARGEFILE-fix include/asm-sparc64/fcntl.h --- 25/include/asm-sparc64/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.650596352 -0800 +++ 25-akpm/include/asm-sparc64/fcntl.h 2004-03-23 22:59:55.685591032 -0800 @@ -4,24 +4,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_RDONLY 0x0000 -#define O_WRONLY 0x0001 -#define O_RDWR 0x0002 -#define O_ACCMODE 0x0003 -#define O_NDELAY 0x0004 -#define O_APPEND 0x0008 -#define FASYNC 0x0040 /* fcntl, for BSD compatibility */ -#define O_CREAT 0x0200 /* not fcntl */ -#define O_TRUNC 0x0400 /* not fcntl */ -#define O_EXCL 0x0800 /* not fcntl */ -#define O_SYNC 0x2000 -#define O_NONBLOCK 0x4000 -#define O_NOCTTY 0x8000 /* not fcntl */ -#define O_DIRECTORY 0x10000 /* must be a directory */ -#define O_NOFOLLOW 0x20000 /* don't follow links */ -#define O_LARGEFILE 0x40000 -#define O_DIRECT 0x100000 /* direct disk access hint */ - +#define O_RDONLY 0x0000 +#define O_WRONLY 0x0001 +#define O_RDWR 0x0002 +#define O_ACCMODE 0x0003 +#define O_NDELAY 0x0004 +#define O_APPEND 0x0008 +#define FASYNC 0x0040 /* fcntl, for BSD compatibility */ +#define O_CREAT 0x0200 /* not fcntl */ +#define O_TRUNC 0x0400 /* not fcntl */ +#define O_EXCL 0x0800 /* not fcntl */ +#define O_SYNC 0x2000 +#define O_NONBLOCK 0x4000 +#define O_NOCTTY 0x8000 /* not fcntl */ +#define O_DIRECTORY 0x10000 /* must be a directory */ +#define O_NOFOLLOW 0x20000 /* don't follow links */ +#define O_LARGEFILE 0x40000 +#define O_DIRECT 0x100000 /* direct disk access hint */ +#define O_KERNEL_LARGEFILE 0x200000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-arm26/fcntl.h~O_LARGEFILE-fix include/asm-arm26/fcntl.h --- 25/include/asm-arm26/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.651596200 -0800 +++ 25-akpm/include/asm-arm26/fcntl.h 2004-03-23 22:59:55.686590880 -0800 @@ -3,23 +3,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECTORY 040000 /* must be a directory */ -#define O_NOFOLLOW 0100000 /* don't follow links */ -#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ -#define O_LARGEFILE 0400000 +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECTORY 040000 /* must be a directory */ +#define O_NOFOLLOW 0100000 /* don't follow links */ +#define O_DIRECT 0200000 /* direct disk access hint */ +#define O_LARGEFILE 0400000 +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-cris/fcntl.h~O_LARGEFILE-fix include/asm-cris/fcntl.h --- 25/include/asm-cris/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.652596048 -0800 +++ 25-akpm/include/asm-cris/fcntl.h 2004-03-23 22:59:55.686590880 -0800 @@ -5,23 +5,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECT 040000 /* direct disk access hint - currently ignored */ -#define O_LARGEFILE 0100000 -#define O_DIRECTORY 0200000 /* must be a directory */ -#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECT 040000 /* direct disk access hint */ +#define O_LARGEFILE 0100000 +#define O_DIRECTORY 0200000 /* must be a directory */ +#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get f_flags */ diff -puN include/asm-v850/fcntl.h~O_LARGEFILE-fix include/asm-v850/fcntl.h --- 25/include/asm-v850/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.654595744 -0800 +++ 25-akpm/include/asm-v850/fcntl.h 2004-03-23 22:59:55.687590728 -0800 @@ -3,23 +3,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECTORY 040000 /* must be a directory */ -#define O_NOFOLLOW 0100000 /* don't follow links */ -#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ -#define O_LARGEFILE 0400000 +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECTORY 040000 /* must be a directory */ +#define O_NOFOLLOW 0100000 /* don't follow links */ +#define O_DIRECT 0200000 /* direct disk access hint */ +#define O_LARGEFILE 0400000 +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN include/asm-sh/fcntl.h~O_LARGEFILE-fix include/asm-sh/fcntl.h --- 25/include/asm-sh/fcntl.h~O_LARGEFILE-fix 2004-03-23 22:59:55.655595592 -0800 +++ 25-akpm/include/asm-sh/fcntl.h 2004-03-23 22:59:55.687590728 -0800 @@ -3,23 +3,24 @@ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECT 040000 /* direct disk access hint - currently ignored */ -#define O_LARGEFILE 0100000 -#define O_DIRECTORY 0200000 /* must be a directory */ -#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_DIRECT 040000 /* direct disk access hint */ +#define O_LARGEFILE 0100000 +#define O_DIRECTORY 0200000 /* must be a directory */ +#define O_NOFOLLOW 0400000 /* don't follow links */ +#define O_KERNEL_LARGEFILE 01000000 /* kernel-internal large file hint */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ diff -puN fs/xfs/linux/xfs_file.c~O_LARGEFILE-fix fs/xfs/linux/xfs_file.c --- 25/fs/xfs/linux/xfs_file.c~O_LARGEFILE-fix 2004-03-23 22:59:55.656595440 -0800 +++ 25-akpm/fs/xfs/linux/xfs_file.c 2004-03-23 22:59:55.688590576 -0800 @@ -276,7 +276,8 @@ linvfs_open( vnode_t *vp = LINVFS_GET_VP(inode); int error; - if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS) + if (!(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)) && + i_size_read(inode) > MAX_NON_LFS) return -EFBIG; ASSERT(vp); diff -puN fs/xfs/linux/xfs_ioctl.c~O_LARGEFILE-fix fs/xfs/linux/xfs_ioctl.c --- 25/fs/xfs/linux/xfs_ioctl.c~O_LARGEFILE-fix 2004-03-23 22:59:55.657595288 -0800 +++ 25-akpm/fs/xfs/linux/xfs_ioctl.c 2004-03-23 22:59:55.689590424 -0800 @@ -326,7 +326,7 @@ xfs_open_by_handle( } #if BITS_PER_LONG != 32 - hreq.oflags |= O_LARGEFILE; + hreq.oflags |= O_KERNEL_LARGEFILE; #endif /* Put open permission in namei format. */ permflag = hreq.oflags; diff -puN fs/nfsd/vfs.c~O_LARGEFILE-fix fs/nfsd/vfs.c --- 25/fs/nfsd/vfs.c~O_LARGEFILE-fix 2004-03-23 22:59:55.659594984 -0800 +++ 25-akpm/fs/nfsd/vfs.c 2004-03-23 22:59:55.690590272 -0800 @@ -455,7 +455,7 @@ nfsd_open(struct svc_rqst *rqstp, struct { struct dentry *dentry; struct inode *inode; - int flags = O_RDONLY|O_LARGEFILE, err; + int flags = O_RDONLY|O_KERNEL_LARGEFILE, err; /* * If we get here, then the client has already done an "open", @@ -491,7 +491,7 @@ nfsd_open(struct svc_rqst *rqstp, struct if (err) goto out_nfserr; - flags = O_WRONLY|O_LARGEFILE; + flags = O_WRONLY|O_KERNEL_LARGEFILE; DQUOT_INIT(inode); } diff -puN fs/cifs/file.c~O_LARGEFILE-fix fs/cifs/file.c diff -puN fs/udf/file.c~O_LARGEFILE-fix fs/udf/file.c --- 25/fs/udf/file.c~O_LARGEFILE-fix 2004-03-23 22:59:55.661594680 -0800 +++ 25-akpm/fs/udf/file.c 2004-03-23 22:59:55.690590272 -0800 @@ -262,14 +262,15 @@ static int udf_release_file(struct inode * * DESCRIPTION * Use this to disallow opening RW large files on 32 bit systems. - * On 64 bit systems we force on O_LARGEFILE in sys_open. + * On 64 bit systems we force on O_KERNEL_LARGEFILE in sys_open. * * HISTORY * */ static int udf_open_file(struct inode * inode, struct file * filp) { - if ((inode->i_size & 0xFFFFFFFF80000000ULL) && !(filp->f_flags & O_LARGEFILE)) + if ((inode->i_size & 0xFFFFFFFF80000000ULL) && + !(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE))) return -EFBIG; return 0; } diff -puN fs/ncpfs/file.c~O_LARGEFILE-fix fs/ncpfs/file.c --- 25/fs/ncpfs/file.c~O_LARGEFILE-fix 2004-03-23 22:59:55.663594376 -0800 +++ 25-akpm/fs/ncpfs/file.c 2004-03-23 22:59:55.691590120 -0800 @@ -213,7 +213,8 @@ ncp_file_write(struct file *file, const pos = inode->i_size; } - if (pos + count > MAX_NON_LFS && !(file->f_flags&O_LARGEFILE)) { + if (pos + count > MAX_NON_LFS && + !(file->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE))) { if (pos >= MAX_NON_LFS) { send_sig(SIGXFSZ, current, 0); return -EFBIG; diff -puN fs/open.c~O_LARGEFILE-fix fs/open.c --- 25/fs/open.c~O_LARGEFILE-fix 2004-03-23 22:59:55.664594224 -0800 +++ 25-akpm/fs/open.c 2004-03-23 22:59:55.692589968 -0800 @@ -279,7 +279,7 @@ static inline long do_sys_ftruncate(unsi goto out; /* explicitly opened as large or we are on 64-bit box */ - if (file->f_flags & O_LARGEFILE) + if (file->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)) small = 0; dentry = file->f_dentry; @@ -931,7 +931,7 @@ asmlinkage long sys_open(const char __us int fd, error; #if BITS_PER_LONG != 32 - flags |= O_LARGEFILE; + flags |= O_KERNEL_LARGEFILE; #endif tmp = getname(filename); fd = PTR_ERR(tmp); @@ -1046,14 +1046,14 @@ asmlinkage long sys_vhangup(void) /* * Called when an inode is about to be open. * We use this to disallow opening large files on 32bit systems if - * the caller didn't specify O_LARGEFILE. On 64bit systems we force - * on this flag in sys_open. + * the caller didn't specify O_LARGEFILE or O_KERNEL_LARGEFILE. On 64bit + * systems we force on O_KERNEL_LARGEFILE in sys_open. */ int generic_file_open(struct inode * inode, struct file * filp) { - if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS) + if (!(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)) && + i_size_read(inode) > MAX_NON_LFS) return -EFBIG; return 0; } - EXPORT_SYMBOL(generic_file_open); diff -puN fs/ext3/file.c~O_LARGEFILE-fix fs/ext3/file.c --- 25/fs/ext3/file.c~O_LARGEFILE-fix 2004-03-23 22:59:55.665594072 -0800 +++ 25-akpm/fs/ext3/file.c 2004-03-23 22:59:55.692589968 -0800 @@ -44,12 +44,12 @@ static int ext3_release_file (struct ino /* * Called when an inode is about to be opened. * We use this to disallow opening RW large files on 32bit systems if - * the caller didn't specify O_LARGEFILE. On 64bit systems we force - * on this flag in sys_open. + * the caller didn't specify O_LARGEFILE or O_KERNEL_LARGEFILE. On 64bit + * systems we force on O_KERNEL_LARGEFILE in sys_open. */ static int ext3_open_file (struct inode *inode, struct file *filp) { - if (!(filp->f_flags & O_LARGEFILE) && + if (!(filp->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)) && inode->i_size > 0x7FFFFFFFLL) return -EFBIG; return 0; diff -puN fs/exec.c~O_LARGEFILE-fix fs/exec.c --- 25/fs/exec.c~O_LARGEFILE-fix 2004-03-23 22:59:55.666593920 -0800 +++ 25-akpm/fs/exec.c 2004-03-23 22:59:55.693589816 -0800 @@ -1394,7 +1394,8 @@ int do_coredump(long signr, int exit_cod goto fail_unlock; format_corename(corename, core_pattern, signr); - file = filp_open(corename, O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE, 0600); + file = filp_open(corename, + O_CREAT|O_RDWR|O_NOFOLLOW|O_KERNEL_LARGEFILE, 0600); if (IS_ERR(file)) goto fail_unlock; inode = file->f_dentry->d_inode; diff -puN fs/block_dev.c~O_LARGEFILE-fix fs/block_dev.c --- 25/fs/block_dev.c~O_LARGEFILE-fix 2004-03-23 22:59:55.668593616 -0800 +++ 25-akpm/fs/block_dev.c 2004-03-23 22:59:55.694589664 -0800 @@ -679,7 +679,7 @@ int blkdev_open(struct inode * inode, st * binary needs it. We might want to drop this workaround * during an unstable branch. */ - filp->f_flags |= O_LARGEFILE; + filp->f_flags |= O_KERNEL_LARGEFILE; bdev = bd_acquire(inode); diff -puN mm/filemap.c~O_LARGEFILE-fix mm/filemap.c --- 25/mm/filemap.c~O_LARGEFILE-fix 2004-03-23 22:59:55.669593464 -0800 +++ 25-akpm/mm/filemap.c 2004-03-23 22:59:55.695589512 -0800 @@ -1670,7 +1670,7 @@ inline int generic_write_checks(struct f * LFS rule */ if (unlikely(*pos + *count > MAX_NON_LFS && - !(file->f_flags & O_LARGEFILE))) { + !(file->f_flags & (O_LARGEFILE|O_KERNEL_LARGEFILE)))) { if (*pos >= MAX_NON_LFS) { send_sig(SIGXFSZ, current, 0); return -EFBIG; diff -puN fs/fcntl.c~O_LARGEFILE-fix fs/fcntl.c --- 25/fs/fcntl.c~O_LARGEFILE-fix 2004-03-23 22:59:55.671593160 -0800 +++ 25-akpm/fs/fcntl.c 2004-03-23 22:59:55.696589360 -0800 @@ -300,7 +300,7 @@ long generic_file_fcntl(int fd, unsigned set_close_on_exec(fd, arg & FD_CLOEXEC); break; case F_GETFL: - err = filp->f_flags; + err = filp->f_flags & ~O_KERNEL_LARGEFILE; break; case F_SETFL: err = setfl(fd, filp, arg); _