Skip to content

Commit 6c5e50f

Browse files
author
Sage Weil
committed
ceph: tolerate (and warn on) extraneous dentry from mds
If the MDS gives us a dentry and we weren't prepared to handle it, WARN_ON_ONCE instead of crashing. Reported-by: Yan, Zheng <[email protected]> Signed-off-by: Sage Weil <[email protected]> Reviewed-by: Alex Elder <[email protected]>
1 parent d1c338a commit 6c5e50f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

fs/ceph/inode.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -992,18 +992,23 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
992992
if (rinfo->head->is_dentry) {
993993
struct inode *dir = req->r_locked_dir;
994994

995-
err = fill_inode(dir, &rinfo->diri, rinfo->dirfrag,
996-
session, req->r_request_started, -1,
997-
&req->r_caps_reservation);
998-
if (err < 0)
999-
return err;
995+
if (dir) {
996+
err = fill_inode(dir, &rinfo->diri, rinfo->dirfrag,
997+
session, req->r_request_started, -1,
998+
&req->r_caps_reservation);
999+
if (err < 0)
1000+
return err;
1001+
} else {
1002+
WARN_ON_ONCE(1);
1003+
}
10001004
}
10011005

10021006
/*
10031007
* ignore null lease/binding on snapdir ENOENT, or else we
10041008
* will have trouble splicing in the virtual snapdir later
10051009
*/
10061010
if (rinfo->head->is_dentry && !req->r_aborted &&
1011+
req->r_locked_dir &&
10071012
(rinfo->head->is_target || strncmp(req->r_dentry->d_name.name,
10081013
fsc->mount_options->snapdir_name,
10091014
req->r_dentry->d_name.len))) {

0 commit comments

Comments
 (0)