Commit d69ed05a authored by Sage Weil's avatar Sage Weil

ceph: handle splice_dentry/d_materialize_unique error in readdir_prepopulate

Handle a splice_dentry failure (due to a d_materialize_unique error)
without crashing.  (Also, report the error code.)
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent cebc5be6
...@@ -854,8 +854,8 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, ...@@ -854,8 +854,8 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in,
d_drop(dn); d_drop(dn);
realdn = d_materialise_unique(dn, in); realdn = d_materialise_unique(dn, in);
if (IS_ERR(realdn)) { if (IS_ERR(realdn)) {
pr_err("splice_dentry error %p inode %p ino %llx.%llx\n", pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n",
dn, in, ceph_vinop(in)); PTR_ERR(realdn), dn, in, ceph_vinop(in));
if (prehash) if (prehash)
*prehash = false; /* don't rehash on error */ *prehash = false; /* don't rehash on error */
dn = realdn; /* note realdn contains the error */ dn = realdn; /* note realdn contains the error */
...@@ -1234,17 +1234,22 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, ...@@ -1234,17 +1234,22 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
goto out; goto out;
} }
dn = splice_dentry(dn, in, NULL); dn = splice_dentry(dn, in, NULL);
if (IS_ERR(dn))
dn = NULL;
} }
if (fill_inode(in, &rinfo->dir_in[i], NULL, session, if (fill_inode(in, &rinfo->dir_in[i], NULL, session,
req->r_request_started, -1, req->r_request_started, -1,
&req->r_caps_reservation) < 0) { &req->r_caps_reservation) < 0) {
pr_err("fill_inode badness on %p\n", in); pr_err("fill_inode badness on %p\n", in);
dput(dn); goto next_item;
continue;
} }
if (dn)
update_dentry_lease(dn, rinfo->dir_dlease[i], update_dentry_lease(dn, rinfo->dir_dlease[i],
req->r_session, req->r_request_started); req->r_session,
req->r_request_started);
next_item:
if (dn)
dput(dn); dput(dn);
} }
req->r_did_prepopulate = true; req->r_did_prepopulate = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment