From b1fc976e94527d554c89bdc923de98b22b3bc62b Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 4 May 2010 16:26:15 -0700 Subject: [PATCH] Check if AFS is mounted before killing processes with open files * Skip killing processes with files open in AFS if AFS does not appear to be mounted according to /etc/mtab. Otherwise, we may call lsof without a specific mount point and kill far more processes than we intend to. (This code is disabled by default, so this problem would only be seen by people who enabled it.) --- debian/changelog | 10 ++++++++++ debian/openafs-client.init | 10 ++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 398946ea6..b99719110 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +openafs (1.4.12+dfsg-5) unstable; urgency=low + + * Skip killing processes with files open in AFS if AFS does not appear + to be mounted according to /etc/mtab. Otherwise, we may call lsof + without a specific mount point and kill far more processes than we + intend to. (This code is disabled by default, so this problem would + only be seen by people who enabled it.) + + -- Russ Allbery Tue, 04 May 2010 16:26:06 -0700 + openafs (1.4.12+dfsg-4) unstable; urgency=low * Apply upstream deltas: diff --git a/debian/openafs-client.init b/debian/openafs-client.init index 6ad150da9..02de249b5 100755 --- a/debian/openafs-client.init +++ b/debian/openafs-client.init @@ -178,10 +178,12 @@ start_client() { kill_afs() { signal=$1 mount=`grep ^'AFS ' /etc/mtab | awk '{ print $2 }'` - pids=`/usr/bin/lsof -Fp $mount | sed 's/p//'` - if [ -n "$pids" ] ; then - kill -$signal $pids > /dev/null 2>&1 - sleep 1 + if [ -n "$mount" ] ; then + pids=`/usr/bin/lsof -Fp $mount | sed 's/p//'` + if [ -n "$pids" ] ; then + kill -$signal $pids > /dev/null 2>&1 + sleep 1 + fi fi } -- 2.39.5