@@ -1823,7 +1823,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info;
struct qstr dname;
struct dentry *dn;
- struct inode *in;
+ struct inode *in, *pinode;
int err = 0, skipped = 0, ret, i;
u32 frag = le32_to_cpu(req->r_args.readdir.frag);
u32 last_hash = 0;
@@ -1882,11 +1882,13 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
cache_ctl.index = req->r_readdir_cache_idx;
fpos_offset = req->r_readdir_offset;
- err = ceph_fname_alloc_buffer(inode, &tname);
+ pinode = ceph_get_snap_parent_inode(inode);
+
+ err = ceph_fname_alloc_buffer(pinode, &tname);
if (err < 0)
goto out;
- err = ceph_fname_alloc_buffer(inode, &oname);
+ err = ceph_fname_alloc_buffer(pinode, &oname);
if (err < 0)
goto out;
@@ -1896,7 +1898,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
struct ceph_mds_reply_dir_entry *rde = rinfo->dir_entries + i;
struct ceph_vino tvino;
u32 olen = oname.len;
- struct ceph_fname fname = { .dir = inode,
+ struct ceph_fname fname = { .dir = pinode,
.name = rde->name,
.name_len = rde->name_len,
.ctext = rde->altname,
@@ -2051,8 +2053,9 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
req->r_readdir_cache_idx = cache_ctl.index;
}
ceph_readdir_cache_release(&cache_ctl);
- ceph_fname_free_buffer(inode, &tname);
- ceph_fname_free_buffer(inode, &oname);
+ ceph_fname_free_buffer(pinode, &tname);
+ ceph_fname_free_buffer(pinode, &oname);
+ iput(pinode);
dout("readdir_prepopulate done\n");
return err;
}