Bug#508523: follow-up information on 2.6.26 vserver regression
To follow up on this problem, it appears that files created by "vserver
hashify" under 2.6.26 are missing the "U" attribute:
# /usr/sbin/showattr rate.pm
-----uI- rate.pm
The "I" (Immutable) flag is on, but the "U" flag which turns an
immutable file into a vserver-copy-on-write file is missing. (U stands
for Immutable-Invert-on-Unlink)
A file hashed under 2.6.25, or fixed manually ("/usr/sbin/setattr
--iunlink filename") looks like this:
# /usr/sbin/showattr rate.pm
-----UI- rate.pm
And of course, files which are not hashed across multiple vservers have
neither flag:
# /usr/sbin/showattr intlrates.csv
-----ui- intlrates.csv
Cc:ing util-vserver maintainer in case he has any input to add on what
"vserver hashify" from util-vserver does to create copy-on-write files
and why it might be failing on 2.6.26 but worked fine on 2.6.25.
Here is a quick script to fix permissions, for any folks having this
problem. I'm running this in my weekly vserver hashify cron job,
between the "vserver hashify" steps and the step to remove orphan files,
i.e.
#!/bin/sh
for a in `ls /var/lib/vservers/`; do mkdir -p /etc/vservers/$a/apps/vunify; vserver --verbose $a hashify; done
/home/ivan/fixvservers/fixvservers #kludge step
find /var/lib/vservers/.hash -type f -links 1 -print0 | xargs -0 rm
fixvservers script follows:
#!/usr/bin/perl
use File::Find;
use String::ShellQuote;
find( \&wanted, '/var/lib/vservers' );
sub wanted {
my $dir = $File::Find::dir;
my $file = $_;
my $pathname = $File::Find::name;
return if $pathname =~ qr{^/var/lib/vservers/\w+/(dev|proc)/};
return if -l $file
|| -p $file
|| -S $file
|| -b $file
|| -c $file
|| -t $file
;
$qfile = shell_quote $file;
chomp( my $showattr = `/usr/sbin/showattr -d $qfile` );
my( $attr, $fileagain ) = split(' ', $showattr);
return unless $attr =~ /^.....Ui.$/ || $attr =~ /^.....uI.$/;
#print "$attr $pathname\n";
if ( $attr =~ /^.....Ui.$/ ) {
die "U but not I???";
#system("/usr/sbin/setattr --immutable $qfile");
} elsif ( $attr =~ /^.....uI.$/ ) {
system("/usr/sbin/setattr --iunlink $qfile");
} else {
die "guru meditation";
}
}
--
_ivan
Reply to: