
From: Zizhi Wo <wozizhi@huawei.com> hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IB5UKT -------------------------------- In the current erofs ondemand loading mode, after erofs is umounted and object->fd is closed, run the inuse() command and it may reveal that the corresponding object is still busy. This is because non-busy depends on the cachefiles_mark_object_inactive() called, but it comes after send close req. Fix this issue by moving cachefiles_mark_object_inactive() before send close request in erofs ondemand mode, as erofs ondemand mode will not set retired flag, there is no extra impact. Signed-off-by: Zizhi Wo <wozizhi@huawei.com> Signed-off-by: Baokun Li <libaokun1@huawei.com> --- fs/cachefiles/interface.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c index abbf0033459e..fa131db764c4 100644 --- a/fs/cachefiles/interface.c +++ b/fs/cachefiles/interface.c @@ -288,6 +288,11 @@ static void cachefiles_drop_object(struct fscache_object *_object) ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000); #endif + if (test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags) && + (volume_new_version(object->fscache.cookie) || + data_new_version(object->fscache.cookie))) + cachefiles_mark_object_inactive(cache, object, 0); + cachefiles_ondemand_clean_object(object); /* We need to tidy the object up if we did in fact manage to open it. -- 2.46.1