aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-02-05 16:40:09 -0500
committerYan, Zheng <zheng.z.yan@intel.com>2014-04-02 22:33:53 -0400
commit844d87c3329980e2b1849cf53205d7fa965d8995 (patch)
tree46e524da39d068d18d03502323871099144dec4c
parent752c8bdcfe88f27a17c5c9264df928fd145a4b30 (diff)
ceph: do not assume r_old_dentry[_dir] always set together
Do not assume that r_old_dentry implies that r_old_dentry_dir is also true. Separate out the ref cleanup and make the debugs dump behave when it is NULL. Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Yan, Zheng <zheng.z.yan@intel.com>
-rw-r--r--fs/ceph/debugfs.c3
-rw-r--r--fs/ceph/mds_client.c7
2 files changed, 6 insertions, 4 deletions
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index 6d59006bfa27..8c6f313db3ea 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -102,7 +102,8 @@ static int mdsc_show(struct seq_file *s, void *p)
102 path = NULL; 102 path = NULL;
103 spin_lock(&req->r_old_dentry->d_lock); 103 spin_lock(&req->r_old_dentry->d_lock);
104 seq_printf(s, " #%llx/%.*s (%s)", 104 seq_printf(s, " #%llx/%.*s (%s)",
105 ceph_ino(req->r_old_dentry_dir), 105 req->r_old_dentry_dir ?
106 ceph_ino(req->r_old_dentry_dir) : 0,
106 req->r_old_dentry->d_name.len, 107 req->r_old_dentry->d_name.len,
107 req->r_old_dentry->d_name.name, 108 req->r_old_dentry->d_name.name,
108 path ? path : ""); 109 path ? path : "");
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index f4f050a69a48..f260bd8d61cd 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -528,7 +528,9 @@ void ceph_mdsc_release_request(struct kref *kref)
528 iput(req->r_target_inode); 528 iput(req->r_target_inode);
529 if (req->r_dentry) 529 if (req->r_dentry)
530 dput(req->r_dentry); 530 dput(req->r_dentry);
531 if (req->r_old_dentry) { 531 if (req->r_old_dentry)
532 dput(req->r_old_dentry);
533 if (req->r_old_dentry_dir) {
532 /* 534 /*
533 * track (and drop pins for) r_old_dentry_dir 535 * track (and drop pins for) r_old_dentry_dir
534 * separately, since r_old_dentry's d_parent may have 536 * separately, since r_old_dentry's d_parent may have
@@ -537,7 +539,6 @@ void ceph_mdsc_release_request(struct kref *kref)
537 */ 539 */
538 ceph_put_cap_refs(ceph_inode(req->r_old_dentry_dir), 540 ceph_put_cap_refs(ceph_inode(req->r_old_dentry_dir),
539 CEPH_CAP_PIN); 541 CEPH_CAP_PIN);
540 dput(req->r_old_dentry);
541 iput(req->r_old_dentry_dir); 542 iput(req->r_old_dentry_dir);
542 } 543 }
543 kfree(req->r_path1); 544 kfree(req->r_path1);
@@ -2053,7 +2054,7 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
2053 ceph_get_cap_refs(ceph_inode(req->r_inode), CEPH_CAP_PIN); 2054 ceph_get_cap_refs(ceph_inode(req->r_inode), CEPH_CAP_PIN);
2054 if (req->r_locked_dir) 2055 if (req->r_locked_dir)
2055 ceph_get_cap_refs(ceph_inode(req->r_locked_dir), CEPH_CAP_PIN); 2056 ceph_get_cap_refs(ceph_inode(req->r_locked_dir), CEPH_CAP_PIN);
2056 if (req->r_old_dentry) 2057 if (req->r_old_dentry_dir)
2057 ceph_get_cap_refs(ceph_inode(req->r_old_dentry_dir), 2058 ceph_get_cap_refs(ceph_inode(req->r_old_dentry_dir),
2058 CEPH_CAP_PIN); 2059 CEPH_CAP_PIN);
2059 2060