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 | 14 +++++----- 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, 358 insertions(+), 336 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-04-03 15:21:04.059667032 -0800 +++ 25-akpm/arch/ia64/ia32/sys_ia32.c 2004-04-03 15:21:04.109659432 -0800 @@ -2104,7 +2104,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-04-03 15:21:04.061666728 -0800 +++ 25-akpm/arch/ppc64/kernel/sys_ppc32.c 2004-04-03 15:21:04.111659128 -0800 @@ -2210,7 +2210,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-04-03 15:21:04.063666424 -0800 +++ 25-akpm/arch/x86_64/ia32/sys_ia32.c 2004-04-03 15:21:04.112658976 -0800 @@ -1750,7 +1750,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-04-03 15:21:04.066665968 -0800 +++ 25-akpm/include/asm-ppc64/fcntl.h 2004-04-03 15:21:04.113658824 -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-04-03 15:21:04.067665816 -0800 +++ 25-akpm/include/asm-x86_64/fcntl.h 2004-04-03 15:21:04.113658824 -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-04-03 15:21:04.068665664 -0800 +++ 25-akpm/include/asm-ppc/fcntl.h 2004-04-03 15:21:04.114658672 -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-04-03 15:21:04.070665360 -0800 +++ 25-akpm/include/asm-m68k/fcntl.h 2004-04-03 15:21:04.114658672 -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-04-03 15:21:04.071665208 -0800 +++ 25-akpm/include/asm-ia64/fcntl.h 2004-04-03 15:21:04.115658520 -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-04-03 15:21:04.073664904 -0800 +++ 25-akpm/include/asm-parisc/fcntl.h 2004-04-03 15:21:04.115658520 -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-04-03 15:21:04.074664752 -0800 +++ 25-akpm/include/asm-arm/fcntl.h 2004-04-03 15:21:04.116658368 -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-04-03 15:21:04.075664600 -0800 +++ 25-akpm/include/asm-mips/fcntl.h 2004-04-03 15:21:04.116658368 -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-04-03 15:21:04.077664296 -0800 +++ 25-akpm/include/asm-sparc/fcntl.h 2004-04-03 15:21:04.117658216 -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-04-03 15:21:04.078664144 -0800 +++ 25-akpm/include/asm-alpha/fcntl.h 2004-04-03 15:21:04.117658216 -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-04-03 15:21:04.079663992 -0800 +++ 25-akpm/include/asm-i386/fcntl.h 2004-04-03 15:21:04.118658064 -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-04-03 15:21:04.080663840 -0800 +++ 25-akpm/include/asm-s390/fcntl.h 2004-04-03 15:21:04.118658064 -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-04-03 15:21:04.082663536 -0800 +++ 25-akpm/include/asm-h8300/fcntl.h 2004-04-03 15:21:04.119657912 -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-04-03 15:21:04.083663384 -0800 +++ 25-akpm/include/asm-sparc64/fcntl.h 2004-04-03 15:21:04.119657912 -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-04-03 15:21:04.084663232 -0800 +++ 25-akpm/include/asm-arm26/fcntl.h 2004-04-03 15:21:04.120657760 -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-04-03 15:21:04.085663080 -0800 +++ 25-akpm/include/asm-cris/fcntl.h 2004-04-03 15:21:04.121657608 -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-04-03 15:21:04.086662928 -0800 +++ 25-akpm/include/asm-v850/fcntl.h 2004-04-03 15:21:04.121657608 -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-04-03 15:21:04.088662624 -0800 +++ 25-akpm/include/asm-sh/fcntl.h 2004-04-03 15:21:04.122657456 -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-04-03 15:21:04.089662472 -0800 +++ 25-akpm/fs/xfs/linux/xfs_file.c 2004-04-03 15:21:04.122657456 -0800 @@ -277,7 +277,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-04-03 15:21:04.090662320 -0800 +++ 25-akpm/fs/xfs/linux/xfs_ioctl.c 2004-04-03 15:21:04.123657304 -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-04-03 15:21:04.092662016 -0800 +++ 25-akpm/fs/nfsd/vfs.c 2004-04-03 15:21:04.124657152 -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-04-03 15:21:04.095661560 -0800 +++ 25-akpm/fs/udf/file.c 2004-04-03 15:21:04.125657000 -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-04-03 15:21:04.096661408 -0800 +++ 25-akpm/fs/ncpfs/file.c 2004-04-03 15:21:04.125657000 -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-04-03 15:21:04.097661256 -0800 +++ 25-akpm/fs/open.c 2004-04-03 15:21:04.126656848 -0800 @@ -281,7 +281,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; @@ -933,7 +933,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); @@ -1048,14 +1048,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) +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-04-03 15:21:04.098661104 -0800 +++ 25-akpm/fs/ext3/file.c 2004-04-03 15:21:04.127656696 -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-04-03 15:21:04.100660800 -0800 +++ 25-akpm/fs/exec.c 2004-04-03 15:21:04.128656544 -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-04-03 15:21:04.101660648 -0800 +++ 25-akpm/fs/block_dev.c 2004-04-03 15:21:04.128656544 -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-04-03 15:21:04.102660496 -0800 +++ 25-akpm/mm/filemap.c 2004-04-03 15:21:04.130656240 -0800 @@ -1705,7 +1705,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-04-03 15:21:04.104660192 -0800 +++ 25-akpm/fs/fcntl.c 2004-04-03 15:21:04.131656088 -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); _