alistair23-linux/fs/cachefiles
Kiran Kumar Modukuri 5ce83d4bb7 cachefiles: Fix missing clear of the CACHEFILES_OBJECT_ACTIVE flag
In cachefiles_mark_object_active(), the new object is marked active and
then we try to add it to the active object tree.  If a conflicting object
is already present, we want to wait for that to go away.  After the wait,
we go round again and try to re-mark the object as being active - but it's
already marked active from the first time we went through and a BUG is
issued.

Fix this by clearing the CACHEFILES_OBJECT_ACTIVE flag before we try again.

Analysis from Kiran Kumar Modukuri:

[Impact]
Oops during heavy NFS + FSCache + Cachefiles

CacheFiles: Error: Overlong wait for old active object to go away.

BUG: unable to handle kernel NULL pointer dereference at 0000000000000002

CacheFiles: Error: Object already active kernel BUG at
fs/cachefiles/namei.c:163!

[Cause]
In a heavily loaded system with big files being read and truncated, an
fscache object for a cookie is being dropped and a new object being
looked. The new object being looked for has to wait for the old object
to go away before the new object is moved to active state.

[Fix]
Clear the flag 'CACHEFILES_OBJECT_ACTIVE' for the new object when
retrying the object lookup.

[Testcase]
Have run ~100 hours of NFS stress tests and have not seen this bug recur.

[Regression Potential]
 - Limited to fscache/cachefiles.

Fixes: 9ae326a690 ("CacheFiles: A cache that backs onto a mounted filesystem")
Signed-off-by: Kiran Kumar Modukuri <kiran.modukuri@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
2018-07-25 14:49:00 +01:00
..
bind.c fscache: Fix reference overput in fscache_attach_object() error handling 2018-07-25 14:49:00 +01:00
daemon.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
interface.c fscache: Pass object size in rather than calling back for it 2018-04-06 14:05:14 +01:00
internal.h fscache: Add tracepoints 2018-04-04 13:41:27 +01:00
Kconfig
key.c
main.c fscache: Add tracepoints 2018-04-04 13:41:27 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
namei.c cachefiles: Fix missing clear of the CACHEFILES_OBJECT_ACTIVE flag 2018-07-25 14:49:00 +01:00
proc.c proc: introduce proc_create_seq{,_data} 2018-05-16 07:23:35 +02:00
rdwr.c cachefiles: Fix refcounting bug in backing-file read monitoring 2018-07-25 14:49:00 +01:00
security.c VFS: fs/cachefiles: d_backing_inode() annotations 2015-04-15 15:06:59 -04:00
xattr.c fscache: Pass object size in rather than calling back for it 2018-04-06 14:05:14 +01:00