[1234] in Moira

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

Re: afs_rename.pl

daemon@ATHENA.MIT.EDU (Jonathon Weiss)
Thu Jan 7 07:20:49 1999

From: Jonathon Weiss <jweiss@MIT.EDU>
To: Ted McCabe <ted@MIT.EDU>
Cc: moiradev@MIT.EDU
In-Reply-To: Your message of "Mon, 16 Mar 1998 14:37:26 EST."
             <199803161937.OAA16123@chaos.MIT.EDU> 
Date: Thu, 07 Jan 1999 07:20:45 EST

> I just noticed (while helping someone recover a file from a .backup
> volume) that moira doesn't deal with renaming the OldFiles mountpoint
> (if it exists) when it renames the volume.
> 
> At a minimum, should have some logic along the lines of:
> )verify existence and correctness of original OldFiles mtpt
> )if verification passed, then remove and create new OldFiles mtpt,
> otherwise do nothing.

Well, I generated a completely untested patch that verifies the
existance, but not correctness of the OldFiles mountpoint.  

It also has the side effect of stripping sms from the acl if it should
happen to be there.  Any suggestions on a better way to deal with that
will be welcomed.

Could some one test/audit/somethign this patch?

Index: afs_rename.pl
===================================================================
RCS file: /mit/moiradev/repository/moira/incremental/afs_rename.pl,v
retrieving revision 1.6
diff -c -r1.6 afs_rename.pl
*** afs_rename.pl	1998/11/18 19:22:31	1.6
--- afs_rename.pl	1999/01/07 12:16:37
***************
*** 76,81 ****
--- 76,96 ----
  if ($newtype eq "AFS") {
      &run("$fs mkm $newpath $newvname");
      push(@clean, "$fs rmm $newpath");
+     $oldfilespath = $newpath . "/OldFiles";
+     open(FS, "$fs lsm $oldfilespath|");
+     chop($_ = <FS>);
+     close(FS);
+     if (! $?) {
+ 	($oldofvname = $_) =~ s/^.* volume '.(.*)'$/\1/;
+ 	$newofvname = $newvname . ".backup";
+ 	&run("$fs sa $newpath sms all");
+ 	push(@clear "$fs sa $newpath sms none");
+ 	&run("$fs rmm $oldfilespath");
+ 	push(@clean, "$fs mkm $oldfilespath $oldofvname");
+ 	&run("$fs mkm $oldfilespath $newofvname");
+ 	push(@clean, "$fs rmm $oldfilespath");
+ 	&run("$fs sa $newpath sms none");
+     }
      &release_parent($newpath);
  }
  



	Jonathon

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