<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/jffs2/gc.c, branch linux-3.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.2.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.2.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2016-04-01T00:54:35Z</updated>
<entry>
<title>jffs2: Fix page lock / f-&gt;sem deadlock</title>
<updated>2016-04-01T00:54:35Z</updated>
<author>
<name>David Woodhouse</name>
</author>
<published>2016-02-01T12:37:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0a2688146b9afcfdc368b81cc0696a19c0cd6c6a'/>
<id>urn:sha1:0a2688146b9afcfdc368b81cc0696a19c0cd6c6a</id>
<content type='text'>
commit 49e91e7079febe59a20ca885a87dd1c54240d0f1 upstream.

With this fix, all code paths should now be obtaining the page lock before
f-&gt;sem.

Reported-by: Szabó Tamás &lt;sztomi89@gmail.com&gt;
Tested-by: Thomas Betker &lt;thomas.betker@rohde-schwarz.com&gt;
Signed-off-by: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>jffs2: Fix lock acquisition order bug in gc path</title>
<updated>2012-05-20T21:56:41Z</updated>
<author>
<name>Josh Cartwright</name>
</author>
<published>2012-03-29T23:34:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5a6cc206dfa8de733e848590b43d30706216733c'/>
<id>urn:sha1:5a6cc206dfa8de733e848590b43d30706216733c</id>
<content type='text'>
commit 226bb7df3d22bcf4a1c0fe8206c80cc427498eae upstream.

The locking policy is such that the erase_complete_block spinlock is
nested within the alloc_sem mutex.  This fixes a case in which the
acquisition order was erroneously reversed.  This issue was caught by
the following lockdep splat:

   =======================================================
   [ INFO: possible circular locking dependency detected ]
   3.0.5 #1
   -------------------------------------------------------
   jffs2_gcd_mtd6/299 is trying to acquire lock:
    (&amp;c-&gt;alloc_sem){+.+.+.}, at: [&lt;c01f7714&gt;] jffs2_garbage_collect_pass+0x314/0x890

   but task is already holding lock:
    (&amp;(&amp;c-&gt;erase_completion_lock)-&gt;rlock){+.+...}, at: [&lt;c01f7708&gt;] jffs2_garbage_collect_pass+0x308/0x890

   which lock already depends on the new lock.

   the existing dependency chain (in reverse order) is:

   -&gt; #1 (&amp;(&amp;c-&gt;erase_completion_lock)-&gt;rlock){+.+...}:
          [&lt;c008bec4&gt;] validate_chain+0xe6c/0x10bc
          [&lt;c008c660&gt;] __lock_acquire+0x54c/0xba4
          [&lt;c008d240&gt;] lock_acquire+0xa4/0x114
          [&lt;c046780c&gt;] _raw_spin_lock+0x3c/0x4c
          [&lt;c01f744c&gt;] jffs2_garbage_collect_pass+0x4c/0x890
          [&lt;c01f937c&gt;] jffs2_garbage_collect_thread+0x1b4/0x1cc
          [&lt;c0071a68&gt;] kthread+0x98/0xa0
          [&lt;c000f264&gt;] kernel_thread_exit+0x0/0x8

   -&gt; #0 (&amp;c-&gt;alloc_sem){+.+.+.}:
          [&lt;c008ad2c&gt;] print_circular_bug+0x70/0x2c4
          [&lt;c008c08c&gt;] validate_chain+0x1034/0x10bc
          [&lt;c008c660&gt;] __lock_acquire+0x54c/0xba4
          [&lt;c008d240&gt;] lock_acquire+0xa4/0x114
          [&lt;c0466628&gt;] mutex_lock_nested+0x74/0x33c
          [&lt;c01f7714&gt;] jffs2_garbage_collect_pass+0x314/0x890
          [&lt;c01f937c&gt;] jffs2_garbage_collect_thread+0x1b4/0x1cc
          [&lt;c0071a68&gt;] kthread+0x98/0xa0
          [&lt;c000f264&gt;] kernel_thread_exit+0x0/0x8

   other info that might help us debug this:

    Possible unsafe locking scenario:

          CPU0                    CPU1
          ----                    ----
     lock(&amp;(&amp;c-&gt;erase_completion_lock)-&gt;rlock);
                                  lock(&amp;c-&gt;alloc_sem);
                                  lock(&amp;(&amp;c-&gt;erase_completion_lock)-&gt;rlock);
     lock(&amp;c-&gt;alloc_sem);

    *** DEADLOCK ***

   1 lock held by jffs2_gcd_mtd6/299:
    #0:  (&amp;(&amp;c-&gt;erase_completion_lock)-&gt;rlock){+.+...}, at: [&lt;c01f7708&gt;] jffs2_garbage_collect_pass+0x308/0x890

   stack backtrace:
   [&lt;c00155dc&gt;] (unwind_backtrace+0x0/0x100) from [&lt;c0463dc0&gt;] (dump_stack+0x20/0x24)
   [&lt;c0463dc0&gt;] (dump_stack+0x20/0x24) from [&lt;c008ae84&gt;] (print_circular_bug+0x1c8/0x2c4)
   [&lt;c008ae84&gt;] (print_circular_bug+0x1c8/0x2c4) from [&lt;c008c08c&gt;] (validate_chain+0x1034/0x10bc)
   [&lt;c008c08c&gt;] (validate_chain+0x1034/0x10bc) from [&lt;c008c660&gt;] (__lock_acquire+0x54c/0xba4)
   [&lt;c008c660&gt;] (__lock_acquire+0x54c/0xba4) from [&lt;c008d240&gt;] (lock_acquire+0xa4/0x114)
   [&lt;c008d240&gt;] (lock_acquire+0xa4/0x114) from [&lt;c0466628&gt;] (mutex_lock_nested+0x74/0x33c)
   [&lt;c0466628&gt;] (mutex_lock_nested+0x74/0x33c) from [&lt;c01f7714&gt;] (jffs2_garbage_collect_pass+0x314/0x890)
   [&lt;c01f7714&gt;] (jffs2_garbage_collect_pass+0x314/0x890) from [&lt;c01f937c&gt;] (jffs2_garbage_collect_thread+0x1b4/0x1cc)
   [&lt;c01f937c&gt;] (jffs2_garbage_collect_thread+0x1b4/0x1cc) from [&lt;c0071a68&gt;] (kthread+0x98/0xa0)
   [&lt;c0071a68&gt;] (kthread+0x98/0xa0) from [&lt;c000f264&gt;] (kernel_thread_exit+0x0/0x8)

