aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r--fs/ceph/mds_client.c69
1 files changed, 34 insertions, 35 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 7da836909abb..739093f281d0 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -400,41 +400,40 @@ static void put_request_session(struct ceph_mds_request *req)
400 } 400 }
401} 401}
402 402
403void ceph_mdsc_put_request(struct ceph_mds_request *req) 403void ceph_mdsc_release_request(struct kref *kref)
404{ 404{
405 dout("mdsc put_request %p %d -> %d\n", req, 405 struct ceph_mds_request *req = container_of(kref,
406 atomic_read(&req->r_ref), atomic_read(&req->r_ref)-1); 406 struct ceph_mds_request,
407 if (atomic_dec_and_test(&req->r_ref)) { 407 r_kref);
408 if (req->r_request) 408 if (req->r_request)
409 ceph_msg_put(req->r_request); 409 ceph_msg_put(req->r_request);
410 if (req->r_reply) { 410 if (req->r_reply) {
411 ceph_msg_put(req->r_reply); 411 ceph_msg_put(req->r_reply);
412 destroy_reply_info(&req->r_reply_info); 412 destroy_reply_info(&req->r_reply_info);
413 } 413 }
414 if (req->r_inode) { 414 if (req->r_inode) {
415 ceph_put_cap_refs(ceph_inode(req->r_inode), 415 ceph_put_cap_refs(ceph_inode(req->r_inode),
416 CEPH_CAP_PIN); 416 CEPH_CAP_PIN);
417 iput(req->r_inode); 417 iput(req->r_inode);
418 } 418 }
419 if (req->r_locked_dir) 419 if (req->r_locked_dir)
420 ceph_put_cap_refs(ceph_inode(req->r_locked_dir), 420 ceph_put_cap_refs(ceph_inode(req->r_locked_dir),
421 CEPH_CAP_PIN); 421 CEPH_CAP_PIN);
422 if (req->r_target_inode) 422 if (req->r_target_inode)
423 iput(req->r_target_inode); 423 iput(req->r_target_inode);
424 if (req->r_dentry) 424 if (req->r_dentry)
425 dput(req->r_dentry); 425 dput(req->r_dentry);
426 if (req->r_old_dentry) { 426 if (req->r_old_dentry) {
427 ceph_put_cap_refs( 427 ceph_put_cap_refs(
428 ceph_inode(req->r_old_dentry->d_parent->d_inode), 428 ceph_inode(req->r_old_dentry->d_parent->d_inode),
429 CEPH_CAP_PIN); 429 CEPH_CAP_PIN);
430 dput(req->r_old_dentry); 430 dput(req->r_old_dentry);
431 }
432 kfree(req->r_path1);
433 kfree(req->r_path2);
434 put_request_session(req);
435 ceph_unreserve_caps(&req->r_caps_reservation);
436 kfree(req);
437 } 431 }
432 kfree(req->r_path1);
433 kfree(req->r_path2);
434 put_request_session(req);
435 ceph_unreserve_caps(&req->r_caps_reservation);
436 kfree(req);
438} 437}
439 438
440/* 439/*
@@ -1097,7 +1096,7 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
1097 req->r_resend_mds = -1; 1096 req->r_resend_mds = -1;
1098 INIT_LIST_HEAD(&req->r_unsafe_dir_item); 1097 INIT_LIST_HEAD(&req->r_unsafe_dir_item);
1099 req->r_fmode = -1; 1098 req->r_fmode = -1;
1100 atomic_set(&req->r_ref, 1); /* one for request_tree, one for caller */ 1099 kref_init(&req->r_kref);
1101 INIT_LIST_HEAD(&req->r_wait); 1100 INIT_LIST_HEAD(&req->r_wait);
1102 init_completion(&req->r_completion); 1101 init_completion(&req->r_completion);
1103 init_completion(&req->r_safe_completion); 1102 init_completion(&req->r_safe_completion);