Skip to content

Commit 92e57e6

Browse files
ukernelidryomov
authored andcommitted
ceph: don't re-send interrupted flock request
Don't re-send interrupted flock request in cases of mds failover and receiving request forward. Because corresponding 'lock intr' request may have been finished, it won't get re-sent. Link: http://tracker.ceph.com/issues/20170 Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 4398688 commit 92e57e6

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

‎fs/ceph/locks.c‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,29 @@ static int ceph_lock_wait_for_completion(struct ceph_mds_client *mdsc,
127127
dout("ceph_lock_wait_for_completion: request %llu was interrupted\n",
128128
req->r_tid);
129129

130+
mutex_lock(&mdsc->mutex);
131+
if (test_bit(CEPH_MDS_R_GOT_RESULT, &req->r_req_flags)) {
132+
err = 0;
133+
} else {
134+
/*
135+
* ensure we aren't running concurrently with
136+
* ceph_fill_trace or ceph_readdir_prepopulate, which
137+
* rely on locks (dir mutex) held by our caller.
138+
*/
139+
mutex_lock(&req->r_fill_mutex);
140+
req->r_err = err;
141+
set_bit(CEPH_MDS_R_ABORTED, &req->r_req_flags);
142+
mutex_unlock(&req->r_fill_mutex);
143+
144+
if (!req->r_session) {
145+
// haven't sent the request
146+
err = 0;
147+
}
148+
}
149+
mutex_unlock(&mdsc->mutex);
150+
if (!err)
151+
return 0;
152+
130153
intr_req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_SETFILELOCK,
131154
USE_AUTH_MDS);
132155
if (IS_ERR(intr_req))
@@ -146,7 +169,7 @@ static int ceph_lock_wait_for_completion(struct ceph_mds_client *mdsc,
146169
if (err && err != -ERESTARTSYS)
147170
return err;
148171

149-
wait_for_completion(&req->r_completion);
172+
wait_for_completion_killable(&req->r_safe_completion);
150173
return 0;
151174
}
152175

0 commit comments

Comments
 (0)