diff options
Diffstat (limited to 'drivers/block/drbd/drbd_receiver.c')
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index bc9ab7fb2cc7..dff48701b84d 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/unistd.h> | 42 | #include <linux/unistd.h> |
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | #include <linux/random.h> | 44 | #include <linux/random.h> |
45 | #include <linux/mm.h> | ||
46 | #include <linux/string.h> | 45 | #include <linux/string.h> |
47 | #include <linux/scatterlist.h> | 46 | #include <linux/scatterlist.h> |
48 | #include "drbd_int.h" | 47 | #include "drbd_int.h" |
@@ -571,6 +570,25 @@ static int drbd_recv(struct drbd_conf *mdev, void *buf, size_t size) | |||
571 | return rv; | 570 | return rv; |
572 | } | 571 | } |
573 | 572 | ||
573 | /* quoting tcp(7): | ||
574 | * On individual connections, the socket buffer size must be set prior to the | ||
575 | * listen(2) or connect(2) calls in order to have it take effect. | ||
576 | * This is our wrapper to do so. | ||
577 | */ | ||
578 | static void drbd_setbufsize(struct socket *sock, unsigned int snd, | ||
579 | unsigned int rcv) | ||
580 | { | ||
581 | /* open coded SO_SNDBUF, SO_RCVBUF */ | ||
582 | if (snd) { | ||
583 | sock->sk->sk_sndbuf = snd; | ||
584 | sock->sk->sk_userlocks |= SOCK_SNDBUF_LOCK; | ||
585 | } | ||
586 | if (rcv) { | ||
587 | sock->sk->sk_rcvbuf = rcv; | ||
588 | sock->sk->sk_userlocks |= SOCK_RCVBUF_LOCK; | ||
589 | } | ||
590 | } | ||
591 | |||
574 | static struct socket *drbd_try_connect(struct drbd_conf *mdev) | 592 | static struct socket *drbd_try_connect(struct drbd_conf *mdev) |
575 | { | 593 | { |
576 | const char *what; | 594 | const char *what; |
@@ -592,6 +610,8 @@ static struct socket *drbd_try_connect(struct drbd_conf *mdev) | |||
592 | 610 | ||
593 | sock->sk->sk_rcvtimeo = | 611 | sock->sk->sk_rcvtimeo = |
594 | sock->sk->sk_sndtimeo = mdev->net_conf->try_connect_int*HZ; | 612 | sock->sk->sk_sndtimeo = mdev->net_conf->try_connect_int*HZ; |
613 | drbd_setbufsize(sock, mdev->net_conf->sndbuf_size, | ||
614 | mdev->net_conf->rcvbuf_size); | ||
595 | 615 | ||
596 | /* explicitly bind to the configured IP as source IP | 616 | /* explicitly bind to the configured IP as source IP |
597 | * for the outgoing connections. | 617 | * for the outgoing connections. |
@@ -670,6 +690,8 @@ static struct socket *drbd_wait_for_connect(struct drbd_conf *mdev) | |||
670 | s_listen->sk->sk_reuse = 1; /* SO_REUSEADDR */ | 690 | s_listen->sk->sk_reuse = 1; /* SO_REUSEADDR */ |
671 | s_listen->sk->sk_rcvtimeo = timeo; | 691 | s_listen->sk->sk_rcvtimeo = timeo; |
672 | s_listen->sk->sk_sndtimeo = timeo; | 692 | s_listen->sk->sk_sndtimeo = timeo; |
693 | drbd_setbufsize(s_listen, mdev->net_conf->sndbuf_size, | ||
694 | mdev->net_conf->rcvbuf_size); | ||
673 | 695 | ||
674 | what = "bind before listen"; | 696 | what = "bind before listen"; |
675 | err = s_listen->ops->bind(s_listen, | 697 | err = s_listen->ops->bind(s_listen, |
@@ -856,16 +878,6 @@ retry: | |||
856 | sock->sk->sk_priority = TC_PRIO_INTERACTIVE_BULK; | 878 | sock->sk->sk_priority = TC_PRIO_INTERACTIVE_BULK; |
857 | msock->sk->sk_priority = TC_PRIO_INTERACTIVE; | 879 | msock->sk->sk_priority = TC_PRIO_INTERACTIVE; |
858 | 880 | ||
859 | if (mdev->net_conf->sndbuf_size) { | ||
860 | sock->sk->sk_sndbuf = mdev->net_conf->sndbuf_size; | ||
861 | sock->sk->sk_userlocks |= SOCK_SNDBUF_LOCK; | ||
862 | } | ||
863 | |||
864 | if (mdev->net_conf->rcvbuf_size) { | ||
865 | sock->sk->sk_rcvbuf = mdev->net_conf->rcvbuf_size; | ||
866 | sock->sk->sk_userlocks |= SOCK_RCVBUF_LOCK; | ||
867 | } | ||
868 | |||
869 | /* NOT YET ... | 881 | /* NOT YET ... |
870 | * sock->sk->sk_sndtimeo = mdev->net_conf->timeout*HZ/10; | 882 | * sock->sk->sk_sndtimeo = mdev->net_conf->timeout*HZ/10; |
871 | * sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; | 883 | * sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; |
@@ -1154,17 +1166,6 @@ int drbd_submit_ee(struct drbd_conf *mdev, struct drbd_epoch_entry *e, | |||
1154 | unsigned n_bios = 0; | 1166 | unsigned n_bios = 0; |
1155 | unsigned nr_pages = (ds + PAGE_SIZE -1) >> PAGE_SHIFT; | 1167 | unsigned nr_pages = (ds + PAGE_SIZE -1) >> PAGE_SHIFT; |
1156 | 1168 | ||
1157 | if (atomic_read(&mdev->new_c_uuid)) { | ||
1158 | if (atomic_add_unless(&mdev->new_c_uuid, -1, 1)) { | ||
1159 | drbd_uuid_new_current(mdev); | ||
1160 | drbd_md_sync(mdev); | ||
1161 | |||
1162 | atomic_dec(&mdev->new_c_uuid); | ||
1163 | wake_up(&mdev->misc_wait); | ||
1164 | } | ||
1165 | wait_event(mdev->misc_wait, !atomic_read(&mdev->new_c_uuid)); | ||
1166 | } | ||
1167 | |||
1168 | /* In most cases, we will only need one bio. But in case the lower | 1169 | /* In most cases, we will only need one bio. But in case the lower |
1169 | * level restrictions happen to be different at this offset on this | 1170 | * level restrictions happen to be different at this offset on this |
1170 | * side than those of the sending peer, we may need to submit the | 1171 | * side than those of the sending peer, we may need to submit the |