This was introduce in '81cfc9f jffs2: Fix serious write stall due to erase'.

Signed-off-by: Josh Cartwright &lt;joshc@linux.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>jffs2: Fix serious write stall due to erase</title>
<updated>2010-10-25T00:06:22Z</updated>
<author>
<name>Joakim Tjernlund</name>
</author>
<published>2010-10-07T16:01:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=81cfc9f1f4ad8d335367bb393bd042cc45b00047'/>
<id>urn:sha1:81cfc9f1f4ad8d335367bb393bd042cc45b00047</id>
<content type='text'>
Drop the alloc_sem before erasing flash in
jffs2_garbage_collect_pass().
Otherwise writes are put on hold until the erase
has finised.

Signed-off-by: Joakim Tjernlund &lt;Joakim.Tjernlund@transmode.se&gt;
Signed-off-by: Artem Bityutskiy &lt;Artem.Bityutskiy@nokia.com&gt;
Signed-off-by: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
</content>
</entry>
<entry>
<title>jffs2: Update copyright notices</title>
<updated>2010-08-08T13:15:22Z</updated>
<author>
<name>David Woodhouse</name>
</author>
<published>2010-08-08T13:15:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6088c0587706b2cf21ce50c11576718bff5fae0c'/>
<id>urn:sha1:6088c0587706b2cf21ce50c11576718bff5fae0c</id>
<content type='text'>
Signed-off-by: David Woodhouse &lt;dwmw2@infradead.org&gt;
</content>
</entry>
<entry>
<title>jffs2: Use jffs2_garbage_collect_trigger() to trigger pending erases</title>
<updated>2010-05-19T16:10:44Z</updated>
<author>
<name>David Woodhouse</name>
</author>
<published>2010-05-19T16:05:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ae3b6ba06c8ed399ef920724ee8136e540878294'/>
<id>urn:sha1:ae3b6ba06c8ed399ef920724ee8136e540878294</id>
<content type='text'>
This is now done in a GC pass; we don't need to trigger kupdated to do it.

