diff options
author | Yan, Zheng <zyan@redhat.com> | 2016-07-05 11:45:21 +0300 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-07-28 04:00:43 +0300 |
commit | 13c2b57d81ec27716b9c943fd4077264b9804e55 (patch) | |
tree | cc818793a1c35b548c4f57ec0dcf47c66fbc55bf /fs | |
parent | 0e2943878942aee7100c94d0d40c49087dac12cb (diff) | |
download | linux-13c2b57d81ec27716b9c943fd4077264b9804e55.tar.xz |
ceph: avoid sending duplicated cap flush message
make ceph_kick_flushing_caps() ignore inodes whose cap flushes
have already been re-sent by ceph_early_kick_flushing_caps()
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/caps.c | 18 | ||||
-rw-r--r-- | fs/ceph/super.h | 1 |
2 files changed, 18 insertions, 1 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 0ac604719663..f12d59d26a04 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -2107,8 +2107,11 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc, */ if ((cap->issued & ci->i_flushing_caps) != ci->i_flushing_caps) { + ci->i_ceph_flags &= ~CEPH_I_KICK_FLUSH; __kick_flushing_caps(mdsc, session, ci, oldest_flush_tid); + } else { + ci->i_ceph_flags |= CEPH_I_KICK_FLUSH; } spin_unlock(&ci->i_ceph_lock); @@ -2119,6 +2122,7 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, struct ceph_mds_session *session) { struct ceph_inode_info *ci; + struct ceph_cap *cap; u64 oldest_flush_tid; dout("kick_flushing_caps mds%d\n", session->s_mds); @@ -2129,7 +2133,18 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) { spin_lock(&ci->i_ceph_lock); - __kick_flushing_caps(mdsc, session, ci, oldest_flush_tid); + cap = ci->i_auth_cap; + if (!(cap && cap->session == session)) { + pr_err("%p auth cap %p not mds%d ???\n", + &ci->vfs_inode, cap, session->s_mds); + spin_unlock(&ci->i_ceph_lock); + continue; + } + if (ci->i_ceph_flags & CEPH_I_KICK_FLUSH) { + ci->i_ceph_flags &= ~CEPH_I_KICK_FLUSH; + __kick_flushing_caps(mdsc, session, ci, + oldest_flush_tid); + } spin_unlock(&ci->i_ceph_lock); } } @@ -2154,6 +2169,7 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, oldest_flush_tid = __get_oldest_flush_tid(mdsc); spin_unlock(&mdsc->cap_dirty_lock); + ci->i_ceph_flags &= ~CEPH_I_KICK_FLUSH; __kick_flushing_caps(mdsc, session, ci, oldest_flush_tid); spin_unlock(&ci->i_ceph_lock); } else { diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 08ed51299f9f..16068787afb4 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -468,6 +468,7 @@ static inline struct inode *ceph_find_inode(struct super_block *sb, #define CEPH_I_POOL_WR (1 << 6) /* can write to pool */ #define CEPH_I_SEC_INITED (1 << 7) /* security initialized */ #define CEPH_I_CAP_DROPPED (1 << 8) /* caps were forcibly dropped */ +#define CEPH_I_KICK_FLUSH (1 << 9) /* kick flushing caps */ static inline void __ceph_dir_set_complete(struct ceph_inode_info *ci, long long release_count, |