Re: move O_LARGEFILE forcing to filp_open()

From: William Lee Irwin III
Date: Sun Jul 04 2004 - 12:39:27 EST


On Sun, Jul 04, 2004 at 07:22:42PM +0200, Arnd Bergmann wrote:
>>> I'm not sure if you understood the intention of compat_sys_open
>>> right. Old 32 bit applications assume they are not using O_LARGEFILE,
>>> so you can't switch it on unconditionally in filp_open() for those
>>> cases. With your patch applied, sys_open and compat_sys_open would
>>> be identical again, which reverses the point of my patch.
>>> What is need is a way to turn on O_LARGEFILE on 64 bit archs for
>>> every use of filp_open _except_ from compat_sys_open.

On Sun, Jul 04, 2004 at 10:27:08AM -0700, William Lee Irwin III wrote:
>> Oh, that's easy, just shove the MAX_NON_LFS check into compat_sys_open().

On Sun, Jul 04, 2004 at 10:27:50AM -0700, William Lee Irwin III wrote:
> BTW, for some reason that's what I thought you were doing in your patch.

How does this look as an implementation of that suggestion, incremental
to your compat_sys_open() consolidation patch?


-- wli

Index: mm5-2.6.7/fs/compat.c
===================================================================
--- mm5-2.6.7.orig/fs/compat.c 2004-07-04 10:29:04.691152200 -0700
+++ mm5-2.6.7/fs/compat.c 2004-07-04 10:34:33.015239352 -0700
@@ -160,6 +160,12 @@
error = PTR_ERR(f);
if (IS_ERR(f))
goto out_error;
+ if (!(filp->f_flags & O_LARGEFILE) &&
+ i_size_read(file->f_dentry->d_inode) > MAX_NON_LFS) {
+ error = -EFBIG;
+ filp_close(filp, current->files);
+ goto out_error;
+ }
fd_install(fd, f);
}
out:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/