@@ -1817,7 +1817,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;
@@ -1876,11 +1876,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;
@@ -1890,7 +1892,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,
@@ -2045,8 +2047,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;
}