ceph: Fix oops when mounting cephfs with non-existing path
PATCH 1/1 ceph: Fix oops when mounting cephfs with non-existing path
From: "Yan, Zheng" <[email protected]>
req->r_locked_dir is NULL if the request was created by open_root_dentry(). ceph_fill_trace() lacks check for this case. It causes oops when mounting cephfs with non-existing path.
--- fs/ceph/inode.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/ceph/inode.c +7 -0
@@ -992,6 +992,13 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,if (rinfo->head->is_dentry) {struct inode *dir = req->r_locked_dir; +/* +* req->r_locked_dir is null if the request was created +* by open_root_dentry() +*/ +if (!dir) +return le32_to_cpu (rinfo->head->result); + err =fill_inode (dir, &rinfo->diri, rinfo->dirfrag, session, req->r_request_started,-1 , &req->r_caps_reservation);
Signature · 1 line
1.7.11.2
Hi Yan,
Quoted 5 lines · Zheng
From: "Yan, Zheng" <[email protected]>
req->r_locked_diris NULL if the request was created byopen_root_dentry().ceph_fill_trace()lacks check for this case. It causes oops when mounting cephfs with non-existing path.
This is actually an MDS bug. The problem is that the client is issuing a GETATTR request and isn't prepared to handle a dentry in the reply, but the MDS sees that there is a relative path in the request and behaves like this is a lookup. We were distinguishing correctly between the two cases on success, but not on error. I've pushed branch bug-2969 to ceph.git which fixes this for me. Can you please test and verify it resolves the problem?
We may want to have a check like the below, but it should probably be accompanied by a pr_warning or WARN_ON() since it is a protocol error. Generally speaking, the client isn't allowed to ignore state the MDS has issued it (in this case, caps on the directory inode; lower down in fill_trace possibly a dentry lease) without messing up the protocol.
Thanks for looking at this! Looking at your global_id patch next...
Thanks-
sage
http://tracker.newdream.net/issues/2959
Quoted 33 lines
Signed-off-by Yan, Zheng <[email protected]>--- fs/ceph/inode.c | 7 +++++++ 1 file changed, 7 insertions(+)fs/ceph/inode.c +7
-0@@ -992,6 +992,13 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,if (rinfo->head->is_dentry) {struct inode *dir = req->r_locked_dir; +/* +* req->r_locked_dir is null if the request was created +* by open_root_dentry() +*/ +if (!dir) +return le32_to_cpu (rinfo->head->result); + err =fill_inode (dir, &rinfo->diri, rinfo->dirfrag, session, req->r_request_started,-1 , &req->r_caps_reservation);Signature · 6 lines
1.7.11.2 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Sage Weil
Quoted 3 lines
req->r_locked_diris NULL if the request was created byopen_root_dentry().ceph_fill_trace()lacks check for this case. It causes oops when mounting cephfs with non-existing path.This is actually an MDS bug. The problem is that the client is issuing a
It's also a kernel bug -- there's no excuse for an oops, even if the server spoke pig latin.
Quoted 9 lines · Sage Weil
Hi Yan,
Quoted 5 lines · Zheng
From: "Yan, Zheng" <[email protected]>
req->r_locked_diris NULL if the request was created byopen_root_dentry().ceph_fill_trace()lacks check for this case. It causes oops when mounting cephfs with non-existing path.
Quoted 7 lines
This is actually an MDS bug. The problem is that the client is issuing a GETATTR request and isn't prepared to handle a dentry in the reply, but the MDS sees that there is a relative path in the request and behaves like this is a lookup. We were distinguishing correctly between the two cases on success, but not on error. I've pushed branch bug-2969 to ceph.git which fixes this for me. Can you please test and verify it resolves the problem?
It does resolve the problem.
Quoted 7 lines
We may want to have a check like the below, but it should probably be accompanied by a
pr_warningorWARN_ON()since it is a protocol error. Generally speaking, the client isn't allowed to ignore state the MDS has issued it (in this case, caps on the directory inode; lower down infill_tracepossibly a dentry lease) without messing up the protocol.
Thank you for your explanation.
Yan, Zheng