Commit 7163bfe
block: advisory locks: use byte-range locks to match QEMU behavior
The granularity has significant implications in typical cloud
deployments with network storage. The Linux kernel will sync advisory
locks to network file systems, but these backends may have different
policies and handle locks differently. For example, Netapp speaks a NFS
API but will treat advisory OFD locks for the whole file as mandatory
locks, whereas byte-range locks for the whole file will remain
advisory [0].
As it is a valid use case to prevent multiple CHV instances from
accessing the same disk but disk management software (e.g., Cinder in
OpenStack) should be able to snapshot disks while VMs are running, we
need special control over the lock granularity. 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 [1].
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.
[0] https://kb.netapp.com/on-prem/ontap/da/NAS/NAS-KBs/How_is_Mandatory_Locking_supported_for_NFSv4_on_ONTAP_9
[1] <qemu>/util/osdep.c::qemu_lock_fcntl()
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com1 parent 1498fee commit 7163bfe
2 files changed
+87
-14
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 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
104 | 143 | | |
105 | | - | |
| 144 | + | |
106 | 145 | | |
107 | 146 | | |
108 | 147 | | |
109 | | - | |
110 | | - | |
| 148 | + | |
| 149 | + | |
111 | 150 | | |
112 | 151 | | |
113 | 152 | | |
| |||
122 | 161 | | |
123 | 162 | | |
124 | 163 | | |
125 | | - | |
126 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
127 | 171 | | |
128 | 172 | | |
129 | 173 | | |
| |||
146 | 190 | | |
147 | 191 | | |
148 | 192 | | |
149 | | - | |
150 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
151 | 196 | | |
152 | 197 | | |
153 | 198 | | |
154 | 199 | | |
155 | 200 | | |
156 | 201 | | |
157 | 202 | | |
158 | | - | |
159 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
160 | 209 | | |
161 | 210 | | |
162 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
778 | 778 | | |
779 | 779 | | |
780 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
781 | 802 | | |
782 | 803 | | |
783 | 804 | | |
784 | 805 | | |
785 | 806 | | |
786 | 807 | | |
| 808 | + | |
787 | 809 | | |
788 | | - | |
| 810 | + | |
789 | 811 | | |
790 | 812 | | |
791 | 813 | | |
792 | 814 | | |
793 | | - | |
794 | | - | |
| 815 | + | |
| 816 | + | |
795 | 817 | | |
796 | 818 | | |
797 | 819 | | |
| |||
815 | 837 | | |
816 | 838 | | |
817 | 839 | | |
| 840 | + | |
| 841 | + | |
818 | 842 | | |
819 | 843 | | |
820 | 844 | | |
821 | | - | |
| 845 | + | |
822 | 846 | | |
823 | 847 | | |
824 | 848 | | |
| |||
0 commit comments