[ 139/171] ceph: tolerate (and warn on) extraneous dentry from mds

From: Greg Kroah-Hartman
Date: Tue Jan 15 2013 - 18:25:02 EST


3.4-stable review patch. If anyone has any objections, please let me know.

------------------


From: Sage Weil <sage@xxxxxxxxxxx>

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 <zheng.z.yan@xxxxxxxxx>
Signed-off-by: Sage Weil <sage@xxxxxxxxxxx>
Reviewed-by: Alex Elder <elder@xxxxxxxxxxx>
(cherry picked from commit 6c5e50fa614fea5325a2973be06f7ec6f1055316)
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
fs/ceph/inode.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -992,11 +992,15 @@ int ceph_fill_trace(struct super_block *
if (rinfo->head->is_dentry) {
struct inode *dir = req->r_locked_dir;

- err = fill_inode(dir, &rinfo->diri, rinfo->dirfrag,
- session, req->r_request_started, -1,
- &req->r_caps_reservation);
- if (err < 0)
- return err;
+ if (dir) {
+ err = fill_inode(dir, &rinfo->diri, rinfo->dirfrag,
+ session, req->r_request_started, -1,
+ &req->r_caps_reservation);
+ if (err < 0)
+ return err;
+ } else {
+ WARN_ON_ONCE(1);
+ }
}

/*
@@ -1004,6 +1008,7 @@ int ceph_fill_trace(struct super_block *
* will have trouble splicing in the virtual snapdir later
*/
if (rinfo->head->is_dentry && !req->r_aborted &&
+ req->r_locked_dir &&
(rinfo->head->is_target || strncmp(req->r_dentry->d_name.name,
fsc->mount_options->snapdir_name,
req->r_dentry->d_name.len))) {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/