From: "Yan, Zheng" <zyan@redhat.com>
Date: Fri, 28 Sep 2018 11:34:42 +0800
Subject: ceph: check if LOOKUPNAME request was aborted when filling trace
Git-commit: 74c9e6bf4c888e41bc7db340fb94fade96394038
Patch-mainline: v4.20-rc1
References: FATE#324714
d_lookup()/d_alloc() require parent inode locked. Parent inode is
not locked if request is aborted.
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Acked-by: Luis Henriques <lhenriques@suse.com>
---
fs/ceph/inode.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -1199,7 +1199,9 @@ int ceph_fill_trace(struct super_block *
WARN_ON_ONCE(1);
}
- if (dir && req->r_op == CEPH_MDS_OP_LOOKUPNAME) {
+ if (dir && req->r_op == CEPH_MDS_OP_LOOKUPNAME &&
+ test_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags) &&
+ !test_bit(CEPH_MDS_R_ABORTED, &req->r_req_flags)) {
struct qstr dname;
struct dentry *dn, *parent;