From: Jingbo Xu jefflexu@linux.alibaba.com
anolis inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB5UKT
Reference: https://gitee.com/anolis/cloud-kernel/commit/2d8af2af6a59
--------------------------------
ANBZ: #3211
BUG_ON() is extremely user unfriendly. Keep moving forward if things wern't so bad.
Fixes: 8fc28945e193 ("cachefiles: notify the user daemon when looking up cookie") Fixes: e0f54fb64c0a ("cachefiles: implement on-demand read") Signed-off-by: Jingbo Xu jefflexu@linux.alibaba.com Reviewed-by: Gao Xiang hsiangkao@linux.alibaba.com Acked-by: Joseph Qi joseph.qi@linux.alibaba.com Link: https://gitee.com/anolis/cloud-kernel/pulls/881 Link: https://gitee.com/anolis/cloud-kernel/pulls/884 Signed-off-by: Baokun Li libaokun1@huawei.com --- fs/cachefiles/daemon.c | 3 ++- fs/cachefiles/ondemand.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c index 1a3a9fda60c8..b531373400d7 100644 --- a/fs/cachefiles/daemon.c +++ b/fs/cachefiles/daemon.c @@ -156,7 +156,8 @@ static void cachefiles_flush_reqs(struct cachefiles_cache *cache) radix_tree_for_each_slot(slot, &cache->reqs, &iter, 0) { req = radix_tree_deref_slot_protected(slot, &cache->reqs.xa_lock); - BUG_ON(!req); + if (WARN_ON(!req)) + continue; radix_tree_delete(&cache->reqs, iter.index); req->error = -EIO; complete(&req->done); diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c index ad3330f9e3d1..ee0d283ac863 100644 --- a/fs/cachefiles/ondemand.c +++ b/fs/cachefiles/ondemand.c @@ -27,8 +27,8 @@ static int cachefiles_ondemand_fd_release(struct inode *inode, radix_tree_for_each_slot(slot, &cache->reqs, &iter, 0) { req = radix_tree_deref_slot_protected(slot, &cache->reqs.xa_lock); - BUG_ON(!req); - + if (WARN_ON(!req)) + continue; if (req->msg.object_id == object_id && req->msg.opcode == CACHEFILES_OP_READ) { req->error = -EIO;