aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-05-14 13:02:57 -0400
committerSage Weil <sage@newdream.net>2010-05-17 18:25:40 -0400
commit167c9e352deb7e25568c926c49c3eafad69cbe76 (patch)
treeb420c256e60accca30704059ab676e878cf49603 /fs/ceph
parent85792d0dd6e7a7a18fba55c97e49871211b28fe0 (diff)
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')
-rw-r--r--fs/ceph/inode.c17
-rw-r--r--fs/ceph/mds_client.c39
-rw-r--r--fs/ceph/mds_client.h2
3 files changed, 27 insertions, 31 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 1bcf98bd0255..a81b8b662c7b 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -941,21 +941,8 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
941 941
942 if (!rinfo->head->is_target && !rinfo->head->is_dentry) { 942 if (!rinfo->head->is_target && !rinfo->head->is_dentry) {
943 dout("fill_trace reply is empty!\n"); 943 dout("fill_trace reply is empty!\n");
944 if (rinfo->head->result == 0 && req->r_locked_dir) { 944 if (rinfo->head->result == 0 && req->r_locked_dir)
945 struct ceph_inode_info *ci = 945 ceph_invalidate_dir_request(req);
946 ceph_inode(req->r_locked_dir);
947 dout(" clearing %p complete (empty trace)\n",
948 req->r_locked_dir);
949 spin_lock(&req->r_locked_dir->i_lock);
950 ci->i_ceph_flags &= ~CEPH_I_COMPLETE;
951 ci->i_release_count++;
952 spin_unlock(&req->r_locked_dir->i_lock);
953
954 if (req->r_dentry)
955 ceph_invalidate_dentry_lease(req->r_dentry);
956 if (req->r_old_dentry)
957 ceph_invalidate_dentry_lease(req->r_old_dentry);
958 }
959 return 0; 946 return 0;
960 } 947 }
961 948
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,
1794 mutex_unlock(&req->r_fill_mutex); 1794 mutex_unlock(&req->r_fill_mutex);
1795 1795
1796 if (req->r_locked_dir && 1796 if (req->r_locked_dir &&
1797 (req->r_op & CEPH_MDS_OP_WRITE)) { 1797 (req->r_op & CEPH_MDS_OP_WRITE))
1798 struct ceph_inode_info *ci = 1798 ceph_invalidate_dir_request(req);
1799 ceph_inode(req->r_locked_dir);
1800
1801 dout("aborted, clearing I_COMPLETE on %p, leases\n",
1802 req->r_locked_dir);
1803 spin_lock(&req->r_locked_dir->i_lock);
1804 ci->i_ceph_flags &= ~CEPH_I_COMPLETE;
1805 ci->i_release_count++;
1806 spin_unlock(&req->r_locked_dir->i_lock);
1807
1808 if (req->r_dentry)
1809 ceph_invalidate_dentry_lease(req->r_dentry);
1810 if (req->r_old_dentry)
1811 ceph_invalidate_dentry_lease(req->r_old_dentry);
1812 }
1813 } else { 1799 } else {
1814 err = req->r_err; 1800 err = req->r_err;
1815 } 1801 }
@@ -1821,6 +1807,27 @@ out:
1821} 1807}
1822 1808
1823/* 1809/*
1810 * Invalidate dir I_COMPLETE, dentry lease state on an aborted MDS
1811 * namespace request.
1812 */
1813void ceph_invalidate_dir_request(struct ceph_mds_request *req)
1814{
1815 struct inode *inode = req->r_locked_dir;
1816 struct ceph_inode_info *ci = ceph_inode(inode);
1817
1818 dout("invalidate_dir_request %p (I_COMPLETE, lease(s))\n", inode);
1819 spin_lock(&inode->i_lock);
1820 ci->i_ceph_flags &= ~CEPH_I_COMPLETE;
1821 ci->i_release_count++;
1822 spin_unlock(&inode->i_lock);
1823
1824 if (req->r_dentry)
1825 ceph_invalidate_dentry_lease(req->r_dentry);
1826 if (req->r_old_dentry)
1827 ceph_invalidate_dentry_lease(req->r_old_dentry);
1828}
1829
1830/*
1824 * Handle mds reply. 1831 * Handle mds reply.
1825 * 1832 *
1826 * We take the session mutex and parse and process the reply immediately. 1833 * We take the session mutex and parse and process the reply immediately.
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
index 141a265bda75..d9936c4f1212 100644
--- a/fs/ceph/mds_client.h
+++ b/fs/ceph/mds_client.h
@@ -303,6 +303,8 @@ extern void ceph_mdsc_lease_release(struct ceph_mds_client *mdsc,
303 struct inode *inode, 303 struct inode *inode,
304 struct dentry *dn, int mask); 304 struct dentry *dn, int mask);
305 305
306extern void ceph_invalidate_dir_request(struct ceph_mds_request *req);
307
306extern struct ceph_mds_request * 308extern struct ceph_mds_request *
307ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode); 309ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode);
308extern void ceph_mdsc_submit_request(struct ceph_mds_client *mdsc, 310extern void ceph_mdsc_submit_request(struct ceph_mds_client *mdsc,