diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 19b97b47b3c9cbc2e6d35ea9e44a663eb03d6bd7..f1c5691e8e2c4cd99347ab2da4434fc334dc0421 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -1457,6 +1457,12 @@ void ceph_flush_snaps(struct ceph_inode_info *ci, goto retry; } + // make sure flushsnap messages are sent in proper order. + if (ci->i_ceph_flags & CEPH_I_KICK_FLUSH) { + __kick_flushing_caps(mdsc, session, ci, 0); + ci->i_ceph_flags &= ~CEPH_I_KICK_FLUSH; + } + __ceph_flush_snaps(ci, session); out: spin_unlock(&ci->i_ceph_lock); @@ -1904,11 +1910,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags, (ci->i_ceph_flags & (CEPH_I_KICK_FLUSH | CEPH_I_FLUSH_SNAPS))) { if (ci->i_ceph_flags & CEPH_I_KICK_FLUSH) { - spin_lock(&mdsc->cap_dirty_lock); - oldest_flush_tid = __get_oldest_flush_tid(mdsc); - spin_unlock(&mdsc->cap_dirty_lock); - __kick_flushing_caps(mdsc, session, ci, - oldest_flush_tid); + __kick_flushing_caps(mdsc, session, ci, 0); ci->i_ceph_flags &= ~CEPH_I_KICK_FLUSH; } if (ci->i_ceph_flags & CEPH_I_FLUSH_SNAPS)