aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@primarydata.com>2014-09-12 16:40:21 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-09-17 16:33:17 -0400
commit788a7914ad43380d31efed1c4d14b5f2c466a764 (patch)
treefe27e8595c23a8966d3814ebc76dfb9aea17f3e9
parentd682e750ce14cfb3be655e6d492c77511e637228 (diff)
nfsd: set and test NFSD4_CLIENT_STABLE bit to reduce nfsdcltrack upcalls
The nfsdcltrack upcall doesn't utilize the NFSD4_CLIENT_STABLE flag, which basically results in an upcall every time we call into the client tracking ops. Change it to set this bit on a successful "check" or "create" request, and clear it on a "remove" request. Also, check to see if that bit is set before upcalling on a "check" or "remove" request, and skip upcalling appropriately, depending on its state. Signed-off-by: Jeff Layton <jlayton@primarydata.com>
-rw-r--r--fs/nfsd/nfs4recover.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index bf3a3575d060..d0fc003d130a 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -1296,7 +1296,8 @@ nfsd4_umh_cltrack_create(struct nfs4_client *clp)
1296 grace_start = nfsd4_cltrack_grace_start(nn->boot_time); 1296 grace_start = nfsd4_cltrack_grace_start(nn->boot_time);
1297 1297
1298 nfsd4_cltrack_upcall_lock(clp); 1298 nfsd4_cltrack_upcall_lock(clp);
1299 nfsd4_umh_cltrack_upcall("create", hexid, has_session, grace_start); 1299 if (!nfsd4_umh_cltrack_upcall("create", hexid, has_session, grace_start))
1300 set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags);
1300 nfsd4_cltrack_upcall_unlock(clp); 1301 nfsd4_cltrack_upcall_unlock(clp);
1301 1302
1302 kfree(has_session); 1303 kfree(has_session);
@@ -1309,6 +1310,9 @@ nfsd4_umh_cltrack_remove(struct nfs4_client *clp)
1309{ 1310{
1310 char *hexid; 1311 char *hexid;
1311 1312
1313 if (!test_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags))
1314 return;
1315
1312 hexid = bin_to_hex_dup(clp->cl_name.data, clp->cl_name.len); 1316 hexid = bin_to_hex_dup(clp->cl_name.data, clp->cl_name.len);
1313 if (!hexid) { 1317 if (!hexid) {
1314 dprintk("%s: can't allocate memory for upcall!\n", __func__); 1318 dprintk("%s: can't allocate memory for upcall!\n", __func__);
@@ -1316,7 +1320,9 @@ nfsd4_umh_cltrack_remove(struct nfs4_client *clp)
1316 } 1320 }
1317 1321
1318 nfsd4_cltrack_upcall_lock(clp); 1322 nfsd4_cltrack_upcall_lock(clp);
1319 nfsd4_umh_cltrack_upcall("remove", hexid, NULL, NULL); 1323 if (test_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags) &&
1324 nfsd4_umh_cltrack_upcall("remove", hexid, NULL, NULL) == 0)
1325 clear_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags);
1320 nfsd4_cltrack_upcall_unlock(clp); 1326 nfsd4_cltrack_upcall_unlock(clp);
1321 1327
1322 kfree(hexid); 1328 kfree(hexid);
@@ -1328,6 +1334,9 @@ nfsd4_umh_cltrack_check(struct nfs4_client *clp)
1328 int ret; 1334 int ret;
1329 char *hexid, *has_session, *legacy; 1335 char *hexid, *has_session, *legacy;
1330 1336
1337 if (test_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags))
1338 return 0;
1339
1331 hexid = bin_to_hex_dup(clp->cl_name.data, clp->cl_name.len); 1340 hexid = bin_to_hex_dup(clp->cl_name.data, clp->cl_name.len);
1332 if (!hexid) { 1341 if (!hexid) {
1333 dprintk("%s: can't allocate memory for upcall!\n", __func__); 1342 dprintk("%s: can't allocate memory for upcall!\n", __func__);
@@ -1338,9 +1347,14 @@ nfsd4_umh_cltrack_check(struct nfs4_client *clp)
1338 legacy = nfsd4_cltrack_legacy_recdir(&clp->cl_name); 1347 legacy = nfsd4_cltrack_legacy_recdir(&clp->cl_name);
1339 1348
1340 nfsd4_cltrack_upcall_lock(clp); 1349 nfsd4_cltrack_upcall_lock(clp);
1341 ret = nfsd4_umh_cltrack_upcall("check", hexid, has_session, legacy); 1350 if (test_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags)) {
1351 ret = 0;
1352 } else {
1353 ret = nfsd4_umh_cltrack_upcall("check", hexid, has_session, legacy);
1354 if (ret == 0)
1355 set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags);
1356 }
1342 nfsd4_cltrack_upcall_unlock(clp); 1357 nfsd4_cltrack_upcall_unlock(clp);
1343
1344 kfree(has_session); 1358 kfree(has_session);
1345 kfree(legacy); 1359 kfree(legacy);
1346 kfree(hexid); 1360 kfree(hexid);