From: "ye janboe" <janboe.ye@gmail.com>
To: "Dave Kleikamp" <shaggy@linux.vnet.ibm.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: JFFS2 deadlock with alloc_sem
Date: Sat, 28 Jul 2007 00:35:29 +0800 [thread overview]
Message-ID: <af3ea28a0707270935v3a8191acl5f2dc5780c56a3d9@mail.gmail.com> (raw)
In-Reply-To: <1185543729.13873.10.camel@kleikamp.austin.ibm.com>
David
Thanks for you comments.
I still can not understand why there is comment in code say the dead
lock can not happen.
Could you give me some hints?
2007/7/27, Dave Kleikamp <shaggy@linux.vnet.ibm.com>:
> On Fri, 2007-07-27 at 11:38 +0800, ye janboe wrote:
> > Does this make fsync system call failed to cause a risk of loss data?
>
> Could be. It looks like I wasn't careful about considering all the
> callers of jffs2_garbage_collect_pass(). I assume the problem is when
> it is called from jffs2_flush_wbuf_gc().
>
> > I posted my fix base on your patch, please review it.
> >
> > Thanks
> >
> > --- gc.c@@/main/fl71_main/a22116_jffs2_sync_debug/0 2007-07-24
> > 17:02:26.746154000 +0800
> > +++ gc.c@@/main/fl71_main/a22116_jffs2_sync_debug/2 2007-07-24
> > 17:39:35.000000000 +0800
> > @@ -1299,7 +1299,10 @@ static int jffs2_garbage_collect_dnode(s
> > if (IS_ERR(pg_ptr)) {
> > if ( PTR_ERR(pg_ptr) == -EBUSY ) {
> > printk(KERN_WARNING "jffs2_gc_fetch_page() rc
> > -EBUSY. Deadlock avoided.\n" );
> > - return 0;
> > + if (current->flags & PF_SYNCWRITE)
> > + return -EBUSY;
> > + else
> > + return 0;
> > } else {
> > printk(KERN_WARNING "jffs2_gc_fetch_page() rc
> > %ld\n", PTR_ERR(pg_ptr));
> > return PTR_ERR(pg_ptr);
>
> That is probably okay, but I think it is getting more complicated than
> it needs to be.
>
> What if we let jffs2_garbage_collect_dnode() return -EBUSY all the time,
> and let the callers that don't care ignore it?
>
> How's this look?
>
> diff -Nurp linux.orig/fs/jffs2/gc.c linux/fs/jffs2/gc.c
> --- linux.orig/fs/jffs2/gc.c 2007-07-27 08:32:36.000000000 -0500
> +++ linux/fs/jffs2/gc.c 2007-07-27 08:33:59.000000000 -0500
> @@ -1221,13 +1221,8 @@ static int jffs2_garbage_collect_dnode(s
> pg_ptr = jffs2_gc_fetch_page(c, f, start, &pg);
>
> if (IS_ERR(pg_ptr)) {
> - if ( PTR_ERR(pg_ptr) == -EBUSY ) {
> - printk(KERN_WARNING "jffs2_gc_fetch_page() rc -EBUSY. Deadlock avoided.\n" );
> - return 0;
> - } else {
> - printk(KERN_WARNING "jffs2_gc_fetch_page() rc %ld\n", PTR_ERR(pg_ptr));
> - return PTR_ERR(pg_ptr);
> - }
> + printk(KERN_WARNING "jffs2_gc_fetch_page() rc %ld\n", PTR_ERR(pg_ptr));
> + return PTR_ERR(pg_ptr);
> }
>
> offset = start;
> diff -Nurp linux.orig/fs/jffs2/nodemgmt.c linux/fs/jffs2/nodemgmt.c
> --- linux.orig/fs/jffs2/nodemgmt.c 2007-07-27 08:32:25.000000000 -0500
> +++ linux/fs/jffs2/nodemgmt.c 2007-07-27 08:35:46.000000000 -0500
> @@ -117,7 +117,7 @@ int jffs2_reserve_space(struct jffs2_sb_
> spin_unlock(&c->erase_completion_lock);
>
> ret = jffs2_garbage_collect_pass(c);
> - if (ret)
> + if (ret && (ret != -EBUSY))
> return ret;
>
> cond_resched();
>
> --
> David Kleikamp
> IBM Linux Technology Center
>
>
next prev parent reply other threads:[~2007-07-27 16:35 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <af3ea28a0707262032h7ee22775t6ef54e364a9cd704@mail.gmail.com>
2007-07-27 3:38 ` JFFS2 deadlock with alloc_sem ye janboe
2007-07-27 13:42 ` Dave Kleikamp
2007-07-27 16:35 ` ye janboe [this message]
2007-07-27 17:38 ` Dave Kleikamp
2007-07-30 12:45 ` David Woodhouse
2007-07-30 16:45 ` Dave Kleikamp
2007-07-31 12:10 ` David Woodhouse
2007-07-31 12:40 ` David Woodhouse
2007-07-31 13:23 ` Dave Kleikamp
2007-07-31 15:23 ` David Woodhouse
2007-07-31 15:36 ` Dave Kleikamp
2007-07-31 16:23 ` David Woodhouse
2007-08-02 4:11 ` ye janboe
2007-06-08 19:26 Dave Kleikamp
2007-06-11 12:14 ` David Woodhouse
2007-06-12 1:45 ` Roberts Nathan-mcg31137
2007-06-19 16:11 ` Dave Kleikamp
2007-06-19 19:42 ` Dave Kleikamp
-- strict thread matches above, loose matches on Subject: below --
2007-04-30 19:41 Roberts Nathan-mcg31137
2007-05-05 8:23 ` David Woodhouse
2007-06-02 17:42 ` David Woodhouse
2007-06-05 14:21 ` Roberts Nathan-mcg31137
2007-06-07 14:29 ` Josh Boyer
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=af3ea28a0707270935v3a8191acl5f2dc5780c56a3d9@mail.gmail.com \
--to=janboe.ye@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=shaggy@linux.vnet.ibm.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).