aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.c
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/mds_client.c
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/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,
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.