aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-01-25 14:33:08 -0500
committerSage Weil <sage@newdream.net>2010-01-25 14:49:51 -0500
commit5b1daecd59f95eb24dc629407ed80369c9929520 (patch)
tree19b5d4e11427350f48947df8dca453069ed0a0d5 /fs/ceph/mds_client.c
parent3ea25f9441fc0951ada649105f2c57a59536b539 (diff)
ceph: properly handle aborted mds requests
Previously, if the MDS request was interrupted, we would unregister the request and ignore any reply. This could cause the caps or other cache state to become out of sync. (For instance, aborting dbench and doing rm -r on clients would complain about a non-empty directory because the client didn't realize it's aborted file create request completed.) Even we don't unregister, we still can't process the reply normally because we are no longer holding the caller's locks (like the dir i_mutex). So, mark aborted operations with r_aborted, and in the reply handler, be sure to process all the caps. Do not process the namespace changes, though, since we no longer will hold the dir i_mutex. The dentry lease state can also be ignored as it's more forgiving. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r--fs/ceph/mds_client.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 6e08f488a30f..623c67cd484b 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1624,11 +1624,29 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
1624 err = PTR_ERR(req->r_reply); 1624 err = PTR_ERR(req->r_reply);
1625 req->r_reply = NULL; 1625 req->r_reply = NULL;
1626 1626
1627 /* clean up */ 1627 if (err == -ERESTARTSYS) {
1628 __unregister_request(mdsc, req); 1628 /* aborted */
1629 if (!list_empty(&req->r_unsafe_item)) 1629 req->r_aborted = true;
1630 list_del_init(&req->r_unsafe_item); 1630
1631 complete(&req->r_safe_completion); 1631 if (req->r_locked_dir &&
1632 (req->r_op & CEPH_MDS_OP_WRITE)) {
1633 struct ceph_inode_info *ci =
1634 ceph_inode(req->r_locked_dir);
1635
1636 dout("aborted, clearing I_COMPLETE on %p\n",
1637 req->r_locked_dir);
1638 spin_lock(&req->r_locked_dir->i_lock);
1639 ci->i_ceph_flags &= ~CEPH_I_COMPLETE;
1640 ci->i_release_count++;
1641 spin_unlock(&req->r_locked_dir->i_lock);
1642 }
1643 } else {
1644 /* clean up this request */
1645 __unregister_request(mdsc, req);
1646 if (!list_empty(&req->r_unsafe_item))
1647 list_del_init(&req->r_unsafe_item);
1648 complete(&req->r_safe_completion);
1649 }
1632 } else if (req->r_err) { 1650 } else if (req->r_err) {
1633 err = req->r_err; 1651 err = req->r_err;
1634 } else { 1652 } else {