Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345867
b: refs/heads/master
c: 2de876e
h: refs/heads/master
i:
  345865: c84fcd2
  345863: 7262f15
v: v3
  • Loading branch information
Philipp Reisner committed Nov 3, 2012
1 parent e9a9b69 commit 551ff7d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 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: 85f75dd7630436b0aa46a6393099c0f23121f5f0
refs/heads/master: 2de876efa68d59fa4339837c4a94b42015ab1836
33 changes: 25 additions & 8 deletions trunk/drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -3794,27 +3794,40 @@ static int receive_bitmap(struct drbd_conf *mdev, enum drbd_packet cmd,
return ok;
}

static int receive_skip(struct drbd_conf *mdev, enum drbd_packet cmd,
unsigned int data_size)
static int _tconn_receive_skip(struct drbd_tconn *tconn, unsigned int data_size)
{
/* TODO zero copy sink :) */
static char sink[128];
int size, want, r;

dev_warn(DEV, "skipping unknown optional packet type %d, l: %d!\n",
cmd, data_size);

size = data_size;
while (size > 0) {
want = min_t(int, size, sizeof(sink));
r = drbd_recv(mdev->tconn, sink, want);
if (!expect(r > 0))
r = drbd_recv(tconn, sink, want);
if (r <= 0)
break;
size -= r;
}
return size == 0;
}

static int receive_skip(struct drbd_conf *mdev, enum drbd_packet cmd,
unsigned int data_size)
{
dev_warn(DEV, "skipping unknown optional packet type %d, l: %d!\n",
cmd, data_size);

return _tconn_receive_skip(mdev->tconn, data_size);
}

static int tconn_receive_skip(struct drbd_tconn *tconn, enum drbd_packet cmd, unsigned int data_size)
{
conn_warn(tconn, "skipping packet for non existing volume type %d, l: %d!\n",
cmd, data_size);

return _tconn_receive_skip(tconn, data_size);
}

static int receive_UnplugRemote(struct drbd_conf *mdev, enum drbd_packet cmd,
unsigned int data_size)
{
Expand Down Expand Up @@ -3890,6 +3903,7 @@ static struct data_cmd drbd_cmd_handler[] = {
static void drbdd(struct drbd_tconn *tconn)
{
struct p_header *header = &tconn->data.rbuf.header;
struct drbd_conf *mdev;
struct packet_info pi;
size_t shs; /* sub header size */
int rv;
Expand Down Expand Up @@ -3920,7 +3934,10 @@ static void drbdd(struct drbd_tconn *tconn)
}
}

rv = drbd_cmd_handler[pi.cmd].function(vnr_to_mdev(tconn, pi.vnr), pi.cmd, pi.size - shs);
mdev = vnr_to_mdev(tconn, pi.vnr);
rv = mdev ?
drbd_cmd_handler[pi.cmd].function(mdev, pi.cmd, pi.size - shs) :
tconn_receive_skip(tconn, pi.cmd, pi.size - shs);

if (unlikely(!rv)) {
conn_err(tconn, "error receiving %s, l: %d!\n",
Expand Down

0 comments on commit 551ff7d

Please sign in to comment.