[12123] in Athena Bugs

home help back first fref pref prev next nref lref last post

Re: Athena 7.7 on Solaris attach bug: -f doesnt

daemon@ATHENA.MIT.EDU (Derek Atkins)
Sat Jun 18 23:34:56 1994

To: Bill Cattey <wdc@MIT.EDU>
Cc: rel-eng@MIT.EDU, bugs@MIT.EDU
In-Reply-To: [3235] in Release_Engineering
Date: Sat, 18 Jun 94 23:34:52 EDT
From: Derek Atkins <warlord@MIT.EDU>

For the record (I talked to wdc and vrt about this)...

We found this under Linux as well.  The problem is that when you try
to detach the filesystem under Linux (as well as solaris) detach forks
off a umount.  Umount, seeing that the locker is not mounted, returns
error code 1 (trying to unmount something not mounted *is* an error
;-) Detach, seeing the return code of 1, thinks that umount really
failed.

Anyways, we made a patch for this, which then stats the mountpoint and
its parent directory and compares the devices of the two places, and
if they are equal, then it knows that the unmount was successful, and
assumes the mount really did succeed (this check is only performed if
the umount fails).

I sent vrt this patch (and supposedly he has already applied it).  But
for the record, here it is.

-derek

*** /tmp/,RCSt1MmcC_G	Sat Jun 18 23:33:57 1994
--- unmount.c	Sun May  8 03:25:40 1994
***************
*** 1,5 ****
  /*
!  * $Id: unmount.c,v 1.1 94/05/08 06:44:32 svalente Exp $
   *
   * Copyright (c) 1988,1991 by the Massachusetts Institute of Technology.
   *
--- 1,5 ----
  /*
!  * $Id: unmount.c,v 1.2 1994/05/08 07:25:15 svalente Exp $
   *
   * Copyright (c) 1988,1991 by the Massachusetts Institute of Technology.
   *
***************
*** 6,12 ****
   * For redistribution rights, see "mit-copyright.h"
   */
  
! static char *rcsid_mount_c = "$Header: /sipb-nfs/u2/lockers/linux-athena/attach/RCS/unmount.c,v 1.1 94/05/08 06:44:32 svalente Exp $";
  
  #include "attach.h"
  
--- 6,12 ----
   * For redistribution rights, see "mit-copyright.h"
   */
  
! static char *rcsid_mount_c = "$Header: /usr/src/athena/attach/RCS/unmount.c,v 1.2 1994/05/08 07:25:15 svalente Exp $";
  
  #include "attach.h"
  
***************
*** 66,72 ****
  		wait(&status);
  		break;
  	}
! 	return(status ? FAILURE : SUCCESS);
  
  #else /* !UMOUNT_CMD */
  
--- 66,72 ----
  		wait(&status);
  		break;
  	}
! 	return(status == 0 || ! is_mountpoint (mntpt) ? SUCCESS : FAILURE);
  
  #else /* !UMOUNT_CMD */
  
***************
*** 275,277 ****
--- 275,305 ----
      return (SUCCESS);
  }
  #endif
+ 
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <string.h>
+ 
+ int is_mountpoint (dirname)
+     char *dirname;
+ {
+     struct stat rootstat, pointstat;
+     char *parent;
+     int len;
+ 
+     parent = strdup (dirname);
+     len = strlen (parent) - 1;
+     while (dirname[len] == '/') len--;
+     while (len > 0 && dirname[len] != '/') len--;
+     len++;
+     parent[len] = 0;
+ 
+     if (stat (parent, &rootstat) < 0) {
+ 	return (FALSE);
+     }
+     if (stat (dirname, &pointstat) < 0) {
+ 	return (FALSE);
+     }
+     free (parent);
+     return (rootstat.st_dev != pointstat.st_dev);
+ }


home help back first fref pref prev next nref lref last post