aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-11-12 15:00:49 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-11-12 18:55:10 -0500
commit2d77bf0a55d64559adb2d48a37bc7e876d6adc11 (patch)
treee1ac2048306f446d03038c68b1b7a94a601b2735 /fs
parent2873d2147e1e14b82367bde14354a011ffda0496 (diff)
nfsd: change heuristic for selecting the client_tracking_ops
First, try to use the new usermodehelper upcall. It should succeed or fail quickly, so there's little cost to doing so. If it fails, and the legacy tracking dir exists, use that. If it doesn't exist then fall back to using nfsdcld. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4recover.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 2fc2f6cb8d9..e71f713bd7c 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -1064,17 +1064,35 @@ nfsd4_client_tracking_init(struct net *net)
1064 int status; 1064 int status;
1065 struct path path; 1065 struct path path;
1066 1066
1067 if (!client_tracking_ops) { 1067 /* just run the init if it the method is already decided */
1068 client_tracking_ops = &nfsd4_cld_tracking_ops; 1068 if (client_tracking_ops)
1069 status = kern_path(nfs4_recoverydir(), LOOKUP_FOLLOW, &path); 1069 goto do_init;
1070 if (!status) { 1070
1071 if (S_ISDIR(path.dentry->d_inode->i_mode)) 1071 /*
1072 client_tracking_ops = 1072 * First, try a UMH upcall. It should succeed or fail quickly, so
1073 &nfsd4_legacy_tracking_ops; 1073 * there's little harm in trying that first.
1074 path_put(&path); 1074 */
1075 } 1075 client_tracking_ops = &nfsd4_umh_tracking_ops;
1076 status = client_tracking_ops->init(net);
1077 if (!status)
1078 return status;
1079
1080 /*
1081 * See if the recoverydir exists and is a directory. If it is,
1082 * then use the legacy ops.
1083 */
1084 client_tracking_ops = &nfsd4_legacy_tracking_ops;
1085 status = kern_path(nfs4_recoverydir(), LOOKUP_FOLLOW, &path);
1086 if (!status) {
1087 status = S_ISDIR(path.dentry->d_inode->i_mode);
1088 path_put(&path);
1089 if (status)
1090 goto do_init;
1076 } 1091 }
1077 1092
1093 /* Finally, try to use nfsdcld */
1094 client_tracking_ops = &nfsd4_cld_tracking_ops;
1095do_init:
1078 status = client_tracking_ops->init(net); 1096 status = client_tracking_ops->init(net);
1079 if (status) { 1097 if (status) {
1080 printk(KERN_WARNING "NFSD: Unable to initialize client " 1098 printk(KERN_WARNING "NFSD: Unable to initialize client "