From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Kazuya Mio <k-mio@sx.jp.nec.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: double free of blocks occurred during online defrag
Date: Thu, 26 Feb 2009 15:19:14 +0530 [thread overview]
Message-ID: <20090226094914.GA13220@skywalker> (raw)
In-Reply-To: <20090225105944.GB25714@skywalker>
On Wed, Feb 25, 2009 at 04:29:44PM +0530, Aneesh Kumar K.V wrote:
> On Wed, Feb 25, 2009 at 04:14:46PM +0530, Aneesh Kumar K.V wrote:
> > On Wed, Feb 25, 2009 at 03:39:52PM +0900, Kazuya Mio wrote:
> > > Hi Aneesh,
> > >
> > > When I remove the file that is running online defrag, the following error occurs
> > > after closing the file descriptor:
> > >
> > > Jan 22 17:06:52 G3-OPC-SVR2 kernel: EXT4-fs error (device hda8):
> > > ext4_mb_release_inode_pa: free 2048, pa_free 1562
> > > Jan 22 17:06:52 G3-OPC-SVR2 kernel: EXT4-fs error (device hda8): mb_free_blocks:
> > > double-free of inode 0's block 802817(bit 0 in group 98)
> > > Jan 22 17:06:52 G3-OPC-SVR2 kernel: EXT4-fs error (device hda8): mb_free_blocks:
> > > double-free of inode 0's block 802818(bit 1 in group 98)
> > > Jan 22 17:06:52 G3-OPC-SVR2 kernel: EXT4-fs error (device hda8): mb_free_blocks:
> > > double-free of inode 0's block 802819(bit 2 in group 98)
> > > Jan 22 17:06:52 G3-OPC-SVR2 kernel: EXT4-fs error (device hda8): mb_free_blocks:
> > > double-free of inode 0's block 802820(bit 3 in group 98)
> > > Jan 22 17:06:52 G3-OPC-SVR2 kernel: EXT4-fs error (device hda8): mb_free_blocks:
> > > double-free of inode 0's block 802821(bit 4 in group 98)
> > > Jan 22 17:06:52 G3-OPC-SVR2 kernel: EXT4-fs error (device hda8): mb_free_blocks:
> > > double-free of inode 0's block 802822(bit 5 in group 98)
> > >
> > > So, online defrag calls ext4_discard_preallocations() at the end of
> > > ext4_defrag() to avoid double-free error.
> > > However, above error hasn't occurred since applying your patch posted on Nov
> > > 6th, 2008 because this error is caused by the same reason of your report.
> > > http://marc.info/?l=linux-ext4&m=122599787406193&w=4
> > >
> > > What is the status of this patch?
> >
> > We dropped the patch because I found that the double free in my case was
> > not exactly due the explanation given in the patch above.
> >
> > I asked to drop the patch in
> >
> > http://article.gmane.org/gmane.comp.file-systems.ext4/10199
> >
> > I also found that the patch is not completely correct. The meta-data
> > blocks which are added to the free_list are not allocated from any
> > prealloc space.
> >
> > So what you are seeing may be a different problem which the patch is
> > hiding from happening. I guess you will have to look more closely at why the
> > double-free is happening in your case.
>
> I found one case of double-free , but not sure how the above patch is
> helping to avoid that. Any how here is the case:
>
>
> a) We have inode prealloc space. We allocated some blocks out of that
> for data
> b) We later free the data blocks. That means we mark the bits in bitmap
> and buddy as free.
> c) Now we want to discard the prealloc space. We look at the bitmap and
> try mark the blocks which are free in bitmap as free in buddy. But since
> the blocks are already marked free in buddy we hit the double free case.
>
> To fix this we will have to scan all the inode prealloc space of the group
> and if he blocks belong to the inode prealloc space we should not mark
> them free in buddy.
>
Ok I guess this won't happen. Because only way to free data blocks is via
truncate and truncate cause the prealloc space discard. In other words. Before
we free the blocks we are throwing away the prealloc space.
-aneesh
next prev parent reply other threads:[~2009-02-26 9:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 6:39 double free of blocks occurred during online defrag Kazuya Mio
2009-02-25 10:44 ` Aneesh Kumar K.V
2009-02-25 10:59 ` Aneesh Kumar K.V
2009-02-26 9:49 ` Aneesh Kumar K.V [this message]
2009-02-26 22:38 ` Mike Snitzer
2009-03-02 8:30 ` Kazuya Mio
2009-03-06 8:18 ` Kazuya Mio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090226094914.GA13220@skywalker \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=k-mio@sx.jp.nec.com \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).