ceph: don't clobber i_max_offset on already complete dir
authorSage Weil <sage@newdream.net>
Fri, 16 Apr 2010 19:58:02 +0000 (12:58 -0700)
committerSage Weil <sage@newdream.net>
Mon, 17 May 2010 22:25:27 +0000 (15:25 -0700)
This can screw up offsets assigned to new dentries and break dcache
readdir results.

Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/inode.c

index 49a0935c43906ddaf528ea0f5237abb1f6d0469f..aa22a0bce52fbb6e9d75ecfd0c928eab31ee6d26 100644 (file)
@@ -675,7 +675,8 @@ static int fill_inode(struct inode *inode,
                /* set dir completion flag? */
                if (ci->i_files == 0 && ci->i_subdirs == 0 &&
                    ceph_snap(inode) == CEPH_NOSNAP &&
-                   (le32_to_cpu(info->cap.caps) & CEPH_CAP_FILE_SHARED)) {
+                   (le32_to_cpu(info->cap.caps) & CEPH_CAP_FILE_SHARED) &&
+                   (ci->i_ceph_flags & CEPH_I_COMPLETE) == 0) {
                        dout(" marking %p complete (empty)\n", inode);
                        ci->i_ceph_flags |= CEPH_I_COMPLETE;
                        ci->i_max_offset = 2;