[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
changeloop brokenness test case
- From: Jeremy Katz <katzj redhat com>
- To: fedora-devel-list redhat com
- Subject: changeloop brokenness test case
- Date: Fri, 30 Jan 2004 12:32:50 -0500
(Background: Since Red Hat Linux 7.0, we've added a kernel patch to
allow switching the backing store for a loopback device which gets used
so that CD installs can switch CDs. This has been ported to 2.6, but
currently isn't working and is blocking test1. In the interest of maybe
more eyes seeing something, here's the test case I sent to Al)
Attached is a simple test program that can be used in reproduce the hang
when we changeloop.
Steps are
1) Copy some image you can loopback mount to /tmp/loop.img (doesn't
matter what, you can even just dd /dev/zero and mke2fs it)
2) losetup /dev/loop0 /tmp/loop.img
3) mount /dev/loop0 /mnt/tmp -o loop,ro
4) cp /tmp/loop.img /tmp/new.img
5) ./testchangeloop /dev/loop0 /tmp/new.img
And watch the process spin in disk wait
Jeremy
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#ifndef LOOP_CHANGE_FD
#define LOOP_CHANGE_FD 0x4C06
#endif
int main(int argc, char ** argv) {
int loopfd, targfd;
int rc = 1;
loopfd = open(argv[1], O_RDWR);
if (loopfd == -1) {
perror("loopfd open");
goto out;
}
targfd = open(argv[2], O_RDWR);
if (targfd == -1) {
perror("targfd open");
goto out;
}
if (ioctl(loopfd, LOOP_CHANGE_FD, targfd) == -1) {
perror("loopchange");
goto out;
}
rc = 0;
out:
close(loopfd);
close(targfd);
exit(rc);
}
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]