Signed-off-by: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
</content>
</entry>
<entry>
<title>jffs2: Erase pending blocks in GC pass, avoid invalid -EIO return</title>
<updated>2010-05-19T15:49:37Z</updated>
<author>
<name>David Woodhouse</name>
</author>
<published>2010-05-19T15:37:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0717bf8411bb673dd2369aaa096f7396446b38f5'/>
<id>urn:sha1:0717bf8411bb673dd2369aaa096f7396446b38f5</id>
<content type='text'>
jffs2_garbage_collect_pass() would previously return -EAGAIN if it
couldn't find anything to garbage collect from, and there were blocks on
the erase_pending_list. If the blocks were actually in the process of
being erased, though, then they wouldn't be on that list. Check for
nr_erasing_blocks being non-zero instead.

Fix jffs2_reserve_space() to wait for the in-progress erases to
complete, when jffs2_garbage_collect_pass() returns -EAGAIN.

And fix jffs2_erase_succeeded() to actually wake up the erase_wait wq
that jffs2_reserve_space() is now using.

Signed-off-by: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
</content>
</entry>
<entry>
<title>jffs2: Fix long-standing bug with symlink garbage collection.</title>
<updated>2009-12-16T03:27:20Z</updated>
<author>
<name>David Woodhouse</name>
</author>
<published>2009-12-16T03:27:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2e16cfca6e17ae37ae21feca080a6f2eca9087dc'/>
<id>urn:sha1:2e16cfca6e17ae37ae21feca080a6f2eca9087dc</id>
<content type='text'>
Ever since jffs2_garbage_collect_metadata() was first half-written in
February 2001, it's been broken on architectures where 'char' is signed.
When garbage collecting a symlink with target length above 127, the payload
length would end up negative, causing interesting and bad things to happen.

Cc: stable@kernel.org
Signed-off-by: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
</content>
</entry>
<entry>
<title>[JFFS2] Track parent inode for directories (for NFS export)</title>
<updated>2008-05-01T17:47:17Z</updated>
<author>
<name>David Woodhouse</name>
</author>
<published>2008-05-01T17:47:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=27c72b040c0be8f3704ed0b6b84c12cbba24a7e8'/>
<id>urn:sha1:27c72b040c0be8f3704ed0b6b84c12cbba24a7e8</id>
<content type='text'>
To support NFS export, we need to know the parent inode of directories.
Rather than growing the jffs2_inode_cache structure, share space with
the nlink field -- which was always set to 1 for directories anyway.

Signed-off-by: David Woodhouse &lt;dwmw2@infradead.org&gt;
</content>
</entry>
<entry>
<title>[JFFS2] Invert last argument of jffs2_gc_fetch_inode(), make it boolean.</title>
<updated>2008-05-01T16:24:28Z</updated>
<author>
<name>David Woodhouse</name>
</author>
<published>2008-05-01T15:59:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1b690b48786229571e590dd22fe01ecc22a8746b'/>
<id>urn:sha1:1b690b48786229571e590dd22fe01ecc22a8746b</id>
<content type='text'>
We don't actually care about nlink; we only care whether the inode in
question is unlinked or not.

Signed-off-by: David Woodhouse &lt;dwmw2@infradead.org&gt;
</content>
</entry>
<entry>
<title>[JFFS2] Fix jffs2_reserve_space() when all blocks are pending erasure.</title>
<updated>2008-04-23T15:01:37Z</updated>
<author>
<name>David Woodhouse</name>
</author>
<published>2008-04-23T14:40:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=422b120238130307da64fa44c9fb722bfaf5f1af'/>
<id>urn:sha1:422b120238130307da64fa44c9fb722bfaf5f1af</id>
<content type='text'>
When _all_ the blocks were on the erase_pending_list, we could't find a
block to GC from but there was no _actually_ free space, and
jffs2_reserve_space() would get a little unhappy.

Handle this case by returning -EAGAIN from jffs2_garbage_collect_pass().
There are two callers of that function -- jffs2_flush_wbuf_gc(), which
will interpret it as an error and flush the writebuffer by other means,
and jffs2_reserve_space(), which we modify to respond to -EAGAIN with an
immediate call to jffs2_erase_pending_blocks() and another run round the
loop.

Signed-off-by: David Woodhouse &lt;dwmw2@infradead.org&gt;
</content>
</entry>
</feed>
