Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: fscache: Wait for completion of object initialization

The object store limit needs to be updated after writing,
and this can be done provided the corresponding object has already
been initialized. Current object initialization is done asynchrously,
which introduce a race if a file is opened, then immediately followed
by a writing, the initialization may have not completed, the code will
reach the ASSERT in fscache_submit_exclusive_op() to cause kernel
bug.

Tested-by: Milosz Tanski <milosz@adfin.com>
Signed-off-by: Yunchuan Wen <yunchuanwen@ubuntukylin.com>
Signed-off-by: Min Chen <minchen@ubuntukylin.com>
Signed-off-by: Li Wang <liwang@ubuntukylin.com>

authored by

Yunchuan Wen and committed by
Yan, Zheng
f1fc4fee 32d3e148

+1
+1
fs/ceph/cache.c
··· 205 205 ci->fscache = fscache_acquire_cookie(fsc->fscache, 206 206 &ceph_fscache_inode_object_def, 207 207 ci, true); 208 + fscache_check_consistency(ci->fscache); 208 209 done: 209 210 mutex_unlock(&inode->i_mutex); 210 211