-
Notifications
You must be signed in to change notification settings - Fork 57
/
notes.locks
63 lines (47 loc) · 1.16 KB
/
notes.locks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Notes on how zrep uses its own internal locks.
(observationally. not a design document)
Locks are done on the sending side.
There is a global lock, and an fs-specific lock.
The global is done via a lockfile.
fs-specific is done by property. It is also done
in a tag-local way. So in theory, multiple snapshots and sends could be done.
zfs set ${ZREPTAG}:lock-pid=$$ $1
Function uses of locks
zrep sync:
* lock src fs
* (retry if appropriate)
* call _snapandsync
* call _expire
* unlock src fs
end
_snapandsync
*(caller has lock)
*(create snapshot...)
_sync
_sync
*(caller has lock)
* find last sent
* find newest snap
* put together the zfs incremental command
* Attempt to set zrep:sent=xxxx on snapshot, on REMOTE side,
and then local
- If this fails, set zrep:lastsent and lastsenttime, on *filesystem*
of remote side, and then local
zrep_refresh
lock_fs
snap remote side
pull a send
POTENTIAL ERROR HERE, since pull, may rewrite property?!?!
redundant(?) unlock_fs.
zrep_failover
lock_fs
do all operations
unlock_fs
zrep_takeover
lock_fs
do all operations
unlock_fs
zrep_snaponly
lock_fs
make snapshot
unlock_fs