Commit 85997675 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: validate_req_change_req_state(): Return 0 upon success and an error code otherwise

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent b55d84ba
...@@ -4587,14 +4587,14 @@ validate_req_change_req_state(struct drbd_conf *mdev, u64 id, sector_t sector, ...@@ -4587,14 +4587,14 @@ validate_req_change_req_state(struct drbd_conf *mdev, u64 id, sector_t sector,
req = find_request(mdev, root, id, sector, missing_ok, func); req = find_request(mdev, root, id, sector, missing_ok, func);
if (unlikely(!req)) { if (unlikely(!req)) {
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
return false; return -EIO;
} }
__req_mod(req, what, &m); __req_mod(req, what, &m);
spin_unlock_irq(&mdev->tconn->req_lock); spin_unlock_irq(&mdev->tconn->req_lock);
if (m.bio) if (m.bio)
complete_master_bio(mdev, &m); complete_master_bio(mdev, &m);
return true; return 0;
} }
static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi) static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi)
...@@ -4642,7 +4642,7 @@ static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi) ...@@ -4642,7 +4642,7 @@ static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi)
return false; return false;
} }
return validate_req_change_req_state(mdev, p->block_id, sector, return !validate_req_change_req_state(mdev, p->block_id, sector,
&mdev->write_requests, __func__, &mdev->write_requests, __func__,
what, false); what, false);
} }
...@@ -4655,7 +4655,7 @@ 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)
int size = be32_to_cpu(p->blksize); int size = be32_to_cpu(p->blksize);
bool missing_ok = tconn->net_conf->wire_protocol == DRBD_PROT_A || bool missing_ok = tconn->net_conf->wire_protocol == DRBD_PROT_A ||
tconn->net_conf->wire_protocol == DRBD_PROT_B; tconn->net_conf->wire_protocol == DRBD_PROT_B;
bool found; int err;
mdev = vnr_to_mdev(tconn, pi->vnr); mdev = vnr_to_mdev(tconn, pi->vnr);
if (!mdev) if (!mdev)
...@@ -4669,10 +4669,10 @@ static int got_NegAck(struct drbd_tconn *tconn, struct packet_info *pi) ...@@ -4669,10 +4669,10 @@ static int got_NegAck(struct drbd_tconn *tconn, struct packet_info *pi)
return true; return true;
} }
found = validate_req_change_req_state(mdev, p->block_id, sector, err = validate_req_change_req_state(mdev, p->block_id, sector,
&mdev->write_requests, __func__, &mdev->write_requests, __func__,
NEG_ACKED, missing_ok); NEG_ACKED, missing_ok);
if (!found) { if (err) {
/* Protocol A has no P_WRITE_ACKs, but has P_NEG_ACKs. /* Protocol A has no P_WRITE_ACKs, but has P_NEG_ACKs.
The master bio might already be completed, therefore the The master bio might already be completed, therefore the
request is no longer in the collision hash. */ request is no longer in the collision hash. */
...@@ -4700,7 +4700,7 @@ static int got_NegDReply(struct drbd_tconn *tconn, struct packet_info *pi) ...@@ -4700,7 +4700,7 @@ static int got_NegDReply(struct drbd_tconn *tconn, struct packet_info *pi)
dev_err(DEV, "Got NegDReply; Sector %llus, len %u; Fail original request.\n", dev_err(DEV, "Got NegDReply; Sector %llus, len %u; Fail original request.\n",
(unsigned long long)sector, be32_to_cpu(p->blksize)); (unsigned long long)sector, be32_to_cpu(p->blksize));
return validate_req_change_req_state(mdev, p->block_id, sector, return !validate_req_change_req_state(mdev, p->block_id, sector,
&mdev->read_requests, __func__, &mdev->read_requests, __func__,
NEG_ACKED, false); NEG_ACKED, false);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment