public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: hujianyang <hujianyang@huawei.com>
To: 王丁 <walklook@gmail.com>
Cc: linux-mtd <linux-mtd@lists.infradead.org>,
	Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: ubifs issue about xattr node when replay journal
Date: Mon, 14 Jul 2014 17:40:06 +0800	[thread overview]
Message-ID: <53C3A576.70305@huawei.com> (raw)
In-Reply-To: <CAEGnBBSC=k5kkQYkLn37Q8KLLC+n43KiNr9ZZ-8NPJaGkGf0Qg@mail.gmail.com>

Hi Wang,

I have researched into the code but I still have some problems:

1) What's your kernel version?
2) Is the mechanism of removing XENT_NODE as same as removing
   DATA_NODE?
3) Is the mechanism of removing XENT_NODE same on ubifs_removexattr()
   and ubifs_jnl_delete_inode().

On 2014/7/12 21:36, 王丁 wrote:
> Hi all,
> 
> Now we use xattr based on ubifs, and find some issues about it.
> Situation like that:
> 1.poweron ->2.create a file -> 3.set xattr -> 4.delete the file -> 5.power cut
> After several cycles with above steps, we can not boot up the device
> with the error below.
> 
> 
> Analysis:
> when delete a file, ubifs will remove the xent node from tnc, if gc
> happend, it will remove the xent node data from the GCed LEB because
> of it has been removed form tnc ,
> then if a power cut happen, the journal replay may also try to remove
> the related xattr node, the error occurred because of it has been
> GCed.
> 
> 
> Now I run commit when ubifs_jnl_delete_inode called, and it's OK.
> Does anyone have a better way for the issue?
>  

Can you draw a figure of this race? According to your description,
I think the race is removing XENT_NODE twice. Is that true?

> 
> diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
> index f755a24..eba555e 100755
> --- a/fs/ubifs/journal.c
> +++ b/fs/ubifs/journal.c
> @@ -900,6 +900,9 @@ int ubifs_jnl_delete_inode(struct ubifs_info *c,
> const struct inode *inode)
>         else
>                 ubifs_delete_orphan(c, inode->i_ino);
>         up_read(&c->commit_sem);
> +
> +       ubifs_run_commit(c);
> +
>         return err;
> }

Run commit after each deletion is not a good choice and I think this
fix is just decreasing the rate of error happening.

Let's find out a better solution.

Thanks,

Hu

  reply	other threads:[~2014-07-14  9:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-12 13:36 ubifs issue about xattr node when replay journal 王丁
2014-07-14  9:40 ` hujianyang [this message]
2014-07-16 11:08 ` Artem Bityutskiy
2014-07-16 12:05   ` Richard Weinberger
     [not found] <7590973538024349719@unknownmsgid>
2014-07-16 11:05 ` Artem Bityutskiy

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=53C3A576.70305@huawei.com \
    --to=hujianyang@huawei.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=walklook@gmail.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