[OpenAFS-devel] openafs rpm patches

Alexander Bergolth leo@strike.wu-wien.ac.at
Thu, 25 Aug 2005 15:38:33 +0200


This is a multi-part message in MIME format.
--------------010500080508070704070001
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

Thanks for your openafs RPM! It works very well for me except for a few
issues:

*) The killafs script has a serious bug: If /afs is not mounted,
fuser -km /afs will kill all processes that have open files in the
_root_ filesystem!

*) I'm using it on FC3 so a few fixes to openafs-bestmod were necessary
to accept the FC3 kernel naming scheme.

*) I removed the BuildRequires: kernel-hugemem-devel because FC3 doesn't
have a hugemem kernel.

*) The Copyright: tag in the spec-file should be replaced by License:

See the attached patches for the corresponding fixes.

Cheers,
- --leo
- --
- -----------------------------------------------------------------------
Alexander.Bergolth@wu-wien.ac.at                Fax: +43-1-31336-906050
Zentrum fuer Informatikdienste - Wirtschaftsuniversitaet Wien - Austria

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFDDcnZsYaksEkoAQMRAkhZAJ9MhNScIwiOmE6CpAJm0l7sMBsMOgCff0MC
rmKW21248eiY4NRMo1Vu9/0=
=TZKV
-----END PGP SIGNATURE-----

--------------010500080508070704070001
Content-Type: text/x-patch;
 name="openafs-bestmod.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="openafs-bestmod.patch"

--- openafs-bestmod.orig	2005-08-25 12:24:16.272848160 +0200
+++ openafs-bestmod	2005-08-25 15:01:17.490605360 +0200
@@ -20,7 +20,7 @@
 my $modname = $ARGV[1];
 
 # version, release, type, and arch of the current kernel
-my ($kver, $krel, $ktype, $karch);
+my ($kver, $krel, $ktype, $karch, $kdist, $krest);
 
 
 # parserel RELEASESTRING
@@ -31,19 +31,18 @@
 	my $s = $_[0];
 	my $rel = '';
 	my $type;
+	my $dist;
+	my $rest;
 
 	my @types = ('', 'smp', 'hugemem');
-	foreach my $t (@types) {
-		my $x = '.EL' . $t;
-		my $l = length($x);
-
-		if (substr($s, -$l) eq $x) {
-			$rel = substr($s, 0, -$l);
-			$type = $t;
-		}
+	if ($s =~ /(.+)(_FC\d+|\.EL)(smp|hugemem)?(.*)/) {
+	    $rel = $1;
+	    $dist = $2;
+	    $type = $3;
+	    # matches tags like .stk16 in "1372_FC3.stk16"
+	    $rest = $4;
 	}
-
-	return ($rel, $type);
+	return ($rel, $type, $dist, $rest);
 }
 
 # Format the file name of the matching kernel module.
@@ -51,7 +50,7 @@
 	my $rel = $_[0];
 
 	print $moddir . '/' . $modname . '-' . $kver . '-' . $rel . 
-		'.EL' . $ktype . '-' . $karch . '.ko' . "\n";
+		$kdist . $ktype . $krest. '-' . $karch . '.ko' . "\n";
 
 	exit(0);
 }
@@ -76,14 +75,14 @@
 $kver = @x[0];
 my $krelstr = @x[1];
 
-($krel, $ktype) = parserel($krelstr);
+($krel, $ktype, $kdist, $krest) = parserel($krelstr);
 
 if ($krel eq '') {
 	print STDERR "Invalid kernel release: $krelstr\n";
 	exit(1);
 }
 
-
+# print STDERR "Kernel: ver: $kver, arch: $karch, type: $ktype, dist: $kdist, rest: $krest\n";
 
 # Now look through all the modules to see which one is closest.
 my @modrels;
@@ -115,20 +114,24 @@
 	my $relstr = @x[2];
 	my $arch = @x[3];
 
+	# print STDERR "$o: ver: $ver, arch: $arch\n";
+
 	# name, version, and arch must match.
 	if (($name ne $modname) || ($ver ne $kver) || ($arch ne $karch)) {
 		next;
 	}
 
-	my ($rel, $type) = parserel($relstr);
+	my ($rel, $type, $dist, $rest) = parserel($relstr);
+
+	# print STDERR "   rel: $rel, type: $type, dist: $dist\n";
 
 	# skip invalid release names
 	if ($rel eq '') {
 		next;
 	}
 
-	# type must also match
-	if ($type ne $ktype) {
+	# type, distribution and an optional tag must also match
+	if (($type ne $ktype) || ($dist ne $kdist) || ($rest ne $krest)) {
 		next;
 	}
 

--------------010500080508070704070001
Content-Type: text/x-patch;
 name="openafs-killafs.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="openafs-killafs.patch"

--- openafs-killafs.orig	2005-08-25 15:00:01.146211472 +0200
+++ openafs-killafs	2005-08-25 15:00:50.269743560 +0200
@@ -11,12 +11,14 @@
 	exit 1
 fi
 
-/sbin/fuser -$1 -km /afs >/dev/null
+if mount | grep ' on /afs '; then
+  /sbin/fuser -$1 -km /afs >/dev/null
 
-# If the processes are still there, sleep a while to give them a chance to 
-# die.
+  # If the processes are still there, sleep a while to give them a chance to 
+  # die.
 
-/sbin/fuser -m /afs >/dev/null
-if [ $? -eq 0 ]; then
-	sleep 5
+  /sbin/fuser -m /afs >/dev/null
+  if [ $? -eq 0 ]; then
+      sleep 5
+  fi
 fi

--------------010500080508070704070001
Content-Type: text/x-patch;
 name="openafs-spec-FC3.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="openafs-spec-FC3.patch"

--- SPECS/openafs.spec	2005-08-22 21:33:35.000000000 +0200
+++ openafs-leo.spec	2005-08-25 15:18:22.492781344 +0200
@@ -9,7 +9,7 @@
 #	For Linux 2.4:	24
 #	For Linux 2.6:	26
 #
-%define osvers rhel4
+%define osvers rhfc3
 %define kernvers 26
 
 # This is where to look for kernel-build includes files.
@@ -55,14 +55,14 @@
 Name: openafs
 Version: %{rpmvers}
 Release: %{osvers}.%{pkgrel}
-Copyright: IPL
+License: IPL
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 Packager: Chris Wing <wingc@engin.umich.edu>
 Group: Networking/Filesystems
 BuildRequires: kernel-devel kernel-smp-devel
 
 %ifarch i386 i486 i586 i686 athlon
-BuildRequires: kernel-hugemem-devel
+# BuildRequires: kernel-hugemem-devel
 %endif
 
 %if %{krb5support}
@@ -529,7 +529,9 @@
 
 # Pick up all the 'appropriate' kernels
 # XXX: should filter out headers for wrong arch
-kvers=`ls -d %{kbase}* | sed 's^%{kbase}^^g' | grep $kv`
+# 2.6.12-1.1372_FC3smp-i686 is a symlink to 2.6.12-1.1372_FC3-smp-i686
+# remove ...FC3-smp-i686 to avoid compilation of two identical kernel modules
+kvers=`ls -d %{kbase}* | sed 's^%{kbase}^^g' | grep $kv | grep -v -- -smp`
 
 # Choose the last one for now.. It doesn't really matter, really.
 hdrdir=`ls -d %{kbase}*%{kend} | grep $kv | tail -1`

--------------010500080508070704070001--