summaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-05-14 19:02:57 +0200
committerSage Weil <sage@newdream.net>2010-05-18 00:25:40 +0200
commit167c9e352deb7e25568c926c49c3eafad69cbe76 (patch)
treeb420c256e60accca30704059ab676e878cf49603 /fs/ceph/mds_client.c
parentceph: cope with out of order (unsafe after safe) mds reply (diff)
downloadlinux-167c9e352deb7e25568c926c49c3eafad69cbe76.tar.xz
linux-167c9e352deb7e25568c926c49c3eafad69cbe76.zip
ceph: use common helper for aborted dir request invalidation
We invalidate I_COMPLETE and dentry leases in two places: on aborted mds request and on request replay. Use common helper to avoid duplicate code. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r--fs/ceph/mds_client.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 40dd437a26a9..5c17ab44d02d 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1794,22 +1794,8 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
mutex_unlock(&req->r_fill_mutex);
if (req->r_locked_dir &&
- (req->r_op & CEPH_MDS_OP_WRITE)) {
- struct ceph_inode_info *ci =
- ceph_inode(req->r_locked_dir);
-
- dout("aborted, clearing I_COMPLETE on %p, leases\n",
- req->r_locked_dir);
- spin_lock(&req->r_locked_dir->i_lock);
- ci->i_ceph_flags &= ~CEPH_I_COMPLETE;
- ci->i_release_count++;
- spin_unlock(&req->r_locked_dir->i_lock);
-
- if (req->r_dentry)
- ceph_invalidate_dentry_lease(req->r_dentry);
- if (req->r_old_dentry)
- ceph_invalidate_dentry_lease(req->r_old_dentry);
- }
+ (req->r_op & CEPH_MDS_OP_WRITE))
+ ceph_invalidate_dir_request(req);
} else {
err = req->r_err;
}
@@ -1821,6 +1807,27 @@ out:
}
/*
+ * Invalidate dir I_COMPLETE, dentry lease state on an aborted MDS
+ * namespace request.
+ */
+void ceph_invalidate_dir_request(struct ceph_mds_request *req)
+{
+ struct inode *inode = req->r_locked_dir;
+ struct ceph_inode_info *ci = ceph_inode(inode);
+
+ dout("invalidate_dir_request %p (I_COMPLETE, lease(s))\n", inode);
+ spin_lock(&inode->i_lock);
+ ci->i_ceph_flags &= ~CEPH_I_COMPLETE;
+ ci->i_release_count++;
+ spin_unlock(&inode->i_lock);
+
+ if (req->r_dentry)
+ ceph_invalidate_dentry_lease(req->r_dentry);
+ if (req->r_old_dentry)
+ ceph_invalidate_dentry_lease(req->r_old_dentry);
+}
+
+/*
* Handle mds reply.
*
* We take the session mutex and parse and process the reply immediately.