Skip to content

Commit

Permalink
fs: correct SuS compliance for open of large file without options
Browse files Browse the repository at this point in the history
The early LFS work that Linux uses favours EFBIG in various places. SuSv3
specifically uses EOVERFLOW for this as noted by Michael (Bug 7253)

[EOVERFLOW]
    The named file is a regular file and the size of the file cannot be
represented correctly in an object of type off_t. We should therefore
transition to the proper error return code

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Theodore Tso <tytso@mit.edu>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Oct 17, 2007
1 parent 28e3fed commit a9c62a1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fs/gfs2/ops_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ static int gfs2_open(struct inode *inode, struct file *file)

if (!(file->f_flags & O_LARGEFILE) &&
ip->i_di.di_size > MAX_NON_LFS) {
error = -EFBIG;
error = -EOVERFLOW;
goto fail_gunlock;
}

Expand Down
2 changes: 1 addition & 1 deletion fs/ntfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static int ntfs_file_open(struct inode *vi, struct file *filp)
{
if (sizeof(unsigned long) < 8) {
if (i_size_read(vi) > MAX_LFS_FILESIZE)
return -EFBIG;
return -EOVERFLOW;
}
return generic_file_open(vi, filp);
}
Expand Down
2 changes: 1 addition & 1 deletion fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ asmlinkage long sys_vhangup(void)
int generic_file_open(struct inode * inode, struct file * filp)
{
if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
return -EFBIG;
return -EOVERFLOW;
return 0;
}

Expand Down

0 comments on commit a9c62a1

Please sign in to comment.