diff options
| -rw-r--r-- | net/ceph/osd_client.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 17d1d2a04a7a..a5fbb38086b6 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
| @@ -4492,6 +4492,23 @@ alloc_linger_request(struct ceph_osd_linger_request *lreq) | |||
| 4492 | return req; | 4492 | return req; |
| 4493 | } | 4493 | } |
| 4494 | 4494 | ||
| 4495 | static struct ceph_osd_request * | ||
| 4496 | alloc_watch_request(struct ceph_osd_linger_request *lreq, u8 watch_opcode) | ||
| 4497 | { | ||
| 4498 | struct ceph_osd_request *req; | ||
| 4499 | |||
| 4500 | req = alloc_linger_request(lreq); | ||
| 4501 | if (!req) | ||
| 4502 | return NULL; | ||
| 4503 | |||
| 4504 | /* | ||
| 4505 | * Pass 0 for cookie because we don't know it yet, it will be | ||
| 4506 | * filled in by linger_submit(). | ||
| 4507 | */ | ||
| 4508 | osd_req_op_watch_init(req, 0, 0, watch_opcode); | ||
| 4509 | return req; | ||
| 4510 | } | ||
| 4511 | |||
| 4495 | /* | 4512 | /* |
| 4496 | * Returns a handle, caller owns a ref. | 4513 | * Returns a handle, caller owns a ref. |
| 4497 | */ | 4514 | */ |
| @@ -4521,25 +4538,18 @@ ceph_osdc_watch(struct ceph_osd_client *osdc, | |||
| 4521 | lreq->t.flags = CEPH_OSD_FLAG_WRITE; | 4538 | lreq->t.flags = CEPH_OSD_FLAG_WRITE; |
| 4522 | ktime_get_real_ts64(&lreq->mtime); | 4539 | ktime_get_real_ts64(&lreq->mtime); |
| 4523 | 4540 | ||
| 4524 | lreq->reg_req = alloc_linger_request(lreq); | 4541 | lreq->reg_req = alloc_watch_request(lreq, CEPH_OSD_WATCH_OP_WATCH); |
| 4525 | if (!lreq->reg_req) { | 4542 | if (!lreq->reg_req) { |
| 4526 | ret = -ENOMEM; | 4543 | ret = -ENOMEM; |
| 4527 | goto err_put_lreq; | 4544 | goto err_put_lreq; |
| 4528 | } | 4545 | } |
| 4529 | 4546 | ||
| 4530 | lreq->ping_req = alloc_linger_request(lreq); | 4547 | lreq->ping_req = alloc_watch_request(lreq, CEPH_OSD_WATCH_OP_PING); |
| 4531 | if (!lreq->ping_req) { | 4548 | if (!lreq->ping_req) { |
| 4532 | ret = -ENOMEM; | 4549 | ret = -ENOMEM; |
| 4533 | goto err_put_lreq; | 4550 | goto err_put_lreq; |
| 4534 | } | 4551 | } |
| 4535 | 4552 | ||
| 4536 | /* | ||
| 4537 | * Pass 0 for cookie because we don't know it yet, it will be | ||
| 4538 | * filled in by linger_submit(). | ||
| 4539 | */ | ||
| 4540 | osd_req_op_watch_init(lreq->reg_req, 0, 0, CEPH_OSD_WATCH_OP_WATCH); | ||
| 4541 | osd_req_op_watch_init(lreq->ping_req, 0, 0, CEPH_OSD_WATCH_OP_PING); | ||
| 4542 | |||
| 4543 | linger_submit(lreq); | 4553 | linger_submit(lreq); |
| 4544 | ret = linger_reg_commit_wait(lreq); | 4554 | ret = linger_reg_commit_wait(lreq); |
| 4545 | if (ret) { | 4555 | if (ret) { |
