Skip to content

Commit b411b36

Browse files
Philipp-ReisnerJens Axboe
authored andcommitted
The DRBD driver
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
1 parent 1a35e0f commit b411b36

35 files changed

Lines changed: 23140 additions & 0 deletions

‎Documentation/blockdev/drbd/DRBD-8.3-data-packets.svg‎

Lines changed: 588 additions & 0 deletions
Loading

‎Documentation/blockdev/drbd/DRBD-data-packets.svg‎

Lines changed: 459 additions & 0 deletions
Loading
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Description
2+
3+
DRBD is a shared-nothing, synchronously replicated block device. It
4+
is designed to serve as a building block for high availability
5+
clusters and in this context, is a "drop-in" replacement for shared
6+
storage. Simplistically, you could see it as a network RAID 1.
7+
8+
Please visit http://www.drbd.org to find out more.
9+
10+
The here included files are intended to help understand the implementation
11+
12+
DRBD-8.3-data-packets.svg, DRBD-data-packets.svg
13+
relates some functions, and write packets.
14+
15+
conn-states-8.dot, disk-states-8.dot, node-states-8.dot
16+
The sub graphs of DRBD's state transitions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
digraph conn_states {
2+
StandAllone -> WFConnection [ label = "ioctl_set_net()" ]
3+
WFConnection -> Unconnected [ label = "unable to bind()" ]
4+
WFConnection -> WFReportParams [ label = "in connect() after accept" ]
5+
WFReportParams -> StandAllone [ label = "checks in receive_param()" ]
6+
WFReportParams -> Connected [ label = "in receive_param()" ]
7+
WFReportParams -> WFBitMapS [ label = "sync_handshake()" ]
8+
WFReportParams -> WFBitMapT [ label = "sync_handshake()" ]
9+
WFBitMapS -> SyncSource [ label = "receive_bitmap()" ]
10+
WFBitMapT -> SyncTarget [ label = "receive_bitmap()" ]
11+
SyncSource -> Connected
12+
SyncTarget -> Connected
13+
SyncSource -> PausedSyncS
14+
SyncTarget -> PausedSyncT
15+
PausedSyncS -> SyncSource
16+
PausedSyncT -> SyncTarget
17+
Connected -> WFConnection [ label = "* on network error" ]
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
digraph disk_states {
2+
Diskless -> Inconsistent [ label = "ioctl_set_disk()" ]
3+
Diskless -> Consistent [ label = "ioctl_set_disk()" ]
4+
Diskless -> Outdated [ label = "ioctl_set_disk()" ]
5+
Consistent -> Outdated [ label = "receive_param()" ]
6+
Consistent -> UpToDate [ label = "receive_param()" ]
7+
Consistent -> Inconsistent [ label = "start resync" ]
8+
Outdated -> Inconsistent [ label = "start resync" ]
9+
UpToDate -> Inconsistent [ label = "ioctl_replicate" ]
10+
Inconsistent -> UpToDate [ label = "resync completed" ]
11+
Consistent -> Failed [ label = "io completion error" ]
12+
Outdated -> Failed [ label = "io completion error" ]
13+
UpToDate -> Failed [ label = "io completion error" ]
14+
Inconsistent -> Failed [ label = "io completion error" ]
15+
Failed -> Diskless [ label = "sending notify to peer" ]
16+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// vim: set sw=2 sts=2 :
2+
digraph {
3+
rankdir=BT
4+
bgcolor=white
5+
6+
node [shape=plaintext]
7+
node [fontcolor=black]
8+
9+
StandAlone [ style=filled,fillcolor=gray,label=StandAlone ]
10+
11+
node [fontcolor=lightgray]
12+
13+
Unconnected [ label=Unconnected ]
14+
15+
CommTrouble [ shape=record,
16+
label="{communication loss|{Timeout|BrokenPipe|NetworkFailure}}" ]
17+
18+
node [fontcolor=gray]
19+
20+
subgraph cluster_try_connect {
21+
label="try to connect, handshake"
22+
rank=max
23+
WFConnection [ label=WFConnection ]
24+
WFReportParams [ label=WFReportParams ]
25+
}
26+
27+
TearDown [ label=TearDown ]
28+
29+
Connected [ label=Connected,style=filled,fillcolor=green,fontcolor=black ]
30+
31+
node [fontcolor=lightblue]
32+
33+
StartingSyncS [ label=StartingSyncS ]
34+
StartingSyncT [ label=StartingSyncT ]
35+
36+
subgraph cluster_bitmap_exchange {
37+
node [fontcolor=red]
38+
fontcolor=red
39+
label="new application (WRITE?) requests blocked\lwhile bitmap is exchanged"
40+
41+
WFBitMapT [ label=WFBitMapT ]
42+
WFSyncUUID [ label=WFSyncUUID ]
43+
WFBitMapS [ label=WFBitMapS ]
44+
}
45+
46+
node [fontcolor=blue]
47+
48+
cluster_resync [ shape=record,label="{<any>resynchronisation process running\l'concurrent' application requests allowed|{{<T>PausedSyncT\nSyncTarget}|{<S>PausedSyncS\nSyncSource}}}" ]
49+
50+
node [shape=box,fontcolor=black]
51+
52+
// drbdadm [label="drbdadm connect"]
53+
// handshake [label="drbd_connect()\ndrbd_do_handshake\ndrbd_sync_handshake() etc."]
54+
// comm_error [label="communication trouble"]
55+
56+
//
57+
// edges
58+
// --------------------------------------
59+
60+
StandAlone -> Unconnected [ label="drbdadm connect" ]
61+
Unconnected -> StandAlone [ label="drbdadm disconnect\lor serious communication trouble" ]
62+
Unconnected -> WFConnection [ label="receiver thread is started" ]
63+
WFConnection -> WFReportParams [ headlabel="accept()\land/or \lconnect()\l" ]
64+
65+
WFReportParams -> StandAlone [ label="during handshake\lpeers do not agree\labout something essential" ]
66+
WFReportParams -> Connected [ label="data identical\lno sync needed",color=green,fontcolor=green ]
67+
68+
WFReportParams -> WFBitMapS
69+
WFReportParams -> WFBitMapT
70+
WFBitMapT -> WFSyncUUID [minlen=0.1,constraint=false]
71+
72+
WFBitMapS -> cluster_resync:S
73+
WFSyncUUID -> cluster_resync:T
74+
75+
edge [color=green]
76+
cluster_resync:any -> Connected [ label="resnyc done",fontcolor=green ]
77+
78+
edge [color=red]
79+
WFReportParams -> CommTrouble
80+
Connected -> CommTrouble
81+
cluster_resync:any -> CommTrouble
82+
edge [color=black]
83+
CommTrouble -> Unconnected [label="receiver thread is stopped" ]
84+
85+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
digraph node_states {
2+
Secondary -> Primary [ label = "ioctl_set_state()" ]
3+
Primary -> Secondary [ label = "ioctl_set_state()" ]
4+
}
5+
6+
digraph peer_states {
7+
Secondary -> Primary [ label = "recv state packet" ]
8+
Primary -> Secondary [ label = "recv state packet" ]
9+
Primary -> Unknown [ label = "connection lost" ]
10+
Secondary -> Unknown [ label = "connection lost" ]
11+
Unknown -> Primary [ label = "connected" ]
12+
Unknown -> Secondary [ label = "connected" ]
13+
}
14+

‎MAINTAINERS‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,6 +1758,19 @@ S: Maintained
17581758
F: drivers/scsi/dpt*
17591759
F: drivers/scsi/dpt/
17601760

1761+
DRBD DRIVER
1762+
P: Philipp Reisner
1763+
P: Lars Ellenberg
1764+
M: drbd-dev@lists.linbit.com
1765+
L: drbd-user@lists.linbit.com
1766+
W: http://www.drbd.org
1767+
T: git git://git.drbd.org/linux-2.6-drbd.git drbd
1768+
T: git git://git.drbd.org/drbd-8.3.git
1769+
S: Supported
1770+
F: drivers/block/drbd/
1771+
F: lib/lru_cache.c
1772+
F: Documentation/blockdev/drbd/
1773+
17611774
DRIVER CORE, KOBJECTS, AND SYSFS
17621775
M: Greg Kroah-Hartman <gregkh@suse.de>
17631776
T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/

‎drivers/block/Kconfig‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ config BLK_DEV_CRYPTOLOOP
271271
instead, which can be configured to be on-disk compatible with the
272272
cryptoloop device.
273273

274+
source "drivers/block/drbd/Kconfig"
275+
274276
config BLK_DEV_NBD
275277
tristate "Network block device support"
276278
depends on NET

‎drivers/block/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ obj-$(CONFIG_BLK_DEV_UB) += ub.o
3636
obj-$(CONFIG_BLK_DEV_HD) += hd.o
3737

3838
obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o
39+
obj-$(CONFIG_BLK_DEV_DRBD) += drbd/
3940

4041
swim_mod-objs := swim.o swim_asm.o

0 commit comments

Comments
 (0)