[4678] in Athena Bugs

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

venus/fs.c: multiple bugs

daemon@ATHENA.MIT.EDU (Richard Basch)
Tue Apr 3 18:29:46 1990

Date: Tue, 3 Apr 90 18:29:15 -0400
To: afsbugs+@TRANSARC.COM
Cc: bugs@ATHENA.MIT.EDU, bug-afs@MIT.EDU
From: Richard Basch <probe@MIT.EDU>

Enclosed are several fixes to venus/fs.c:

- It is possible to get extraneous sites listed for a volume if multiple
  volumes are specified and one of the earlier volumes had several
  sites.  The problem is a missing bzero().  [I sent this patch a couple
  days ago].

- I also reported a while ago that "fs" doesn't check for volumes in the
  cell where the mountpoint is being created.  For instance, if I am
  a client in the "athena.mit.edu" cell and create a mountpoint for a
  volume in the "rel-eng.athena.mit.edu" cell, it still checks for the
  volume in the "athena.mit.edu" cell.  You will see from my patch that
  there were actually several tests that were missing.

Enjoy,
-Richard


RCS file: venus/RCS/fs.c,v
retrieving revision 1.43
diff -c -r1.43 venus/fs.c
*** /tmp/,RCSt1018335	Tue Apr  3 18:24:22 1990
--- venus/fs.c	Tue Apr  3 18:23:52 1990
***************
*** 789,794 ****
--- 789,795 ----
  	blob.out_size = MAXSIZE;
  	blob.in_size = 0;
  	blob.out = space;
+ 	bzero(space, sizeof(space));
  	code = pioctl(ti->data, VIOCWHEREIS, &blob, 1);
  	if (code) {
  	    Die(code, ti->data);
***************
*** 987,994 ****
  static MakeMountCmd(as)
  register struct cmd_syndesc *as; {
      register long code;
!     register char *cellName, *volName;
      struct vldbentry vldbEntry;
  
      if (as->parms[5].items && !as->parms[2].items) {
  	printf("fs: must provide cell when creating cellular mount point.\n");
--- 988,996 ----
  static MakeMountCmd(as)
  register struct cmd_syndesc *as; {
      register long code;
!     register char *cellName, *volName, *tmpName;
      struct vldbentry vldbEntry;
+     struct ViceIoctl blob;
  
      if (as->parms[5].items && !as->parms[2].items) {
  	printf("fs: must provide cell when creating cellular mount point.\n");
***************
*** 1001,1006 ****
--- 1003,1022 ----
  	cellName = (char *) 0;
      volName = as->parms[1].items->data;
  
+     /* Check for a cellname in the volume specification, and complain
+      * if it doesn't match what was specified with -cell */
+     if (tmpName = index(volName, ':')) {
+ 	*tmpName = '\0';
+ 	if (cellName) {
+ 	    if (strcasecmp(cellName,volName)) {
+ 		printf("fs: cellnames do not match.\n");
+ 		return 1;
+ 	    }
+ 	}
+ 	cellName = volName;
+ 	volName = ++tmpName;
+     }
+ 	
      if (!InAFS(Parent(as->parms[0].items->data))) {
  	printf("fs: mount points must be created within the AFS file system\n");
  	return 1;
***************
*** 1007,1014 ****
      }
  
      if (!(as->parms[4].items)) {
  	/* not fast, check name with VLDB */
! 	code = VLDBInit(1, AFSCONF_CLIENTNAME, cellName);
  	if (code == 0) {
  	    /* make the check.  Don't complain if there are problems with init */
  	    code = ubik_Call(VL_GetEntryByName, uclient, 0, volName, &vldbEntry);
--- 1023,1041 ----
      }
  
      if (!(as->parms[4].items)) {
+ 	/* not fast, check which cell the mountpoint is being created in */
+ 	code = 0;
+ 	if (!cellName) {
+ 	    blob.in_size = 0;
+ 	    blob.out_size = MAXSIZE;
+ 	    blob.out = space;
+ 	    code = pioctl(Parent(as->parms[0].items->data),
+ 			  VIOC_FILE_CELL_NAME, &blob, 1);
+ 	}
+ 
  	/* not fast, check name with VLDB */
! 	if (!code)
! 	    code = VLDBInit(1, AFSCONF_CLIENTNAME, cellName?cellName:space);
  	if (code == 0) {
  	    /* make the check.  Don't complain if there are problems with init */
  	    code = ubik_Call(VL_GetEntryByName, uclient, 0, volName, &vldbEntry);
***************
*** 1024,1032 ****
  	strcpy(space, "%");
      else
  	strcpy(space, "#");
!     if (as->parms[5].items) {	/* parms[2] alrady checked for existence above */
  	/* cellular mount point, prepend cell prefix */
! 	strcat(space, as->parms[2].items->data);
  	strcat(space, ":");
      }
      strcat(space, volName);	/* append volume name */
--- 1051,1059 ----
  	strcpy(space, "%");
      else
  	strcpy(space, "#");
!     if (cellName) {
  	/* cellular mount point, prepend cell prefix */
! 	strcat(space, cellName);
  	strcat(space, ":");
      }
      strcat(space, volName);	/* append volume name */

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