From: John Hughes <john@Calva.COM>
To: Jeff Layton <jlayton@redhat.com>
Cc: Jim Rees <rees@umich.edu>,
Trond Myklebust <trond.myklebust@netapp.com>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Don't hang user processes if Kerberos ticket for nfs4 mount expires
Date: Thu, 17 Nov 2011 14:13:38 +0100 [thread overview]
Message-ID: <4EC50882.2080803@Calva.COM> (raw)
In-Reply-To: <4EC4EA91.5070607@Calva.COM>
[-- Attachment #1: Type: text/plain, Size: 931 bytes --]
On 17/11/11 12:05, John Hughes wrote:
> On 17/11/11 02:38, Jeff Layton wrote:
>> Note too that the gssd code distinguishes between an expired TGT and a
>> non-existent credcache. The latter will give you the error you desire
>> here. So one possibility is just to remove the credcache from /tmp in
>> this situation.
>
> Something to scan /tmp for expired credentials and zap em? rpc.gssd
> would communicate that to the kernel?
>
> Whadaya know, that works.
Here's a dumb perl script that could be run from, for example, .xsession
to automatically destroy expired ticket caches.
Would need a bit of trickery to make it go away on end of session and
something in /etc/pm/sleep.d to send it a SIGALRM when the system wakes
from suspend or hibernate.
It has a potential race between destroying an expired ticket and a new
ticket being granted.
I guess now I'll look at a hack to rpc.gssd for a neater way of doing this.
[-- Attachment #2: monitor-tickets --]
[-- Type: text/plain, Size: 1308 bytes --]
#! /usr/bin/perl -w
my $ALARMED = 0;
$SIG{ALRM} = sub { ++$ALARMED; };
use POSIX qw(mktime);
# Work out ticket expiry
# Valid starting Expires Service principal
# 11/17/11 10:34:23 11/17/11 20:34:23 krbtgt/CALVAEDI.COM@CALVAEDI.COM
# renew until 11/18/11 10:34:23
# 11/17/11 10:34:23 11/17/11 20:34:23 nfs/olympic.calvaedi.com@CALVAEDI.COM
# renew until 11/18/11 10:34:23
# 11/17/11 11:24:24 11/17/11 20:34:23 host/olympic.calvaedi.com@CALVAEDI.COM
# renew until 11/18/11 10:34:23
# Eurgh - non localised, US format dates.
sub expiry {
local *KLIST;
open KLIST, "/usr/bin/klist | " or return;
my $expiry;
while (<KLIST>) {
if (m((\d+)/(\d+)/(\d+) (\d+):(\d+):(\d+) krbtgt)) {
$expiry = mktime ($6, $5, $4, $2, $1 - 1, 100 + $3);
last;
}
}
$expiry;
}
for (;;) {
my $sleepytime = 60;
my $expiry = expiry ();
if (defined $expiry) {
my $left = $expiry - time;
if ($left <= 0) {
# Ticket expired, zap it. Potential race with
# new ticket creation.
print "Destroy expired ticket\n";
system "/usr/bin/kdestroy";
}
else {
$sleepytime = $left;
}
}
if ($ALARMED) {
$ALARMED = 0;
next;
}
# If machine freezes during this sleap how long will
# it sleep for?
print "Sleeping for $sleepytime seconds\n";
sleep $sleepytime;
}
next prev parent reply other threads:[~2011-11-17 13:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 18:14 [PATCH] Don't hang user processes if Kerberos ticket for nfs4 mount expires John Hughes
2011-11-16 19:47 ` Jeff Layton
2011-11-16 23:44 ` Jim Rees
2011-11-17 1:31 ` Jeff Layton
2011-11-17 1:38 ` Jeff Layton
2011-11-17 11:05 ` John Hughes
2011-11-17 13:13 ` John Hughes [this message]
2011-11-17 21:46 ` Jeff Layton
2011-11-18 1:51 ` Jim Rees
2011-11-18 2:03 ` Jeff Layton
[not found] ` <4EC62325.1060009@Calva.COM>
2011-11-18 12:50 ` Jim Rees
2011-11-17 1:46 ` Matt W. Benjamin
2011-11-17 9:37 ` John Hughes
-- strict thread matches above, loose matches on Subject: below --
2011-11-18 17:16 Myklebust, Trond
2011-11-18 17:54 ` Jim Rees
2011-11-18 18:23 ` Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EC50882.2080803@Calva.COM \
--to=john@calva.com \
--cc=jlayton@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=rees@umich.edu \
--cc=trond.myklebust@netapp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).