Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347556
b: refs/heads/master
c: 802c6d9
h: refs/heads/master
v: v3
  • Loading branch information
Alex Elder committed Oct 10, 2012
1 parent ef9e7a5 commit dce650d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8618e30bc14b06bfafa0f164cca7b0e06451f88a
refs/heads/master: 802c6d967fbdcd2cbc91b917425661bb8bbfaade
38 changes: 23 additions & 15 deletions trunk/net/ceph/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -2244,22 +2244,33 @@ static int try_read(struct ceph_connection *con)


/*
* Atomically queue work on a connection. Bump @con reference to
* avoid races with connection teardown.
* Atomically queue work on a connection after the specified delay.
* Bump @con reference to avoid races with connection teardown.
* Returns 0 if work was queued, or an error code otherwise.
*/
static void queue_con(struct ceph_connection *con)
static int queue_con_delay(struct ceph_connection *con, unsigned long delay)
{
if (!con->ops->get(con)) {
dout("queue_con %p ref count 0\n", con);
return;
dout("%s %p ref count 0\n", __func__, con);

return -ENOENT;
}

if (!queue_delayed_work(ceph_msgr_wq, &con->work, 0)) {
dout("queue_con %p - already queued\n", con);
if (!queue_delayed_work(ceph_msgr_wq, &con->work, delay)) {
dout("%s %p - already queued\n", __func__, con);
con->ops->put(con);
} else {
dout("queue_con %p\n", con);

return -EBUSY;
}

dout("%s %p %lu\n", __func__, con, delay);

return 0;
}

static void queue_con(struct ceph_connection *con)
{
(void) queue_con_delay(con, 0);
}

/*
Expand Down Expand Up @@ -2294,14 +2305,11 @@ static void con_work(struct work_struct *work)

if (test_and_clear_bit(CON_FLAG_BACKOFF, &con->flags)) {
dout("con_work %p backing off\n", con);
if (queue_delayed_work(ceph_msgr_wq, &con->work,
round_jiffies_relative(con->delay))) {
dout("con_work %p backoff %lu\n", con, con->delay);
mutex_unlock(&con->mutex);
return;
} else {
ret = queue_con_delay(con, round_jiffies_relative(con->delay));
if (ret) {
dout("con_work %p FAILED to back off %lu\n", con,
con->delay);
BUG_ON(ret == -ENOENT);
set_bit(CON_FLAG_BACKOFF, &con->flags);
}
goto done;
Expand Down

0 comments on commit dce650d

Please sign in to comment.