Lines Matching refs:clp
917 static void nfsd41_cb_inflight_begin(struct nfs4_client *clp) in nfsd41_cb_inflight_begin() argument
919 atomic_inc(&clp->cl_cb_inflight); in nfsd41_cb_inflight_begin()
922 static void nfsd41_cb_inflight_end(struct nfs4_client *clp) in nfsd41_cb_inflight_end() argument
925 if (atomic_dec_and_test(&clp->cl_cb_inflight)) in nfsd41_cb_inflight_end()
926 wake_up_var(&clp->cl_cb_inflight); in nfsd41_cb_inflight_end()
929 static void nfsd41_cb_inflight_wait_complete(struct nfs4_client *clp) in nfsd41_cb_inflight_wait_complete() argument
931 wait_var_event(&clp->cl_cb_inflight, in nfsd41_cb_inflight_wait_complete()
932 !atomic_read(&clp->cl_cb_inflight)); in nfsd41_cb_inflight_wait_complete()
935 static const struct cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc_clnt *client, st… in get_backchannel_cred() argument
937 if (clp->cl_minorversion == 0) { in get_backchannel_cred()
938 client->cl_principal = clp->cl_cred.cr_targ_princ ? in get_backchannel_cred()
939 clp->cl_cred.cr_targ_princ : "nfs"; in get_backchannel_cred()
955 static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_s… in setup_callback_client() argument
957 int maxtime = max_cb_time(clp->net); in setup_callback_client()
964 .net = clp->net, in setup_callback_client()
977 if (clp->cl_minorversion == 0) { in setup_callback_client()
978 if (!clp->cl_cred.cr_principal && in setup_callback_client()
979 (clp->cl_cred.cr_flavor >= RPC_AUTH_GSS_KRB5)) { in setup_callback_client()
980 trace_nfsd_cb_setup_err(clp, -EINVAL); in setup_callback_client()
983 args.client_name = clp->cl_cred.cr_principal; in setup_callback_client()
986 args.authflavor = clp->cl_cred.cr_flavor; in setup_callback_client()
987 clp->cl_cb_ident = conn->cb_ident; in setup_callback_client()
991 clp->cl_cb_session = ses; in setup_callback_client()
993 args.prognumber = clp->cl_cb_session->se_cb_prog; in setup_callback_client()
1001 trace_nfsd_cb_setup_err(clp, PTR_ERR(client)); in setup_callback_client()
1004 cred = get_backchannel_cred(clp, client, ses); in setup_callback_client()
1006 trace_nfsd_cb_setup_err(clp, -ENOMEM); in setup_callback_client()
1011 if (clp->cl_minorversion != 0) in setup_callback_client()
1012 clp->cl_cb_conn.cb_xprt = conn->cb_xprt; in setup_callback_client()
1013 clp->cl_cb_client = client; in setup_callback_client()
1014 clp->cl_cb_cred = cred; in setup_callback_client()
1016 trace_nfsd_cb_setup(clp, rpc_peeraddr2str(client, RPC_DISPLAY_NETID), in setup_callback_client()
1022 static void nfsd4_mark_cb_state(struct nfs4_client *clp, int newstate) in nfsd4_mark_cb_state() argument
1024 if (clp->cl_cb_state != newstate) { in nfsd4_mark_cb_state()
1025 clp->cl_cb_state = newstate; in nfsd4_mark_cb_state()
1026 trace_nfsd_cb_state(clp); in nfsd4_mark_cb_state()
1030 static void nfsd4_mark_cb_down(struct nfs4_client *clp, int reason) in nfsd4_mark_cb_down() argument
1032 if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags)) in nfsd4_mark_cb_down()
1034 nfsd4_mark_cb_state(clp, NFSD4_CB_DOWN); in nfsd4_mark_cb_down()
1037 static void nfsd4_mark_cb_fault(struct nfs4_client *clp, int reason) in nfsd4_mark_cb_fault() argument
1039 if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags)) in nfsd4_mark_cb_fault()
1041 nfsd4_mark_cb_state(clp, NFSD4_CB_FAULT); in nfsd4_mark_cb_fault()
1046 struct nfs4_client *clp = container_of(calldata, struct nfs4_client, cl_cb_null); in nfsd4_cb_probe_done() local
1049 nfsd4_mark_cb_down(clp, task->tk_status); in nfsd4_cb_probe_done()
1051 nfsd4_mark_cb_state(clp, NFSD4_CB_UP); in nfsd4_cb_probe_done()
1056 struct nfs4_client *clp = container_of(calldata, struct nfs4_client, cl_cb_null); in nfsd4_cb_probe_release() local
1058 nfsd41_cb_inflight_end(clp); in nfsd4_cb_probe_release()
1073 void nfsd4_probe_callback(struct nfs4_client *clp) in nfsd4_probe_callback() argument
1075 trace_nfsd_cb_probe(clp); in nfsd4_probe_callback()
1076 nfsd4_mark_cb_state(clp, NFSD4_CB_UNKNOWN); in nfsd4_probe_callback()
1077 set_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags); in nfsd4_probe_callback()
1078 nfsd4_run_cb(&clp->cl_cb_null); in nfsd4_probe_callback()
1081 void nfsd4_probe_callback_sync(struct nfs4_client *clp) in nfsd4_probe_callback_sync() argument
1083 nfsd4_probe_callback(clp); in nfsd4_probe_callback_sync()
1087 void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *conn) in nfsd4_change_callback() argument
1089 nfsd4_mark_cb_state(clp, NFSD4_CB_UNKNOWN); in nfsd4_change_callback()
1090 spin_lock(&clp->cl_lock); in nfsd4_change_callback()
1091 memcpy(&clp->cl_cb_conn, conn, sizeof(struct nfs4_cb_conn)); in nfsd4_change_callback()
1092 spin_unlock(&clp->cl_lock); in nfsd4_change_callback()
1102 struct nfs4_client *clp = cb->cb_clp; in nfsd41_cb_get_slot() local
1105 test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { in nfsd41_cb_get_slot()
1106 rpc_sleep_on(&clp->cl_cb_waitq, task, NULL); in nfsd41_cb_get_slot()
1108 if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { in nfsd41_cb_get_slot()
1112 rpc_wake_up_queued_task(&clp->cl_cb_waitq, task); in nfsd41_cb_get_slot()
1120 struct nfs4_client *clp = cb->cb_clp; in nfsd41_cb_release_slot() local
1124 clear_bit(0, &clp->cl_cb_slot_busy); in nfsd41_cb_release_slot()
1125 rpc_wake_up_next(&clp->cl_cb_waitq); in nfsd41_cb_release_slot()
1131 struct nfs4_client *clp = cb->cb_clp; in nfsd41_destroy_cb() local
1136 nfsd41_cb_inflight_end(clp); in nfsd41_destroy_cb()
1146 struct nfs4_client *clp = cb->cb_clp; in nfsd4_cb_prepare() local
1147 u32 minorversion = clp->cl_minorversion; in nfsd4_cb_prepare()
1162 struct nfs4_client *clp = cb->cb_clp; in nfsd4_cb_sequence_done() local
1163 struct nfsd4_session *session = clp->cl_cb_session; in nfsd4_cb_sequence_done()
1166 if (!clp->cl_minorversion) { in nfsd4_cb_sequence_done()
1226 clp->cl_cb_session->se_cb_seq_nr); in nfsd4_cb_sequence_done()
1237 if (!test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) { in nfsd4_cb_sequence_done()
1247 struct nfs4_client *clp = cb->cb_clp; in nfsd4_cb_done() local
1267 nfsd4_mark_cb_down(clp, task->tk_status); in nfsd4_cb_done()
1306 void nfsd4_shutdown_callback(struct nfs4_client *clp) in nfsd4_shutdown_callback() argument
1308 if (clp->cl_cb_state != NFSD4_CB_UNKNOWN) in nfsd4_shutdown_callback()
1309 trace_nfsd_cb_shutdown(clp); in nfsd4_shutdown_callback()
1311 set_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags); in nfsd4_shutdown_callback()
1317 nfsd4_run_cb(&clp->cl_cb_null); in nfsd4_shutdown_callback()
1319 nfsd41_cb_inflight_wait_complete(clp); in nfsd4_shutdown_callback()
1323 static struct nfsd4_conn * __nfsd4_find_backchannel(struct nfs4_client *clp) in __nfsd4_find_backchannel() argument
1328 list_for_each_entry(s, &clp->cl_sessions, se_perclnt) { in __nfsd4_find_backchannel()
1346 struct nfs4_client *clp = cb->cb_clp; in nfsd4_process_cb_update() local
1355 if (clp->cl_cb_client) { in nfsd4_process_cb_update()
1356 rpc_shutdown_client(clp->cl_cb_client); in nfsd4_process_cb_update()
1357 clp->cl_cb_client = NULL; in nfsd4_process_cb_update()
1358 put_cred(clp->cl_cb_cred); in nfsd4_process_cb_update()
1359 clp->cl_cb_cred = NULL; in nfsd4_process_cb_update()
1361 if (clp->cl_cb_conn.cb_xprt) { in nfsd4_process_cb_update()
1362 svc_xprt_put(clp->cl_cb_conn.cb_xprt); in nfsd4_process_cb_update()
1363 clp->cl_cb_conn.cb_xprt = NULL; in nfsd4_process_cb_update()
1365 if (test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) in nfsd4_process_cb_update()
1367 spin_lock(&clp->cl_lock); in nfsd4_process_cb_update()
1372 BUG_ON(!(clp->cl_flags & NFSD4_CLIENT_CB_FLAG_MASK)); in nfsd4_process_cb_update()
1373 clear_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags); in nfsd4_process_cb_update()
1375 c = __nfsd4_find_backchannel(clp); in nfsd4_process_cb_update()
1381 spin_unlock(&clp->cl_lock); in nfsd4_process_cb_update()
1383 err = setup_callback_client(clp, &conn, ses); in nfsd4_process_cb_update()
1385 nfsd4_mark_cb_down(clp, err); in nfsd4_process_cb_update()
1397 struct nfs4_client *clp = cb->cb_clp; in nfsd4_run_cb_work() local
1408 if (clp->cl_flags & NFSD4_CLIENT_CB_FLAG_MASK) in nfsd4_run_cb_work()
1411 clnt = clp->cl_cb_client; in nfsd4_run_cb_work()
1421 if (!cb->cb_ops && clp->cl_minorversion) { in nfsd4_run_cb_work()
1422 nfsd4_mark_cb_state(clp, NFSD4_CB_UP); in nfsd4_run_cb_work()
1427 cb->cb_msg.rpc_cred = clp->cl_cb_cred; in nfsd4_run_cb_work()
1428 flags = clp->cl_minorversion ? RPC_TASK_NOCONNECT : RPC_TASK_SOFTCONN; in nfsd4_run_cb_work()
1433 void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, in nfsd4_init_cb() argument
1436 cb->cb_clp = clp; in nfsd4_init_cb()
1457 struct nfs4_client *clp = cb->cb_clp; in nfsd4_run_cb() local
1460 nfsd41_cb_inflight_begin(clp); in nfsd4_run_cb()
1463 nfsd41_cb_inflight_end(clp); in nfsd4_run_cb()