ceph: clear directory's completeness when creating file
authorYan, Zheng <zheng.z.yan@intel.com>
Mon, 14 Apr 2014 05:13:02 +0000 (13:13 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Jun 2014 17:28:20 +0000 (10:28 -0700)
commit600d8cbcd0f10b6535429a21bfb6cf2369155759
tree1f2b403adbd3d159d5f793b79cc6fcbe97007223
parenta23e2fa7ab52dfec62dc40de5cea10aec7cacdda
ceph: clear directory's completeness when creating file

commit 0a8a70f96fe1bd3e07c15bb86fd247e76102398a upstream.

When creating a file, ceph_set_dentry_offset() puts the new dentry
at the end of directory's d_subdirs, then set the dentry's offset
based on directory's max offset. The offset does not reflect the
real postion of the dentry in directory. Later readdir reply from
MDS may change the dentry's position/offset. This inconsistency
can cause missing/duplicate entries in readdir result if readdir
is partly satisfied by dcache_readdir().

The fix is clear directory's completeness after creating/renaming
file. It prevents later readdir from using dcache_readdir().

Fixes: http://tracker.ceph.com/issues/8025
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ceph/dir.c
fs/ceph/inode.c
fs/ceph/super.h