Skip to content

Commit 4cf9d54

Browse files
committed
libceph: don't time out osd requests that haven't been received
Keep track of when an outgoing message is ACKed (i.e., the server fully received it and, presumably, queued it for processing). Time out OSD requests only if it's been too long since they've been received. This prevents timeouts and connection thrashing when the OSDs are simply busy and are throttling the requests they read off the network. Reviewed-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
1 parent 8f04d42 commit 4cf9d54

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

‎include/linux/ceph/messenger.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct ceph_msg {
9494
bool more_to_follow;
9595
bool needs_out_seq;
9696
int front_max;
97+
unsigned long ack_stamp; /* tx: when we were acked */
9798

9899
struct ceph_msgpool *pool;
99100
};

‎net/ceph/messenger.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,10 @@ static void prepare_write_message(struct ceph_connection *con)
486486
m = list_first_entry(&con->out_queue,
487487
struct ceph_msg, list_head);
488488
con->out_msg = m;
489-
if (test_bit(LOSSYTX, &con->state)) {
490-
list_del_init(&m->list_head);
491-
} else {
492-
/* put message on sent list */
493-
ceph_msg_get(m);
494-
list_move_tail(&m->list_head, &con->out_sent);
495-
}
489+
490+
/* put message on sent list */
491+
ceph_msg_get(m);
492+
list_move_tail(&m->list_head, &con->out_sent);
496493

497494
/*
498495
* only assign outgoing seq # if we haven't sent this message
@@ -1399,6 +1396,7 @@ static void process_ack(struct ceph_connection *con)
13991396
break;
14001397
dout("got ack for seq %llu type %d at %p\n", seq,
14011398
le16_to_cpu(m->hdr.type), m);
1399+
m->ack_stamp = jiffies;
14021400
ceph_msg_remove(m);
14031401
}
14041402
prepare_read_tag(con);

‎net/ceph/osd_client.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,9 +1085,15 @@ static void handle_timeout(struct work_struct *work)
10851085
req = list_entry(osdc->req_lru.next, struct ceph_osd_request,
10861086
r_req_lru_item);
10871087

1088+
/* hasn't been long enough since we sent it? */
10881089
if (time_before(jiffies, req->r_stamp + timeout))
10891090
break;
10901091

1092+
/* hasn't been long enough since it was acked? */
1093+
if (req->r_request->ack_stamp == 0 ||
1094+
time_before(jiffies, req->r_request->ack_stamp + timeout))
1095+
break;
1096+
10911097
BUG_ON(req == last_req && req->r_stamp == last_stamp);
10921098
last_req = req;
10931099
last_stamp = req->r_stamp;

0 commit comments

Comments
 (0)