Commit 5ed72a7
committed
mountpoint_cmp: flatten mountpoint= paramater before sorting
Datasets with nested mountpoints must be mounted in order from
shallowest to deepest, otherwise the deeper ones will be obscured by the
shallow ones.
mountpoint_cmp() has only traditionally been a character-based sort,
with no awareness of "legal" patterns in pathnames, in particular, runs
of '/' characters. These are (for better or worse) legal paths, but
confuse a character-based comparison, causing mounts to be attempted in
an incorrect order, with mixed results.
This commit adds a path "flattening" function, and applies it to the
string returned from the mountpoint= paramater before using it as a
path. This corrects the sort order and allows mounting to proceed
correctly.
Reported-by: James McKay <portablejim@jamesmckay.id.au>
Sponsored-by: TrueNAS
Signed-off-by: Rob Norris <rob.norris@truenas.com>1 parent 757c7db commit 5ed72a7
File tree
4 files changed
+96
-0
lines changed- include
- lib
- libzfs
- libzutil
4 files changed
+96
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
| 382 | + | |
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
| |||
5957 | 5958 | | |
5958 | 5959 | | |
5959 | 5960 | | |
| 5961 | + | |
| 5962 | + | |
| 5963 | + | |
| 5964 | + | |
| 5965 | + | |
| 5966 | + | |
5960 | 5967 | | |
5961 | 5968 | | |
5962 | 5969 | | |
| |||
6554 | 6561 | | |
6555 | 6562 | | |
6556 | 6563 | | |
| 6564 | + | |
| 6565 | + | |
| 6566 | + | |
| 6567 | + | |
| 6568 | + | |
6557 | 6569 | | |
6558 | 6570 | | |
6559 | 6571 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
269 | 270 | | |
270 | 271 | | |
271 | 272 | | |
| 273 | + | |
272 | 274 | | |
273 | 275 | | |
274 | 276 | | |
| |||
998 | 1000 | | |
999 | 1001 | | |
1000 | 1002 | | |
| 1003 | + | |
1001 | 1004 | | |
1002 | 1005 | | |
1003 | 1006 | | |
1004 | 1007 | | |
1005 | 1008 | | |
| 1009 | + | |
1006 | 1010 | | |
1007 | 1011 | | |
1008 | 1012 | | |
| |||
1061 | 1065 | | |
1062 | 1066 | | |
1063 | 1067 | | |
| 1068 | + | |
1064 | 1069 | | |
1065 | 1070 | | |
1066 | 1071 | | |
1067 | 1072 | | |
| 1073 | + | |
| 1074 | + | |
1068 | 1075 | | |
1069 | 1076 | | |
1070 | 1077 | | |
| |||
1170 | 1177 | | |
1171 | 1178 | | |
1172 | 1179 | | |
| 1180 | + | |
1173 | 1181 | | |
1174 | 1182 | | |
1175 | 1183 | | |
| |||
1187 | 1195 | | |
1188 | 1196 | | |
1189 | 1197 | | |
| 1198 | + | |
1190 | 1199 | | |
1191 | 1200 | | |
1192 | 1201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
203 | 204 | | |
204 | 205 | | |
205 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
0 commit comments