diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4recover.c | 36 |
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; | ||
1095 | do_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 " |