[SAUCE][XENIAL][PATCH 1/1] [CacheFiles] Fix to handle Oops in cachefiles module during new object lookup while old object is being cleaned up

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[SAUCE][XENIAL][PATCH 1/1] [CacheFiles] Fix to handle Oops in cachefiles module during new object lookup while old object is being cleaned up

Kiran Kumar Modukuri
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1776254

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!

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.

Clear the flag 'CACHEFILES_OBJECT_ACTIVE' for the new object when retrying the object lookup.
Remove the BUG() for the case where the old object is still being dropped and convert to WARN()

A user has run ~100 hours of NFS stress tests and not seen this bug recur.

[Regression Potential]
 - Limited to fscache/cachefiles.

Signed-off-by: kmodukuri <mailto:[hidden email]>
 fs/cachefiles/namei.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index c4b8934..b08286d 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -194,7 +194,7 @@ wait_for_old_object:
  pr_err("Error: Unexpected object collision\n");
  cachefiles_printk_object(object, xobject);
- BUG();
+ WARN(true, "Unexpected object collision\n");
@@ -247,6 +247,7 @@ wait_for_old_object:
  ASSERT(!test_bit(CACHEFILES_OBJECT_ACTIVE, &xobject->flags));
+ clear_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags);
  goto try_again;
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.

kernel-team mailing list
[hidden email]