ceph: don't fill readdir cache for LSSNAP reply
authorYan, Zheng <zyan@redhat.com>
Wed, 26 Jul 2017 04:07:51 +0000 (12:07 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 6 Sep 2017 17:56:45 +0000 (19:56 +0200)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/inode.c

index 2c5db36..4c34e08 100644 (file)
@@ -1516,15 +1516,18 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
                     rinfo->dir_nr, parent);
                if (rinfo->dir_dir)
                        ceph_fill_dirfrag(d_inode(parent), rinfo->dir_dir);
-       }
 
-       if (ceph_frag_is_leftmost(frag) && req->r_readdir_offset == 2 &&
-           !(rinfo->hash_order && last_hash)) {
-               /* note dir version at start of readdir so we can tell
-                * if any dentries get dropped */
-               req->r_dir_release_cnt = atomic64_read(&ci->i_release_count);
-               req->r_dir_ordered_cnt = atomic64_read(&ci->i_ordered_count);
-               req->r_readdir_cache_idx = 0;
+               if (ceph_frag_is_leftmost(frag) &&
+                   req->r_readdir_offset == 2 &&
+                   !(rinfo->hash_order && last_hash)) {
+                       /* note dir version at start of readdir so we can
+                        * tell if any dentries get dropped */
+                       req->r_dir_release_cnt =
+                               atomic64_read(&ci->i_release_count);
+                       req->r_dir_ordered_cnt =
+                               atomic64_read(&ci->i_ordered_count);
+                       req->r_readdir_cache_idx = 0;
+               }
        }
 
        cache_ctl.index = req->r_readdir_cache_idx;