linux/fs/fscache
David Howells 7026f1929e FS-Cache: Handle removal of unadded object to the fscache_object_list rb tree
When FS-Cache allocates an object, the following sequence of events can
occur:

 -->fscache_alloc_object()
    -->cachefiles_alloc_object() [via cache->ops->alloc_object]
    <--[returns new object]
    -->fscache_attach_object()
    <--[failed]
    -->cachefiles_put_object() [via cache->ops->put_object]
       -->fscache_object_destroy()
          -->fscache_objlist_remove()
             -->rb_erase() to remove the object from fscache_object_list.

resulting in a crash in the rbtree code.

The problem is that the object is only added to fscache_object_list on
the success path of fscache_attach_object() where it calls
fscache_objlist_add().

So if fscache_attach_object() fails, the object won't have been added to
the objlist rbtree.  We do, however, unconditionally try to remove the
object from the tree.

Thanks to NeilBrown for finding this and suggesting this solution.

Reported-by: NeilBrown <neilb@suse.de>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: (a customer of) NeilBrown <neilb@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-02-17 13:47:35 -08:00
..
Kconfig fscache: drop references to slow-work 2010-07-22 22:58:58 +02:00
Makefile FS-Cache: Allow the current state of all objects to be dumped 2009-11-19 18:11:04 +00:00
cache.c FS-Cache: Fix object state machine to have separate work and wait states 2013-06-19 14:16:47 +01:00
cookie.c FS-Cache: Provide the ability to enable/disable cookies 2013-09-27 18:40:25 +01:00
fsdef.c FS-Cache: Provide the ability to enable/disable cookies 2013-09-27 18:40:25 +01:00
histogram.c
internal.h FS-Cache: Add interface to check consistency of a cached object 2013-09-06 09:17:30 +01:00
main.c FS-Cache: Simplify cookie retention for fscache_objects, fixing oops 2013-06-19 14:16:47 +01:00
netfs.c FS-Cache: Provide the ability to enable/disable cookies 2013-09-27 18:40:25 +01:00
object-list.c FS-Cache: Handle removal of unadded object to the fscache_object_list rb tree 2014-02-17 13:47:35 -08:00
object.c FS-Cache: Handle removal of unadded object to the fscache_object_list rb tree 2014-02-17 13:47:35 -08:00
operation.c FS-Cache: Don't use spin_is_locked() in assertions 2013-06-19 14:16:47 +01:00
page.c FS-Cache: Provide the ability to enable/disable cookies 2013-09-27 18:40:25 +01:00
proc.c FS-Cache: Allow the current state of all objects to be dumped 2009-11-19 18:11:04 +00:00
stats.c fs/fscache/stats.c: fix memory leak 2013-04-29 15:54:27 -07:00