Commit c6bdb606 authored by Kiran Kumar Modukuri's avatar Kiran Kumar Modukuri Committed by Khalid Elmously

cachefiles: Wait rather than BUG'ing on "Unexpected object collision"

BugLink: https://bugs.launchpad.net/bugs/1776254

If we meet a conflicting object that is marked FSCACHE_OBJECT_IS_LIVE in
the active object tree, we have been emitting a BUG after logging
information about it and the new object.

Instead, we should wait for the CACHEFILES_OBJECT_ACTIVE flag to be cleared
on the old object (or return an error).  The ACTIVE flag should be cleared
after it has been removed from the active object tree.  A timeout of 60s is
used in the wait, so we shouldn't be able to get stuck there.

Fixes: 9ae326a6 ("CacheFiles: A cache that backs onto a mounted filesystem")
Signed-off-by: default avatarKiran Kumar Modukuri <kiran.modukuri@gmail.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
(cherry picked from commit c2412ac4)
Signed-off-by: default avatarDaniel Axtens <daniel.axtens@canonical.com>
Acked-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Acked-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 8c4aa7be
...@@ -196,7 +196,6 @@ static int cachefiles_mark_object_active(struct cachefiles_cache *cache, ...@@ -196,7 +196,6 @@ static int cachefiles_mark_object_active(struct cachefiles_cache *cache,
pr_err("\n"); pr_err("\n");
pr_err("Error: Unexpected object collision\n"); pr_err("Error: Unexpected object collision\n");
cachefiles_printk_object(object, xobject); cachefiles_printk_object(object, xobject);
BUG();
} }
atomic_inc(&xobject->usage); atomic_inc(&xobject->usage);
write_unlock(&cache->active_lock); write_unlock(&cache->active_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment