Skip to content

Commit

Permalink
drbd: drbd_send_protocol(): Return 0 upon success and an error code o…
Browse files Browse the repository at this point in the history
…therwise

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
  • Loading branch information
Andreas Gruenbacher authored and Philipp Reisner committed Nov 8, 2012
1 parent e8d17b0 commit 387eb30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions drivers/block/drbd/drbd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ int drbd_send_sync_param(struct drbd_conf *mdev)
int drbd_send_protocol(struct drbd_tconn *tconn)
{
struct p_protocol *p;
int size, cf, rv;
int size, cf, err;

size = sizeof(struct p_protocol);

Expand All @@ -836,7 +836,7 @@ int drbd_send_protocol(struct drbd_tconn *tconn)
* as that is blocked during handshake */
p = kmalloc(size, GFP_NOIO);
if (p == NULL)
return 0;
return -ENOMEM;

p->protocol = cpu_to_be32(tconn->net_conf->wire_protocol);
p->after_sb_0p = cpu_to_be32(tconn->net_conf->after_sb_0p);
Expand All @@ -853,17 +853,17 @@ int drbd_send_protocol(struct drbd_tconn *tconn)
else {
conn_err(tconn, "--dry-run is not supported by peer");
kfree(p);
return -1;
return -EOPNOTSUPP;
}
}
p->conn_flags = cpu_to_be32(cf);

if (tconn->agreed_pro_version >= 87)
strcpy(p->integrity_alg, tconn->net_conf->integrity_alg);

rv = !conn_send_cmd2(tconn, P_PROTOCOL, p->head.payload, size - sizeof(struct p_header));
err = conn_send_cmd2(tconn, P_PROTOCOL, p->head.payload, size - sizeof(struct p_header));
kfree(p);
return rv;
return err;
}

int _drbd_send_uuids(struct drbd_conf *mdev, u64 uuid_flags)
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ static int drbd_connect(struct drbd_tconn *tconn)

drbd_thread_start(&tconn->asender);

if (drbd_send_protocol(tconn) == -1)
if (drbd_send_protocol(tconn) == -EOPNOTSUPP)
return -1;

return !idr_for_each(&tconn->volumes, drbd_connected, tconn);
Expand Down

0 comments on commit 387eb30

Please sign in to comment.