Commit e5420d2
committed
block: advisory locks: use byte-range locks to match QEMU behavior
Switch from a whole-file lock (0, 0 /* EOF */) to a byte-range lock
covering (0, disk.len()), i.e., enabling control over the lock's
granularity.
The granularity has significant implications in typical Cloud
deployments where disk image management software (e.g., Cinder as part
of OpenStack) may treat advisory locks for the whole file as mandatory
locks. This however prevents these software components from snapshotting
disk images while VMs are running. Therefore, it is a valid use case to
lock the whole byte range of a disk image without technically locking
the whole file - to get the best of both worlds.
This also brings CHVs behavior in line with QEMU.
Whole-file locks remain a valid use case and could be supported later.
This patch only provides the necessary groundwork; making it configurable
is out of scope for now.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com1 parent 1498fee commit e5420d2
2 files changed
+65
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
104 | 135 | | |
105 | | - | |
| 136 | + | |
106 | 137 | | |
107 | 138 | | |
108 | 139 | | |
109 | | - | |
110 | | - | |
| 140 | + | |
| 141 | + | |
111 | 142 | | |
112 | 143 | | |
113 | 144 | | |
| |||
122 | 153 | | |
123 | 154 | | |
124 | 155 | | |
125 | | - | |
126 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
127 | 163 | | |
128 | 164 | | |
129 | 165 | | |
| |||
146 | 182 | | |
147 | 183 | | |
148 | 184 | | |
149 | | - | |
150 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
151 | 188 | | |
152 | 189 | | |
153 | 190 | | |
154 | 191 | | |
155 | 192 | | |
156 | 193 | | |
157 | 194 | | |
158 | | - | |
159 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
160 | 201 | | |
161 | 202 | | |
162 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
792 | 797 | | |
793 | | - | |
794 | | - | |
| 798 | + | |
| 799 | + | |
795 | 800 | | |
796 | 801 | | |
797 | 802 | | |
| |||
815 | 820 | | |
816 | 821 | | |
817 | 822 | | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
818 | 829 | | |
819 | 830 | | |
820 | 831 | | |
821 | | - | |
| 832 | + | |
822 | 833 | | |
823 | 834 | | |
824 | 835 | | |
| |||
0 commit comments