Even though with the previous commit we no longer block between binding
the socket and starting handling events, we still want a larger receive
buffer to accommodate for scheduling delays. Since the filtering is
done in the listener, an estimate focused on just rbd is not accurate,
but anyway: a pair of "rbd" and "block" events for "rbd map" take 2048
bytes in the receive buffer. This allows for roughly a thousand of
them ("rbd map" and "rbd unmap" require root and libudev makes use of
SO_RCVBUFFORCE so rmem_max limit is ignored).
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit
1c6cac1acaefdf59c3265d70c8d2191c59f14652)
#include <blkid/blkid.h>
#include <libudev.h>
+static const int UDEV_BUF_SIZE = 1 << 20; /* doubled to 2M (SO_RCVBUFFORCE) */
+
struct krbd_ctx {
CephContext *cct;
struct udev *udev;
if (r < 0)
goto out_mon;
+ r = udev_monitor_set_receive_buffer_size(mon, UDEV_BUF_SIZE);
+ if (r < 0) {
+ std::cerr << "rbd: failed to set udev buffer size: " << cpp_strerror(r)
+ << std::endl;
+ /* not fatal */
+ }
+
r = udev_monitor_enable_receiving(mon);
if (r < 0)
goto out_mon;
if (r < 0)
goto out_mon;
+ r = udev_monitor_set_receive_buffer_size(mon, UDEV_BUF_SIZE);
+ if (r < 0) {
+ std::cerr << "rbd: failed to set udev buffer size: " << cpp_strerror(r)
+ << std::endl;
+ /* not fatal */
+ }
+
r = udev_monitor_enable_receiving(mon);
if (r < 0)
goto out_mon;