Skip to content

Commit

Permalink
libmount: (loop) detect and report lost loop nodes
Browse files Browse the repository at this point in the history
Fixed: util-linux#2605
Signed-off-by: Karel Zak <kzak@redhat.com>
  • Loading branch information
karelzak committed May 22, 2024
1 parent 41476dd commit 9f94d12
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libmount/src/hook_loopdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,14 @@ static int setup_loopdev(struct libmnt_context *cxt,
goto done_no_deinit;
if (mnt_opt_has_value(loopopt)) {
rc = loopcxt_set_device(&lc, mnt_opt_get_value(loopopt));
if (rc == 0 && loopcxt_is_lost(&lc)) {
DBG(LOOP, ul_debugobj(cxt, "node lost"));

dev_t devno = loopcxt_get_devno(&lc);
mnt_context_sprintf_errmsg(cxt, _("device node %s (%u:%u) is lost"),
loopcxt_get_device(&lc), major(devno), minor(devno));
rc = -EINVAL;
}
if (rc == 0)
loopdev = loopcxt_get_device(&lc);
}
Expand Down

0 comments on commit 9f94d12

Please sign in to comment.