[1328] in Moira
afs_rename.pl change
daemon@ATHENA.MIT.EDU (Ted McCabe)
Tue Feb 8 13:20:37 2000
Mime-Version: 1.0
Message-Id: <v04220804b4c6014cb708@[18.177.1.78]>
Date: Tue, 8 Feb 2000 13:20:20 -0500
To: moiradev@mit.edu
From: Ted McCabe <ted@MIT.EDU>
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
I spent some time this morning tracking down a problem for the f_l's
which resulted because of a filsys update on a volume that was over
quota. The update was simply to the comment field, but moira called
afs_rename.pl to do it's magic anyway.
Because the volume was over quota, the recreation of the OldFiles
mtpt failed and cleanup made things worse.
When afs_rename.pl tried to clean up, it did so in the same order it
started, instead of reverse order - causing the mountpoint for the
volume to be removed (because the cleanup order was mkm then rmm
instead of rmm then mkm)
Here's some changes for review. The first change prevents the
OldFiles magic from happening if the volume name is unchanged. The
second does the cleanup in the reverse order so that it's more likely
to do the right thing.
If the OldFiles mountpoint needs to be changed for a volume that's
over quota, there isn't any right way to actually make the change.
The question becomes one of, "What's the right way to fail?".
--Ted
*** afs_rename.pl Tue Nov 16 15:34:15 1999
--- /tmp/afs_rename.pl Tue Feb 8 12:36:24 2000
***************
*** 83,95 ****
if (! $?) {
($oldofvname = $_) =~ s/^.* volume '.(.*)'$/\1/;
$newofvname = $newvname . ".backup";
! &run("$fs sa $newpath sms all");
! push(@clean, "$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);
}
--- 83,97 ----
if (! $?) {
($oldofvname = $_) =~ s/^.* volume '.(.*)'$/\1/;
$newofvname = $newvname . ".backup";
! if ($newofvname ne $oldofvname) {
! &run("$fs sa $newpath sms all");
! push(@clean, "$fs sa $newpath sms none");
! &run("$fs rmm $oldfilespath");
! push(@clean, "$fs mkm $oldfilespath $oldofvname");
! &run("$fs mkm $oldfilespath $newofvname");
! &run("$fs sa $newpath sms none");
! }
}
&release_parent($newpath);
}
***************
*** 115,121 ****
s/\n$//;
while (@clean) {
! $cmd = shift(@clean);
warn "$newname: Cleanup failed: $cmd\n" if (system("$cmd"));
}
die "$newname: $_\n";
--- 117,123 ----
s/\n$//;
while (@clean) {
! $cmd = pop(@clean);
warn "$newname: Cleanup failed: $cmd\n" if (system("$cmd"));
}
die "$newname: $_\n";