Bug 645824

Summary: ext4: Don't error out the fs if the user tries to make a file too big
Product: Red Hat Enterprise Linux 6 Reporter: Debbie Johnson <dejohnso>
Component: kernelAssignee: Eric Sandeen <esandeen>
Status: CLOSED ERRATA QA Contact: Boris Ranto <branto>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: branto, eguan, esandeen, kzhang, moshiro, myamazak, ndoane
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kernel-2.6.32-84.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 715501 (view as bug list) Environment:
Last Closed: 2011-05-23 20:27:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 715501    
Attachments:
Description Flags
script that duplicates/shows issue none

Description Debbie Johnson 2010-10-22 15:02:09 UTC
Description of problem:
ext4: Don't error out the fs if the user tries to make a file too big

Version-Release number of selected component (if applicable):
V6.0

How reproducible:

do_truncate() can call ext4_setattr() (via notify_change()).
And, ext4_setattr() can return with -EFBIG if the argument(length) of
do_truncate() is more than sbi->s_bitmap_maxbytes. At that time,
it also calls ext4_std_error() with -EFBIG.

Besides, a panic happens when ext4_setattr() returns with -EFBIG
after we mount an ext4 filesystem with errors=panic.

The following steps(Step to Reproduce) can make this problem easily.

This problem is in:
5482 if (attr->ia_valid & ATTR_SIZE) {
5483 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
5484 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
5485
5486 if (attr->ia_size > sbi->s_bitmap_maxbytes) {
5487 error = -EFBIG;
5488 goto err_out;
5489 }
5490 }
5491 }

5543 err_out:
5544 ext4_std_error(inode->i_sb, error);
5545 if (!error)
5546 error = rc;
5547 return error;
(because ext4_setattr() calls ext4_std_error() when error == -EFBIG)

This fix is already included in 2.6.36-rc1.
(http://marc.info/?l=git-commits-head&m=128121841924078&w=2)
Please apply it.

Additional info:

Comment 1 Ondrej Vasik 2010-10-22 16:25:56 UTC
filesystem package (basic system directory structure) has nothing to do with ext4 filesystem. Reassigning to kernel.

Comment 3 RHEL Program Management 2010-11-01 15:59:47 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux maintenance release. Product Management has 
requested further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed 
products. This request is not yet committed for inclusion in an Update release.

Comment 5 Zhang Kexin 2010-11-23 02:14:58 UTC
copied from http://marc.info/?l=git-commits-head&m=128121841924078&w=2 , this might explain how to reproduce the bug.

    If the user attempts to make a non-extent-mapped file to be too large,
    return EFBIG, but don't call ext4_std_err() which will end up marking
    the file system as containing an error.

Comment 6 Aristeu Rozanski 2010-12-13 15:09:06 UTC
Patch(es) available on kernel-2.6.32-89.el6

Comment 8 Debbie Johnson 2011-01-17 17:10:59 UTC
Created attachment 473895 [details]
script that duplicates/shows issue

Comment 12 errata-xmlrpc 2011-05-23 20:27:02 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0542.html