From: Boxi Liu Subject: Re: there is a BUG in disk full case in inlinedata feature. Date: Tue, 22 Oct 2013 00:22:34 +0800 Message-ID: References: <521D4CB2.2060805@tao.ma> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=047d7b6789b414d07404e942b1d3 Cc: "linux-ext4@vger.kernel.org" , Robin Dong , Theodore Tso , "lewis.liulei" To: Tao Ma Return-path: Received: from mail-qe0-f51.google.com ([209.85.128.51]:38478 "EHLO mail-qe0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750809Ab3JUQWf (ORCPT ); Mon, 21 Oct 2013 12:22:35 -0400 Received: by mail-qe0-f51.google.com with SMTP id q19so3915852qeb.38 for ; Mon, 21 Oct 2013 09:22:34 -0700 (PDT) In-Reply-To: <521D4CB2.2060805@tao.ma> Sender: linux-ext4-owner@vger.kernel.org List-ID: --047d7b6789b414d07404e942b1d3 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable hi, I make the format patch about the inline_data patch . Is there anything incomplete=A3=BF Thanks boxi 2013/8/28 Tao Ma : > Hi Boxi, > Thanks for the detailed explanation and the bug fix. It looks goo= d to me. > So would you mind send out a formal patch? > > Thanks, > Tao > On 08/28/2013 01:09 AM, Boxi Liu wrote: >> there is a BUG in EXT4 inlinedata feature when the disk is full(0B). >> tast case: >> step1: use the dd to make the disk full,has 0B remained. >> step2: touch a inlinedata file >> echo -n "123456" >> test.txt >> step3: make the inlinedata file test.txt convert to extent block. >> echo -n >> "12345678901234567890123456789012345678901234567890123456789012345678901= 234567890123456789012345678901234567890123456789012345678901234567890123456= 7890">>test.txt >> the step3 will write failed.and print the BUG Backtrace: >> page:c1963bc0 count:-1 mapcount:0 mapping: (null) index:0x0 >> page flags:0x40000000() >> Backtrace: >> [] (dump_backtrace + 0x0/0x12c) from [] >> (dump_stack +0x18/0x1c) >> r6:c0043a84 r5:c0bb688 r4:c1963bc0 r3:00000000 >> [] (dump_stack + 0x0/0x1c) from [] (bad_page + 0xbc/= 0x13c) >> [] (bad_page + 0x0/0x13c) from [] >> (get_page_from_freelist + 0x4cc/0xb6c) >> r7:c1963bd8 r6:c0043194 r5:c1963bc0 r4:00000001 >> [] (get_page_from_freelist +0x0/0xb6c) from [] >> (__alloc_pages_nodemask + 0x144/0x820) >> [] (__alloc_pages_nodemask +0x0/0x820) from [] >> (handle_pte_fault + 0x574/0x758) >> [] (handle_pte_fault + 0x0/0x758) from [] >> (handle_mm_fault + 0xcc/0x110) >> [] (handel_mm_fault + 0x0/0x110) from [] >> (do_page_fault + 0x16c/0x1f4) >> [] (do_page_fault + 0x0/0x1f4) from [] >> (do_DataAbort + 0x40/0xac) >> [] (do_DataAbort + 0x0/0xac) from [] >> (ret_from_exception + 0x0/0x10) >> >> And when the system reboot , the step2 data "123456" will alse lost. >> You can cat the test.txt,but there is no data in the file. >> the reason is when the inlinedata convert to extent in the limit case, >> the inlinedata read to the page,then destory the inlinedata,next step >> is to __block_write_begin,but it can't get block,return -ENOSPC. so >> the data lost. >> >> there is a patch may fix the bug: >> in inline.c ext4_convert_inline_data_to_extent >> >> needed_blocks =3D ext4_writepage_trans_blocks(inode); >> >> + if(EXT4_C2B(sbi,percpu_counter_read_positive(&sbi->s_freecluste= rs_counter)) >> < needed_blocks) >> + return -ENOSPC; >> + >> ret =3D ext4_get_inode_loc(inode, &iloc); >> if (ret) >> return ret; >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> > --047d7b6789b414d07404e942b1d3 Content-Type: application/octet-stream; name="0001-ext4-fix-an-ext4-inline_data-feature-file-bug.patch" Content-Disposition: attachment; filename="0001-ext4-fix-an-ext4-inline_data-feature-file-bug.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hn1ww2nx0 RnJvbSBmNDE5NGE4NWYwZDRkMjIxZDJhYTQ5NTU1ZDkwMDM2ODk1NjA1ZGU1IE1vbiBTZXAgMT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