3df8c3
diff -up util-linux-2.23.2/lib/loopdev.c.kzak util-linux-2.23.2/lib/loopdev.c
3df8c3
--- util-linux-2.23.2/lib/loopdev.c.kzak	2014-09-25 10:16:23.521897462 +0200
3df8c3
+++ util-linux-2.23.2/lib/loopdev.c	2014-09-25 10:23:38.852050990 +0200
3df8c3
@@ -1129,6 +1129,12 @@ static int loopcxt_check_size(struct loo
3df8c3
 		return -errno;
3df8c3
 	}
3df8c3
 
3df8c3
+	/* It's block device, so, align to 512-byte sectors */
3df8c3
+	if (expected_size % 512) {
3df8c3
+		DBG(lc, loopdev_debug("expected size misaligned to 512-byte sectors"));
3df8c3
+		expected_size = (expected_size >> 9) << 9;
3df8c3
+	}
3df8c3
+
3df8c3
 	if (expected_size != size) {
3df8c3
 		DBG(lc, loopdev_debug("warning: loopdev and expected "
3df8c3
 				      "size dismatch (%ju/%ju)",
3df8c3
diff -up util-linux-2.23.2/sys-utils/losetup.c.kzak util-linux-2.23.2/sys-utils/losetup.c
3df8c3
--- util-linux-2.23.2/sys-utils/losetup.c.kzak	2014-09-25 10:16:23.521897462 +0200
3df8c3
+++ util-linux-2.23.2/sys-utils/losetup.c	2014-09-25 10:23:38.852050990 +0200
3df8c3
@@ -632,11 +632,7 @@ int main(int argc, char **argv)
3df8c3
 			/* errors */
3df8c3
 			errpre = hasdev && loopcxt_get_fd(&lc) < 0 ?
3df8c3
 					 loopcxt_get_device(&lc) : file;
3df8c3
-			if (errno == ERANGE && offset && offset % 512)
3df8c3
-				warnx(_("%s: failed to set up loop device, "
3df8c3
-					"offset is not 512-byte aligned."), errpre);
3df8c3
-			else
3df8c3
-				warn(_("%s: failed to set up loop device"), errpre);
3df8c3
+			warn(_("%s: failed to set up loop device"), errpre);
3df8c3
 			break;
3df8c3
 		} while (hasdev == 0);
3df8c3