Commit d6cee9db authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

ceph: kick flushing and flush snaps before sending normal cap message

Otherwise client may send cap flush messages in wrong order.
Signed-off-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 054f8d41
...@@ -2119,6 +2119,7 @@ static int try_flush_caps(struct inode *inode, u64 *ptid) ...@@ -2119,6 +2119,7 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
retry: retry:
spin_lock(&ci->i_ceph_lock); spin_lock(&ci->i_ceph_lock);
retry_locked:
if (ci->i_ceph_flags & CEPH_I_NOFLUSH) { if (ci->i_ceph_flags & CEPH_I_NOFLUSH) {
spin_unlock(&ci->i_ceph_lock); spin_unlock(&ci->i_ceph_lock);
dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode); dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode);
...@@ -2126,8 +2127,6 @@ static int try_flush_caps(struct inode *inode, u64 *ptid) ...@@ -2126,8 +2127,6 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
} }
if (ci->i_dirty_caps && ci->i_auth_cap) { if (ci->i_dirty_caps && ci->i_auth_cap) {
struct ceph_cap *cap = ci->i_auth_cap; struct ceph_cap *cap = ci->i_auth_cap;
int used = __ceph_caps_used(ci);
int want = __ceph_caps_wanted(ci);
int delayed; int delayed;
if (!session || session != cap->session) { if (!session || session != cap->session) {
...@@ -2143,13 +2142,24 @@ static int try_flush_caps(struct inode *inode, u64 *ptid) ...@@ -2143,13 +2142,24 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
goto out; goto out;
} }
if (ci->i_ceph_flags &
(CEPH_I_KICK_FLUSH | CEPH_I_FLUSH_SNAPS)) {
if (ci->i_ceph_flags & CEPH_I_KICK_FLUSH)
__kick_flushing_caps(mdsc, session, ci, 0);
if (ci->i_ceph_flags & CEPH_I_FLUSH_SNAPS)
__ceph_flush_snaps(ci, session);
goto retry_locked;
}
flushing = __mark_caps_flushing(inode, session, true, flushing = __mark_caps_flushing(inode, session, true,
&flush_tid, &oldest_flush_tid); &flush_tid, &oldest_flush_tid);
/* __send_cap drops i_ceph_lock */ /* __send_cap drops i_ceph_lock */
delayed = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH, true, delayed = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH, true,
used, want, (cap->issued | cap->implemented), __ceph_caps_used(ci),
flushing, flush_tid, oldest_flush_tid); __ceph_caps_wanted(ci),
(cap->issued | cap->implemented),
flushing, flush_tid, oldest_flush_tid);
if (delayed) { if (delayed) {
spin_lock(&ci->i_ceph_lock); spin_lock(&ci->i_ceph_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment