While I was checking out LVM, I ran into a problem with the 2.00.31 version of LVM2. When I tried to create a new PV on /dev/sdb, pvcreate failed and went into an infinite loop trying to close a file-descriptor. This only happened when no .cache file was present in /etc/lvm and only on /dev/sdb, i.e. /dev/sdb1 did work. Some debugging showed that the culprit was the recent change to the dev_open_flags code. The problem seems to be the reopening of the fd in RW mode without closing the old RO one. The patch below solved the problem for me, but I did not give it very much testing. Hope this helps. Greetz, Jerome Borsboom diff -ru LVM2.2.00.31/lib/device/dev-io.c LVM2.2.00.31.new/lib/device/dev-io.c --- LVM2.2.00.31/lib/device/dev-io.c 2004-12-12 22:47:14.000000000 +0100 +++ LVM2.2.00.31.new/lib/device/dev-io.c 2004-12-16 17:03:09.503357553 +0100 @@ -292,6 +292,7 @@ { struct stat buf; const char *name; + int old_open_count = 0; if (dev->fd >= 0) { if ((dev->flags & DEV_OPENED_RW) || @@ -299,12 +300,12 @@ dev->open_count++; return 1; } - - if (dev->open_count) - log_debug("WARNING: %s already opened read-only", - dev_name(dev)); - else - dev_close_immediate(dev); + else { + if (dev->open_count) + log_debug("WARNING: %s already opened read-only", + dev_name(dev)); + old_open_count = dev->open_count; + dev_close_immediate(dev); } } if (memlock()) @@ -340,7 +341,7 @@ return 0; } - dev->open_count = 1; + dev->open_count = old_open_count + 1; dev->flags &= ~DEV_ACCESSED_W; if ((flags & O_ACCMODE) == O_RDWR) dev->flags |= DEV_OPENED_RW; _______________________________________________ linux-lvm mailing list linux-lvm@redhat.com https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/