[linux-lvm] Devfs and lvm problems

Stefan Paletta paletta at WRonline.de
Tue Apr 18 16:06:45 UTC 2000


matthaes at pharos.hsp.de wrote/schrieb/scribsit:
> 1.) devfsd doesn´t create /dev/vg00/group etc files, so vgchange -ay
>     fails
> 
> 2.) vgscan fails with 
> 
> vgscan -- found inactive volume group "vg00"
> vgscan -- ERROR "lvm_remouverecursive(): opendir" removing volume group directory and special files
> vgscan -- ERROR "lvm_remouverecursive(): opendir" creating "/etc/lvmtab" and "/etc/lvmtab.d"

The problem is that vgscan wants to recursively remove /dev/vg00 and
its contents but mishandles the case that /dev/vg00 does not even
exist anymore (since after a reboot a devfs is 'clean').

This is easy to fix, I'm attaching a patch.
Would the lvmtools maintainer consider this patch for inclusion into
the tree?

Stefan
-------------- next part --------------
--- 0.8final/tools/lib/lvm_remove_recursive.c.orig	Tue Feb 22 03:09:32 2000
+++ 0.8final/tools/lib/lvm_remove_recursive.c	Tue Apr 18 10:27:44 2000
@@ -33,9 +33,9 @@
 #ifdef DEBUG
    debug_enter ( "lvm_remove_recursive -- CALLED with dir: %s\n", dir);
 #endif
-   if ( dir != NULL) {
+   if ( (dir != NULL) && (lstat ( dir, &sb) == 0) ) {
       /* check beeing called with a file name */
-      if ( lstat ( dir, &sb) == 0 && !S_ISDIR ( sb.st_mode)) unlink ( dir);
+      if (  !S_ISDIR ( sb.st_mode)) unlink ( dir);
       else {
          /* open and read the directory */
          if ( ( this_dir = opendir ( dir)) != NULL) {


More information about the linux-lvm mailing list