diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-04-04 07:09:15 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:45:11 -0500 |
commit | 859976758dc6f33ed76c21365bb49a4af9e2dd59 (patch) | |
tree | 6191b6b184bce0c28164f881351cb1ac5a70817e /drivers/block/drbd/drbd_receiver.c | |
parent | b55d84ba17e90491ac2046583327d4756159efd6 (diff) |
drbd: validate_req_change_req_state(): Return 0 upon success and an error code otherwise
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_receiver.c')
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index f846e55c1740..cf816b79278d 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -4587,14 +4587,14 @@ validate_req_change_req_state(struct drbd_conf *mdev, u64 id, sector_t sector, | |||
4587 | req = find_request(mdev, root, id, sector, missing_ok, func); | 4587 | req = find_request(mdev, root, id, sector, missing_ok, func); |
4588 | if (unlikely(!req)) { | 4588 | if (unlikely(!req)) { |
4589 | spin_unlock_irq(&mdev->tconn->req_lock); | 4589 | spin_unlock_irq(&mdev->tconn->req_lock); |
4590 | return false; | 4590 | return -EIO; |
4591 | } | 4591 | } |
4592 | __req_mod(req, what, &m); | 4592 | __req_mod(req, what, &m); |
4593 | spin_unlock_irq(&mdev->tconn->req_lock); | 4593 | spin_unlock_irq(&mdev->tconn->req_lock); |
4594 | 4594 | ||
4595 | if (m.bio) | 4595 | if (m.bio) |
4596 | complete_master_bio(mdev, &m); | 4596 | complete_master_bio(mdev, &m); |
4597 | return true; | 4597 | return 0; |
4598 | } | 4598 | } |
4599 | 4599 | ||
4600 | static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi) | 4600 | static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi) |
@@ -4642,9 +4642,9 @@ static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi) | |||
4642 | return false; | 4642 | return false; |
4643 | } | 4643 | } |
4644 | 4644 | ||
4645 | return validate_req_change_req_state(mdev, p->block_id, sector, | 4645 | return !validate_req_change_req_state(mdev, p->block_id, sector, |
4646 | &mdev->write_requests, __func__, | 4646 | &mdev->write_requests, __func__, |
4647 | what, false); | 4647 | what, false); |
4648 | } | 4648 | } |
4649 | 4649 | ||
4650 | static int got_NegAck(struct drbd_tconn *tconn, struct packet_info *pi) | 4650 | static int got_NegAck(struct drbd_tconn *tconn, struct packet_info *pi) |
@@ -4655,7 +4655,7 @@ static int got_NegAck(struct drbd_tconn *tconn, struct packet_info *pi) | |||
4655 | int size = be32_to_cpu(p->blksize); | 4655 | int size = be32_to_cpu(p->blksize); |
4656 | bool missing_ok = tconn->net_conf->wire_protocol == DRBD_PROT_A || | 4656 | bool missing_ok = tconn->net_conf->wire_protocol == DRBD_PROT_A || |
4657 | tconn->net_conf->wire_protocol == DRBD_PROT_B; | 4657 | tconn->net_conf->wire_protocol == DRBD_PROT_B; |
4658 | bool found; | 4658 | int err; |
4659 | 4659 | ||
4660 | mdev = vnr_to_mdev(tconn, pi->vnr); | 4660 | mdev = vnr_to_mdev(tconn, pi->vnr); |
4661 | if (!mdev) | 4661 | if (!mdev) |
@@ -4669,10 +4669,10 @@ static int got_NegAck(struct drbd_tconn *tconn, struct packet_info *pi) | |||
4669 | return true; | 4669 | return true; |
4670 | } | 4670 | } |
4671 | 4671 | ||
4672 | found = validate_req_change_req_state(mdev, p->block_id, sector, | 4672 | err = validate_req_change_req_state(mdev, p->block_id, sector, |
4673 | &mdev->write_requests, __func__, | 4673 | &mdev->write_requests, __func__, |
4674 | NEG_ACKED, missing_ok); | 4674 | NEG_ACKED, missing_ok); |
4675 | if (!found) { | 4675 | if (err) { |
4676 | /* Protocol A has no P_WRITE_ACKs, but has P_NEG_ACKs. | 4676 | /* Protocol A has no P_WRITE_ACKs, but has P_NEG_ACKs. |
4677 | The master bio might already be completed, therefore the | 4677 | The master bio might already be completed, therefore the |
4678 | request is no longer in the collision hash. */ | 4678 | request is no longer in the collision hash. */ |
@@ -4700,9 +4700,9 @@ static int got_NegDReply(struct drbd_tconn *tconn, struct packet_info *pi) | |||
4700 | dev_err(DEV, "Got NegDReply; Sector %llus, len %u; Fail original request.\n", | 4700 | dev_err(DEV, "Got NegDReply; Sector %llus, len %u; Fail original request.\n", |
4701 | (unsigned long long)sector, be32_to_cpu(p->blksize)); | 4701 | (unsigned long long)sector, be32_to_cpu(p->blksize)); |
4702 | 4702 | ||
4703 | return validate_req_change_req_state(mdev, p->block_id, sector, | 4703 | return !validate_req_change_req_state(mdev, p->block_id, sector, |
4704 | &mdev->read_requests, __func__, | 4704 | &mdev->read_requests, __func__, |
4705 | NEG_ACKED, false); | 4705 | NEG_ACKED, false); |
4706 | } | 4706 | } |
4707 | 4707 | ||
4708 | static int got_NegRSDReply(struct drbd_tconn *tconn, struct packet_info *pi) | 4708 | static int got_NegRSDReply(struct drbd_tconn *tconn, struct packet_info *pi) |