hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IB5UKT
--------------------------------
As follows, moving cachefiles_ondemand_init_object() outside the parent dir lock also moves it before fscache_object_lookup_negative(). This causes FSCACHE_COOKIE_NO_DATA_YET to be cleared before setting it when creating a new data object. Eventually __fscache_read_or_alloc_page() reads the flag and returns -ENODATA causing the mount to fail.
mount | kworker ----------------------------------------------- __fscache_read_or_alloc_page cachefiles_walk_to_object cachefiles_ondemand_init_object cachefiles_ondemand_send_req cachefiles_ondemand_copen clear_bit(FSCACHE_COOKIE_NO_DATA_YET) fscache_object_lookup_negative set_bit(FSCACHE_COOKIE_NO_DATA_YET) if (test_bit(FSCACHE_COOKIE_NO_DATA_YET)) object->cache->ops->allocate_page ret = -ENODATA
Hence for newly created data objects whose size is not 0, clear the FSCACHE_COOKIE_NO_DATA_YET bit.
Signed-off-by: Baokun Li libaokun1@huawei.com --- fs/cachefiles/namei.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 281e53d63972..93c511d1fff3 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c @@ -725,6 +725,11 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent, */ file->f_mode |= FMODE_RANDOM; rcu_assign_pointer(object->file, file); + + /* Now the pages can be read. */ + if (object->new && object->fscache.store_limit_l) + clear_bit_unlock(FSCACHE_COOKIE_NO_DATA_YET, + &object->fscache.cookie->flags); }
object->backer = object->dentry;