linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Prof. Dipl.-Ing. Klaus Knopper" <knopper@knopper.net>
To: linux-kernel@vger.kernel.org
Subject: Fwd: Bug#826328: util-linux: losetup -d disfunctional for cloop and similar loop-compatible block devices
Date: Wed, 8 Jun 2016 09:50:40 +0200	[thread overview]
Message-ID: <20160608075040.GH14586@knopper.net> (raw)

Hello,

As recommended by the Debian package maintainer, I'm forwarding this as
upstream bug report to the kernel list.

Package: util-linux
Version: 2.28-5
Severity: normal
Tags: upstream

Losetup was able to setup compressed loopback (cloop) devices, which
have a similar ioctl API, until recently the code in sys-utils/losetup.c
and lib/loopdev.c was changed to only accept devices with loopbacks
major device id.

While attaching a file to a cloop device still works (no check here),
detaching with -d fails with error message:

losetup: /dev/cloop7: failed to use device: Success

The reason for this is:

---

sys-utils/losetup.c:

case 'd':
	act = A_DELETE;
		if (!is_loopdev(optarg) ||
		    loopcxt_set_device(&lc, optarg))
			err(EXIT_FAILURE, _("%s: failed to use device"),
			optarg);
	break;

---

lib/loopdev.c:

int is_loopdev(const char *device)
{
	struct stat st;

	if (!device)
		return 0;

	return (stat(device, &st) == 0 &&
		S_ISBLK(st.st_mode) &&
		major(st.st_rdev) == LOOPDEV_MAJOR);
}

---

Because of this, losetup from util-linux no longer works for cloop
devices.

Using busybox losetup for now.

Suggestion: Remove the check for

		major(st.st_rdev) == LOOPDEV_MAJOR);

in is_loopdev() in lib/loopdev.c.

Regards
-Klaus Knopper

                 reply	other threads:[~2016-06-08  8:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160608075040.GH14586@knopper.net \
    --to=knopper@knopper.net \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: Fwd: Bug#826328: util-linux: losetup -d disfunctional for cloop and similar loop-compatible block devices' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).