]>
Commit | Line | Data |
---|---|---|
663996b3 MS |
1 | /*** |
2 | This file is part of systemd. | |
3 | ||
4 | Copyright 2010 ProFUSION embedded systems | |
5 | ||
6 | systemd is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU Lesser General Public License as published by | |
8 | the Free Software Foundation; either version 2.1 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | systemd is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Lesser General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Lesser General Public License | |
17 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
18 | ***/ | |
19 | ||
20 | #include <errno.h> | |
21 | #include <fcntl.h> | |
db2df898 MP |
22 | #include <linux/dm-ioctl.h> |
23 | #include <linux/loop.h> | |
663996b3 MS |
24 | #include <string.h> |
25 | #include <sys/mount.h> | |
26 | #include <sys/swap.h> | |
663996b3 | 27 | |
db2df898 MP |
28 | #include "libudev.h" |
29 | ||
30 | #include "alloc-util.h" | |
31 | #include "escape.h" | |
32 | #include "fd-util.h" | |
33 | #include "fstab-util.h" | |
663996b3 MS |
34 | #include "list.h" |
35 | #include "mount-setup.h" | |
663996b3 | 36 | #include "path-util.h" |
db2df898 MP |
37 | #include "string-util.h" |
38 | #include "udev-util.h" | |
39 | #include "umount.h" | |
663996b3 MS |
40 | #include "util.h" |
41 | #include "virt.h" | |
42 | ||
43 | typedef struct MountPoint { | |
44 | char *path; | |
db2df898 | 45 | char *options; |
663996b3 | 46 | dev_t devnum; |
60f067b4 | 47 | LIST_FIELDS(struct MountPoint, mount_point); |
663996b3 MS |
48 | } MountPoint; |
49 | ||
50 | static void mount_point_free(MountPoint **head, MountPoint *m) { | |
51 | assert(head); | |
52 | assert(m); | |
53 | ||
60f067b4 | 54 | LIST_REMOVE(mount_point, *head, m); |
663996b3 MS |
55 | |
56 | free(m->path); | |
57 | free(m); | |
58 | } | |
59 | ||
60 | static void mount_points_list_free(MountPoint **head) { | |
61 | assert(head); | |
62 | ||
63 | while (*head) | |
64 | mount_point_free(head, *head); | |
65 | } | |
66 | ||
67 | static int mount_points_list_get(MountPoint **head) { | |
60f067b4 | 68 | _cleanup_fclose_ FILE *proc_self_mountinfo = NULL; |
663996b3 | 69 | unsigned int i; |
e3bff60a | 70 | int r; |
663996b3 MS |
71 | |
72 | assert(head); | |
73 | ||
60f067b4 JS |
74 | proc_self_mountinfo = fopen("/proc/self/mountinfo", "re"); |
75 | if (!proc_self_mountinfo) | |
663996b3 MS |
76 | return -errno; |
77 | ||
78 | for (i = 1;; i++) { | |
db2df898 | 79 | _cleanup_free_ char *path = NULL, *options = NULL; |
60f067b4 | 80 | char *p = NULL; |
663996b3 | 81 | MountPoint *m; |
60f067b4 | 82 | int k; |
663996b3 | 83 | |
60f067b4 JS |
84 | k = fscanf(proc_self_mountinfo, |
85 | "%*s " /* (1) mount id */ | |
86 | "%*s " /* (2) parent id */ | |
87 | "%*s " /* (3) major:minor */ | |
88 | "%*s " /* (4) root */ | |
89 | "%ms " /* (5) mount point */ | |
db2df898 | 90 | "%*s" /* (6) mount flags */ |
60f067b4 JS |
91 | "%*[^-]" /* (7) optional fields */ |
92 | "- " /* (8) separator */ | |
93 | "%*s " /* (9) file system type */ | |
94 | "%*s" /* (10) mount source */ | |
db2df898 | 95 | "%ms" /* (11) mount options */ |
60f067b4 | 96 | "%*[^\n]", /* some rubbish at the end */ |
db2df898 MP |
97 | &path, &options); |
98 | if (k != 2) { | |
663996b3 MS |
99 | if (k == EOF) |
100 | break; | |
101 | ||
102 | log_warning("Failed to parse /proc/self/mountinfo:%u.", i); | |
663996b3 MS |
103 | continue; |
104 | } | |
105 | ||
e3bff60a MP |
106 | r = cunescape(path, UNESCAPE_RELAX, &p); |
107 | if (r < 0) | |
108 | return r; | |
663996b3 MS |
109 | |
110 | /* Ignore mount points we can't unmount because they | |
111 | * are API or because we are keeping them open (like | |
e735f4d4 MP |
112 | * /dev/console). Also, ignore all mounts below API |
113 | * file systems, since they are likely virtual too, | |
114 | * and hence not worth spending time on. Also, in | |
115 | * unprivileged containers we might lack the rights to | |
116 | * unmount these things, hence don't bother. */ | |
663996b3 MS |
117 | if (mount_point_is_api(p) || |
118 | mount_point_ignore(p) || | |
e735f4d4 MP |
119 | path_startswith(p, "/dev") || |
120 | path_startswith(p, "/sys") || | |
121 | path_startswith(p, "/proc")) { | |
663996b3 MS |
122 | free(p); |
123 | continue; | |
124 | } | |
125 | ||
60f067b4 JS |
126 | m = new0(MountPoint, 1); |
127 | if (!m) { | |
663996b3 | 128 | free(p); |
60f067b4 | 129 | return -ENOMEM; |
663996b3 MS |
130 | } |
131 | ||
132 | m->path = p; | |
db2df898 MP |
133 | m->options = options; |
134 | options = NULL; | |
135 | ||
60f067b4 | 136 | LIST_PREPEND(mount_point, *head, m); |
663996b3 MS |
137 | } |
138 | ||
60f067b4 | 139 | return 0; |
663996b3 MS |
140 | } |
141 | ||
142 | static int swap_list_get(MountPoint **head) { | |
e842803a | 143 | _cleanup_fclose_ FILE *proc_swaps = NULL; |
663996b3 | 144 | unsigned int i; |
e3bff60a | 145 | int r; |
663996b3 MS |
146 | |
147 | assert(head); | |
148 | ||
e3bff60a MP |
149 | proc_swaps = fopen("/proc/swaps", "re"); |
150 | if (!proc_swaps) | |
663996b3 MS |
151 | return (errno == ENOENT) ? 0 : -errno; |
152 | ||
153 | (void) fscanf(proc_swaps, "%*s %*s %*s %*s %*s\n"); | |
154 | ||
155 | for (i = 2;; i++) { | |
156 | MountPoint *swap; | |
157 | char *dev = NULL, *d; | |
158 | int k; | |
159 | ||
e3bff60a MP |
160 | k = fscanf(proc_swaps, |
161 | "%ms " /* device/file */ | |
162 | "%*s " /* type of swap */ | |
163 | "%*s " /* swap size */ | |
164 | "%*s " /* used */ | |
165 | "%*s\n", /* priority */ | |
166 | &dev); | |
663996b3 | 167 | |
e3bff60a | 168 | if (k != 1) { |
663996b3 MS |
169 | if (k == EOF) |
170 | break; | |
171 | ||
172 | log_warning("Failed to parse /proc/swaps:%u.", i); | |
663996b3 MS |
173 | free(dev); |
174 | continue; | |
175 | } | |
176 | ||
60f067b4 | 177 | if (endswith(dev, " (deleted)")) { |
663996b3 MS |
178 | free(dev); |
179 | continue; | |
180 | } | |
181 | ||
e3bff60a | 182 | r = cunescape(dev, UNESCAPE_RELAX, &d); |
663996b3 | 183 | free(dev); |
e3bff60a MP |
184 | if (r < 0) |
185 | return r; | |
663996b3 | 186 | |
e3bff60a MP |
187 | swap = new0(MountPoint, 1); |
188 | if (!swap) { | |
663996b3 | 189 | free(d); |
e842803a | 190 | return -ENOMEM; |
663996b3 MS |
191 | } |
192 | ||
193 | swap->path = d; | |
60f067b4 | 194 | LIST_PREPEND(mount_point, *head, swap); |
663996b3 MS |
195 | } |
196 | ||
e842803a | 197 | return 0; |
663996b3 MS |
198 | } |
199 | ||
200 | static int loopback_list_get(MountPoint **head) { | |
60f067b4 | 201 | _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; |
663996b3 | 202 | struct udev_list_entry *item = NULL, *first = NULL; |
60f067b4 JS |
203 | _cleanup_udev_unref_ struct udev *udev = NULL; |
204 | int r; | |
663996b3 MS |
205 | |
206 | assert(head); | |
207 | ||
60f067b4 JS |
208 | udev = udev_new(); |
209 | if (!udev) | |
210 | return -ENOMEM; | |
663996b3 | 211 | |
60f067b4 JS |
212 | e = udev_enumerate_new(udev); |
213 | if (!e) | |
214 | return -ENOMEM; | |
663996b3 | 215 | |
60f067b4 JS |
216 | r = udev_enumerate_add_match_subsystem(e, "block"); |
217 | if (r < 0) | |
218 | return r; | |
663996b3 | 219 | |
60f067b4 JS |
220 | r = udev_enumerate_add_match_sysname(e, "loop*"); |
221 | if (r < 0) | |
222 | return r; | |
223 | ||
224 | r = udev_enumerate_add_match_sysattr(e, "loop/backing_file", NULL); | |
225 | if (r < 0) | |
226 | return r; | |
227 | ||
228 | r = udev_enumerate_scan_devices(e); | |
229 | if (r < 0) | |
230 | return r; | |
663996b3 MS |
231 | |
232 | first = udev_enumerate_get_list_entry(e); | |
233 | udev_list_entry_foreach(item, first) { | |
234 | MountPoint *lb; | |
60f067b4 | 235 | _cleanup_udev_device_unref_ struct udev_device *d; |
663996b3 MS |
236 | char *loop; |
237 | const char *dn; | |
238 | ||
60f067b4 JS |
239 | d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)); |
240 | if (!d) | |
241 | return -ENOMEM; | |
663996b3 | 242 | |
60f067b4 JS |
243 | dn = udev_device_get_devnode(d); |
244 | if (!dn) | |
663996b3 | 245 | continue; |
663996b3 MS |
246 | |
247 | loop = strdup(dn); | |
60f067b4 JS |
248 | if (!loop) |
249 | return -ENOMEM; | |
663996b3 | 250 | |
60f067b4 JS |
251 | lb = new0(MountPoint, 1); |
252 | if (!lb) { | |
663996b3 | 253 | free(loop); |
60f067b4 | 254 | return -ENOMEM; |
663996b3 MS |
255 | } |
256 | ||
257 | lb->path = loop; | |
60f067b4 | 258 | LIST_PREPEND(mount_point, *head, lb); |
663996b3 MS |
259 | } |
260 | ||
60f067b4 | 261 | return 0; |
663996b3 MS |
262 | } |
263 | ||
264 | static int dm_list_get(MountPoint **head) { | |
60f067b4 | 265 | _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; |
663996b3 | 266 | struct udev_list_entry *item = NULL, *first = NULL; |
60f067b4 JS |
267 | _cleanup_udev_unref_ struct udev *udev = NULL; |
268 | int r; | |
663996b3 MS |
269 | |
270 | assert(head); | |
271 | ||
60f067b4 JS |
272 | udev = udev_new(); |
273 | if (!udev) | |
274 | return -ENOMEM; | |
663996b3 | 275 | |
60f067b4 JS |
276 | e = udev_enumerate_new(udev); |
277 | if (!e) | |
278 | return -ENOMEM; | |
663996b3 | 279 | |
60f067b4 JS |
280 | r = udev_enumerate_add_match_subsystem(e, "block"); |
281 | if (r < 0) | |
282 | return r; | |
663996b3 | 283 | |
60f067b4 JS |
284 | r = udev_enumerate_add_match_sysname(e, "dm-*"); |
285 | if (r < 0) | |
286 | return r; | |
663996b3 | 287 | |
60f067b4 JS |
288 | r = udev_enumerate_scan_devices(e); |
289 | if (r < 0) | |
290 | return r; | |
663996b3 | 291 | |
60f067b4 | 292 | first = udev_enumerate_get_list_entry(e); |
663996b3 MS |
293 | udev_list_entry_foreach(item, first) { |
294 | MountPoint *m; | |
60f067b4 | 295 | _cleanup_udev_device_unref_ struct udev_device *d; |
663996b3 MS |
296 | dev_t devnum; |
297 | char *node; | |
298 | const char *dn; | |
299 | ||
60f067b4 JS |
300 | d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)); |
301 | if (!d) | |
302 | return -ENOMEM; | |
663996b3 MS |
303 | |
304 | devnum = udev_device_get_devnum(d); | |
305 | dn = udev_device_get_devnode(d); | |
60f067b4 | 306 | if (major(devnum) == 0 || !dn) |
663996b3 | 307 | continue; |
663996b3 MS |
308 | |
309 | node = strdup(dn); | |
60f067b4 JS |
310 | if (!node) |
311 | return -ENOMEM; | |
663996b3 | 312 | |
60f067b4 JS |
313 | m = new(MountPoint, 1); |
314 | if (!m) { | |
663996b3 | 315 | free(node); |
60f067b4 | 316 | return -ENOMEM; |
663996b3 MS |
317 | } |
318 | ||
319 | m->path = node; | |
320 | m->devnum = devnum; | |
60f067b4 | 321 | LIST_PREPEND(mount_point, *head, m); |
663996b3 MS |
322 | } |
323 | ||
60f067b4 | 324 | return 0; |
663996b3 MS |
325 | } |
326 | ||
327 | static int delete_loopback(const char *device) { | |
60f067b4 JS |
328 | _cleanup_close_ int fd = -1; |
329 | int r; | |
663996b3 | 330 | |
60f067b4 JS |
331 | fd = open(device, O_RDONLY|O_CLOEXEC); |
332 | if (fd < 0) | |
663996b3 MS |
333 | return errno == ENOENT ? 0 : -errno; |
334 | ||
335 | r = ioctl(fd, LOOP_CLR_FD, 0); | |
663996b3 MS |
336 | if (r >= 0) |
337 | return 1; | |
338 | ||
339 | /* ENXIO: not bound, so no error */ | |
340 | if (errno == ENXIO) | |
341 | return 0; | |
342 | ||
343 | return -errno; | |
344 | } | |
345 | ||
346 | static int delete_dm(dev_t devnum) { | |
347 | _cleanup_close_ int fd = -1; | |
348 | int r; | |
349 | struct dm_ioctl dm = { | |
350 | .version = {DM_VERSION_MAJOR, | |
351 | DM_VERSION_MINOR, | |
352 | DM_VERSION_PATCHLEVEL}, | |
353 | .data_size = sizeof(dm), | |
354 | .dev = devnum, | |
355 | }; | |
356 | ||
357 | assert(major(devnum) != 0); | |
358 | ||
359 | fd = open("/dev/mapper/control", O_RDWR|O_CLOEXEC); | |
360 | if (fd < 0) | |
361 | return -errno; | |
362 | ||
363 | r = ioctl(fd, DM_DEV_REMOVE, &dm); | |
364 | return r >= 0 ? 0 : -errno; | |
365 | } | |
366 | ||
367 | static int mount_points_list_umount(MountPoint **head, bool *changed, bool log_error) { | |
368 | MountPoint *m, *n; | |
369 | int n_failed = 0; | |
370 | ||
371 | assert(head); | |
372 | ||
373 | LIST_FOREACH_SAFE(mount_point, m, n, *head) { | |
374 | ||
375 | /* If we are in a container, don't attempt to | |
376 | read-only mount anything as that brings no real | |
377 | benefits, but might confuse the host, as we remount | |
378 | the superblock here, not the bind mound. */ | |
6300502b | 379 | if (detect_container() <= 0) { |
db2df898 MP |
380 | _cleanup_free_ char *options = NULL; |
381 | /* MS_REMOUNT requires that the data parameter | |
382 | * should be the same from the original mount | |
383 | * except for the desired changes. Since we want | |
384 | * to remount read-only, we should filter out | |
385 | * rw (and ro too, because it confuses the kernel) */ | |
386 | (void) fstab_filter_options(m->options, "rw\0ro\0", NULL, NULL, &options); | |
387 | ||
663996b3 MS |
388 | /* We always try to remount directories |
389 | * read-only first, before we go on and umount | |
390 | * them. | |
391 | * | |
392 | * Mount points can be stacked. If a mount | |
393 | * point is stacked below / or /usr, we | |
394 | * cannot umount or remount it directly, | |
395 | * since there is no way to refer to the | |
396 | * underlying mount. There's nothing we can do | |
397 | * about it for the general case, but we can | |
398 | * do something about it if it is aliased | |
399 | * somehwere else via a bind mount. If we | |
400 | * explicitly remount the super block of that | |
401 | * alias read-only we hence should be | |
402 | * relatively safe regarding keeping the fs we | |
403 | * can otherwise not see dirty. */ | |
db2df898 MP |
404 | log_info("Remounting '%s' read-only with options '%s'.", m->path, options); |
405 | (void) mount(NULL, m->path, NULL, MS_REMOUNT|MS_RDONLY, options); | |
663996b3 MS |
406 | } |
407 | ||
408 | /* Skip / and /usr since we cannot unmount that | |
409 | * anyway, since we are running from it. They have | |
410 | * already been remounted ro. */ | |
411 | if (path_equal(m->path, "/") | |
412 | #ifndef HAVE_SPLIT_USR | |
413 | || path_equal(m->path, "/usr") | |
414 | #endif | |
415 | ) | |
416 | continue; | |
417 | ||
418 | /* Trying to umount. We don't force here since we rely | |
419 | * on busy NFS and FUSE file systems to return EBUSY | |
420 | * until we closed everything on top of them. */ | |
421 | log_info("Unmounting %s.", m->path); | |
422 | if (umount2(m->path, 0) == 0) { | |
423 | if (changed) | |
424 | *changed = true; | |
425 | ||
426 | mount_point_free(head, m); | |
427 | } else if (log_error) { | |
f47781d8 | 428 | log_warning_errno(errno, "Could not unmount %s: %m", m->path); |
663996b3 MS |
429 | n_failed++; |
430 | } | |
431 | } | |
432 | ||
433 | return n_failed; | |
434 | } | |
435 | ||
436 | static int swap_points_list_off(MountPoint **head, bool *changed) { | |
437 | MountPoint *m, *n; | |
438 | int n_failed = 0; | |
439 | ||
440 | assert(head); | |
441 | ||
442 | LIST_FOREACH_SAFE(mount_point, m, n, *head) { | |
443 | log_info("Deactivating swap %s.", m->path); | |
444 | if (swapoff(m->path) == 0) { | |
445 | if (changed) | |
446 | *changed = true; | |
447 | ||
448 | mount_point_free(head, m); | |
449 | } else { | |
f47781d8 | 450 | log_warning_errno(errno, "Could not deactivate swap %s: %m", m->path); |
663996b3 MS |
451 | n_failed++; |
452 | } | |
453 | } | |
454 | ||
455 | return n_failed; | |
456 | } | |
457 | ||
458 | static int loopback_points_list_detach(MountPoint **head, bool *changed) { | |
459 | MountPoint *m, *n; | |
460 | int n_failed = 0, k; | |
461 | struct stat root_st; | |
462 | ||
463 | assert(head); | |
464 | ||
465 | k = lstat("/", &root_st); | |
466 | ||
467 | LIST_FOREACH_SAFE(mount_point, m, n, *head) { | |
468 | int r; | |
469 | struct stat loopback_st; | |
470 | ||
471 | if (k >= 0 && | |
472 | major(root_st.st_dev) != 0 && | |
473 | lstat(m->path, &loopback_st) >= 0 && | |
474 | root_st.st_dev == loopback_st.st_rdev) { | |
475 | n_failed ++; | |
476 | continue; | |
477 | } | |
478 | ||
479 | log_info("Detaching loopback %s.", m->path); | |
480 | r = delete_loopback(m->path); | |
481 | if (r >= 0) { | |
482 | if (r > 0 && changed) | |
483 | *changed = true; | |
484 | ||
485 | mount_point_free(head, m); | |
486 | } else { | |
f47781d8 | 487 | log_warning_errno(errno, "Could not detach loopback %s: %m", m->path); |
663996b3 MS |
488 | n_failed++; |
489 | } | |
490 | } | |
491 | ||
492 | return n_failed; | |
493 | } | |
494 | ||
495 | static int dm_points_list_detach(MountPoint **head, bool *changed) { | |
496 | MountPoint *m, *n; | |
497 | int n_failed = 0, k; | |
498 | struct stat root_st; | |
499 | ||
500 | assert(head); | |
501 | ||
502 | k = lstat("/", &root_st); | |
503 | ||
504 | LIST_FOREACH_SAFE(mount_point, m, n, *head) { | |
505 | int r; | |
506 | ||
507 | if (k >= 0 && | |
508 | major(root_st.st_dev) != 0 && | |
509 | root_st.st_dev == m->devnum) { | |
510 | n_failed ++; | |
511 | continue; | |
512 | } | |
513 | ||
514 | log_info("Detaching DM %u:%u.", major(m->devnum), minor(m->devnum)); | |
515 | r = delete_dm(m->devnum); | |
516 | if (r >= 0) { | |
517 | if (changed) | |
518 | *changed = true; | |
519 | ||
520 | mount_point_free(head, m); | |
521 | } else { | |
f47781d8 | 522 | log_warning_errno(errno, "Could not detach DM %s: %m", m->path); |
663996b3 MS |
523 | n_failed++; |
524 | } | |
525 | } | |
526 | ||
527 | return n_failed; | |
528 | } | |
529 | ||
530 | int umount_all(bool *changed) { | |
531 | int r; | |
532 | bool umount_changed; | |
533 | LIST_HEAD(MountPoint, mp_list_head); | |
534 | ||
60f067b4 | 535 | LIST_HEAD_INIT(mp_list_head); |
663996b3 MS |
536 | r = mount_points_list_get(&mp_list_head); |
537 | if (r < 0) | |
538 | goto end; | |
539 | ||
540 | /* retry umount, until nothing can be umounted anymore */ | |
541 | do { | |
542 | umount_changed = false; | |
543 | ||
544 | mount_points_list_umount(&mp_list_head, &umount_changed, false); | |
545 | if (umount_changed) | |
546 | *changed = true; | |
547 | ||
548 | } while (umount_changed); | |
549 | ||
550 | /* umount one more time with logging enabled */ | |
551 | r = mount_points_list_umount(&mp_list_head, &umount_changed, true); | |
552 | if (r <= 0) | |
553 | goto end; | |
554 | ||
555 | end: | |
556 | mount_points_list_free(&mp_list_head); | |
557 | ||
558 | return r; | |
559 | } | |
560 | ||
561 | int swapoff_all(bool *changed) { | |
562 | int r; | |
563 | LIST_HEAD(MountPoint, swap_list_head); | |
564 | ||
60f067b4 | 565 | LIST_HEAD_INIT(swap_list_head); |
663996b3 MS |
566 | |
567 | r = swap_list_get(&swap_list_head); | |
568 | if (r < 0) | |
569 | goto end; | |
570 | ||
571 | r = swap_points_list_off(&swap_list_head, changed); | |
572 | ||
573 | end: | |
574 | mount_points_list_free(&swap_list_head); | |
575 | ||
576 | return r; | |
577 | } | |
578 | ||
579 | int loopback_detach_all(bool *changed) { | |
580 | int r; | |
581 | LIST_HEAD(MountPoint, loopback_list_head); | |
582 | ||
60f067b4 | 583 | LIST_HEAD_INIT(loopback_list_head); |
663996b3 MS |
584 | |
585 | r = loopback_list_get(&loopback_list_head); | |
586 | if (r < 0) | |
587 | goto end; | |
588 | ||
589 | r = loopback_points_list_detach(&loopback_list_head, changed); | |
590 | ||
591 | end: | |
592 | mount_points_list_free(&loopback_list_head); | |
593 | ||
594 | return r; | |
595 | } | |
596 | ||
597 | int dm_detach_all(bool *changed) { | |
598 | int r; | |
599 | LIST_HEAD(MountPoint, dm_list_head); | |
600 | ||
60f067b4 | 601 | LIST_HEAD_INIT(dm_list_head); |
663996b3 MS |
602 | |
603 | r = dm_list_get(&dm_list_head); | |
604 | if (r < 0) | |
605 | goto end; | |
606 | ||
607 | r = dm_points_list_detach(&dm_list_head, changed); | |
608 | ||
609 | end: | |
610 | mount_points_list_free(&dm_list_head); | |
611 | ||
612 | return r; | |
613 | } |