aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2016-07-07 06:34:45 -0400
committerIlya Dryomov <idryomov@gmail.com>2016-07-27 21:00:44 -0400
commit7bc00fddb9de7f78f742bc24d95e15abde15c078 (patch)
tree2432ff3373fdebe08deb790540bf0df7b8403bd3
parent70220ac8c220495b2a335868293be80a31dfdd4a (diff)
ceph: kick cap flushes before sending other cap message
If ceph_check_caps() wants to send cap message to a recovering MDS, make sure it kicks cap flushes first. Signed-off-by: Yan, Zheng <zyan@redhat.com>
-rw-r--r--fs/ceph/caps.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 45fe7a3658dc..39e471d0aa50 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -41,6 +41,10 @@
41 */ 41 */
42 42
43static u64 __get_oldest_flush_tid(struct ceph_mds_client *mdsc); 43static u64 __get_oldest_flush_tid(struct ceph_mds_client *mdsc);
44static void __kick_flushing_caps(struct ceph_mds_client *mdsc,
45 struct ceph_mds_session *session,
46 struct ceph_inode_info *ci,
47 u64 oldest_flush_tid);
44 48
45/* 49/*
46 * Generate readable cap strings for debugging output. 50 * Generate readable cap strings for debugging output.
@@ -1563,11 +1567,6 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
1563 if (ci->i_ceph_flags & CEPH_I_FLUSH) 1567 if (ci->i_ceph_flags & CEPH_I_FLUSH)
1564 flags |= CHECK_CAPS_FLUSH; 1568 flags |= CHECK_CAPS_FLUSH;
1565 1569
1566 /* flush snaps first time around only */
1567 if (ci->i_ceph_flags & CEPH_I_FLUSH_SNAPS) {
1568 __ceph_flush_snaps(ci, &session);
1569 ci->i_ceph_flags &= ~CEPH_I_FLUSH_SNAPS;
1570 }
1571 goto retry_locked; 1570 goto retry_locked;
1572retry: 1571retry:
1573 spin_lock(&ci->i_ceph_lock); 1572 spin_lock(&ci->i_ceph_lock);
@@ -1688,10 +1687,15 @@ retry_locked:
1688 } 1687 }
1689 } 1688 }
1690 /* flush anything dirty? */ 1689 /* flush anything dirty? */
1691 if (cap == ci->i_auth_cap && (flags & CHECK_CAPS_FLUSH) && 1690 if (cap == ci->i_auth_cap) {
1692 ci->i_dirty_caps) { 1691 if ((flags & CHECK_CAPS_FLUSH) && ci->i_dirty_caps) {
1693 dout("flushing dirty caps\n"); 1692 dout("flushing dirty caps\n");
1694 goto ack; 1693 goto ack;
1694 }
1695 if (ci->i_ceph_flags & CEPH_I_FLUSH_SNAPS) {
1696 dout("flushing snap caps\n");
1697 goto ack;
1698 }
1695 } 1699 }
1696 1700
1697 /* completed revocation? going down and there are no caps? */ 1701 /* completed revocation? going down and there are no caps? */
@@ -1750,6 +1754,27 @@ ack:
1750 goto retry; 1754 goto retry;
1751 } 1755 }
1752 } 1756 }
1757
1758 /* kick flushing and flush snaps before sending normal
1759 * cap message */
1760 if (cap == ci->i_auth_cap &&
1761 (ci->i_ceph_flags &
1762 (CEPH_I_KICK_FLUSH | CEPH_I_FLUSH_SNAPS))) {
1763 if (ci->i_ceph_flags & CEPH_I_KICK_FLUSH) {
1764 spin_lock(&mdsc->cap_dirty_lock);
1765 oldest_flush_tid = __get_oldest_flush_tid(mdsc);
1766 spin_unlock(&mdsc->cap_dirty_lock);
1767 __kick_flushing_caps(mdsc, session, ci,
1768 oldest_flush_tid);
1769 ci->i_ceph_flags &= ~CEPH_I_KICK_FLUSH;
1770 }
1771 if (ci->i_ceph_flags & CEPH_I_FLUSH_SNAPS) {
1772 __ceph_flush_snaps(ci, &session);
1773 ci->i_ceph_flags &= ~CEPH_I_FLUSH_SNAPS;
1774 }
1775 goto retry_locked;
1776 }
1777
1753 /* take snap_rwsem after session mutex */ 1778 /* take snap_rwsem after session mutex */
1754 if (!took_snap_rwsem) { 1779 if (!took_snap_rwsem) {
1755 if (down_read_trylock(&mdsc->snap_rwsem) == 0) { 1780 if (down_read_trylock(&mdsc->snap_rwsem) == 0) {