Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347707
b: refs/heads/master
c: 9a9c647
h: refs/heads/master
i:
  347705: feaf7e9
  347703: ba4f3dd
v: v3
  • Loading branch information
Stanislav Kinsbursky authored and J. Bruce Fields committed Dec 10, 2012
1 parent 2085120 commit f148fed
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9b2ef62b1541f176ea1b1f6e13b16df14bb16e99
refs/heads/master: 9a9c6478a8b6ce8b6da6b6d1e15f365b505895cd
2 changes: 2 additions & 0 deletions trunk/fs/nfsd/netns.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define SESSION_HASH_SIZE 512

struct cld_net;
struct nfsd4_client_tracking_ops;

struct nfsd_net {
struct cld_net *cld_net;
Expand Down Expand Up @@ -87,6 +88,7 @@ struct nfsd_net {

struct file *rec_file;
bool in_grace;
struct nfsd4_client_tracking_ops *client_tracking_ops;

time_t nfsd4_lease;
time_t nfsd4_grace;
Expand Down
48 changes: 28 additions & 20 deletions trunk/fs/nfsd/nfs4recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ struct nfsd4_client_tracking_ops {

/* Globals */
static char user_recovery_dirname[PATH_MAX] = "/var/lib/nfs/v4recovery";
static struct nfsd4_client_tracking_ops *client_tracking_ops;

static int
nfs4_save_creds(const struct cred **original_creds)
Expand Down Expand Up @@ -1262,25 +1261,26 @@ nfsd4_client_tracking_init(struct net *net)
{
int status;
struct path path;
struct nfsd_net *nn = net_generic(net, nfsd_net_id);

/* just run the init if it the method is already decided */
if (client_tracking_ops)
if (nn->client_tracking_ops)
goto do_init;

/*
* First, try a UMH upcall. It should succeed or fail quickly, so
* there's little harm in trying that first.
*/
client_tracking_ops = &nfsd4_umh_tracking_ops;
status = client_tracking_ops->init(net);
nn->client_tracking_ops = &nfsd4_umh_tracking_ops;
status = nn->client_tracking_ops->init(net);
if (!status)
return status;

/*
* See if the recoverydir exists and is a directory. If it is,
* then use the legacy ops.
*/
client_tracking_ops = &nfsd4_legacy_tracking_ops;
nn->client_tracking_ops = &nfsd4_legacy_tracking_ops;
status = kern_path(nfs4_recoverydir(), LOOKUP_FOLLOW, &path);
if (!status) {
status = S_ISDIR(path.dentry->d_inode->i_mode);
Expand All @@ -1290,58 +1290,66 @@ nfsd4_client_tracking_init(struct net *net)
}

/* Finally, try to use nfsdcld */
client_tracking_ops = &nfsd4_cld_tracking_ops;
nn->client_tracking_ops = &nfsd4_cld_tracking_ops;
printk(KERN_WARNING "NFSD: the nfsdcld client tracking upcall will be "
"removed in 3.10. Please transition to using "
"nfsdcltrack.\n");
do_init:
status = client_tracking_ops->init(net);
status = nn->client_tracking_ops->init(net);
if (status) {
printk(KERN_WARNING "NFSD: Unable to initialize client "
"recovery tracking! (%d)\n", status);
client_tracking_ops = NULL;
nn->client_tracking_ops = NULL;
}
return status;
}

void
nfsd4_client_tracking_exit(struct net *net)
{
if (client_tracking_ops) {
if (client_tracking_ops->exit)
client_tracking_ops->exit(net);
client_tracking_ops = NULL;
struct nfsd_net *nn = net_generic(net, nfsd_net_id);

if (nn->client_tracking_ops) {
if (nn->client_tracking_ops->exit)
nn->client_tracking_ops->exit(net);
nn->client_tracking_ops = NULL;
}
}

void
nfsd4_client_record_create(struct nfs4_client *clp)
{
if (client_tracking_ops)
client_tracking_ops->create(clp);
struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);

if (nn->client_tracking_ops)
nn->client_tracking_ops->create(clp);
}

void
nfsd4_client_record_remove(struct nfs4_client *clp)
{
if (client_tracking_ops)
client_tracking_ops->remove(clp);
struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);

if (nn->client_tracking_ops)
nn->client_tracking_ops->remove(clp);
}

int
nfsd4_client_record_check(struct nfs4_client *clp)
{
if (client_tracking_ops)
return client_tracking_ops->check(clp);
struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);

if (nn->client_tracking_ops)
return nn->client_tracking_ops->check(clp);

return -EOPNOTSUPP;
}

void
nfsd4_record_grace_done(struct nfsd_net *nn, time_t boot_time)
{
if (client_tracking_ops)
client_tracking_ops->grace_done(nn, boot_time);
if (nn->client_tracking_ops)
nn->client_tracking_ops->grace_done(nn, boot_time);
}

static int
Expand Down

0 comments on commit f148fed

Please sign in to comment.