linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: WuBo <wu.bo@cn.fujitsu.com>
To: Josef Bacik <josef@redhat.com>
Cc: Phillip Susi <psusi@cfl.rr.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: don't panic if orphan item already exists
Date: Wed, 14 Dec 2011 10:07:39 +0800	[thread overview]
Message-ID: <4EE804EB.5070209@cn.fujitsu.com> (raw)
In-Reply-To: <20111213190942.GA3602@localhost.localdomain>

On 12/14/2011 03:09 AM, Josef Bacik wrote:
> On Tue, Dec 13, 2011 at 02:03:14PM -0500, Phillip Susi wrote:
>> On 12/13/2011 12:55 PM, Josef Bacik wrote:
>>> I've been hitting this BUG_ON() in btrfs_orphan_add when running xfstest 269 in
>>> a loop.  This is because we will add an orphan item, do the truncate, the
>>> truncate will fail for whatever reason (*cough*ENOSPC*cough*) and then we're
>>> left with an orphan item still in the fs.  Then we come back later to do another
>>> truncate and it blows up because we already have an orphan item.  This is ok so
>>> just fix the BUG_ON() to only BUG() if ret is not EEXIST.  Thanks,
>>
>> Wouldn't it be better to fix the underlying bug, and remove the
>> orphan item when the truncate fails?
>>
> 
> No because we still need the thing to be cleaned up.  If the truncate fails we
> need to leave the orphan item there so the next time the fs is mounted the inode
> is cleaned up, that's not a bug.  Thanks,
> 
> Josef

Hi, Josef

I'm digging this issue too, actually xfstests 083 also can trigger this BUG_ON
while run loops. and I agreed with Phillip's opinion that we'd better "fix the 
underlying bug". If the btrfs_truncate faild with ENOSPC, we should not even call 
btrfs_orphan_del to clean the memory orphan list so that the next orphan item
insert will be skipped.

But, there is still a trouble. The user will get the fail result while the orphan 
inode still left in the fs. It's strange. So in the end of the btrfs_truncate,
if the btrfs_update_inode is successed, I will delete the orphan inode anyway.

what do you think of this idea? I'll make a patch if you do not have any comment.

BTW, 083 will always make the btrfs_truncate fail with btrfs_truncate_inode_items
for ENOSPC when the disk is almost full.

thanks
wubo

> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2011-12-14  2:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-13 17:55 [PATCH] Btrfs: don't panic if orphan item already exists Josef Bacik
2011-12-13 19:03 ` Phillip Susi
2011-12-13 19:09   ` Josef Bacik
2011-12-14  2:07     ` WuBo [this message]
2011-12-14  9:46       ` Miao Xie
2011-12-14 14:58         ` Josef Bacik
2011-12-14 15:14           ` Phillip Susi
2011-12-14 15:27             ` Josef Bacik
2011-12-14 15:41               ` Phillip Susi
2011-12-14 15:46                 ` Josef Bacik
2011-12-14 19:59                   ` Phillip Susi
2011-12-14 15:34             ` Josef Bacik
2011-12-14 15:35               ` Josef Bacik
2011-12-14 16:45               ` Chris Mason
2011-12-14 16:47                 ` Josef Bacik
2011-12-15  1:42               ` Miao Xie
2011-12-15  1:56           ` WuBo

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=4EE804EB.5070209@cn.fujitsu.com \
    --to=wu.bo@cn.fujitsu.com \
    --cc=josef@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=psusi@cfl.rr.com \
    /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).