Lines Matching defs:clp

48 static void nfsd4_mark_cb_fault(struct nfs4_client *clp);
989 static void nfsd41_cb_inflight_begin(struct nfs4_client *clp)
991 atomic_inc(&clp->cl_cb_inflight);
994 static void nfsd41_cb_inflight_end(struct nfs4_client *clp)
997 if (atomic_dec_and_test(&clp->cl_cb_inflight))
998 wake_up_var(&clp->cl_cb_inflight);
1001 static void nfsd41_cb_inflight_wait_complete(struct nfs4_client *clp)
1003 wait_var_event(&clp->cl_cb_inflight,
1004 !atomic_read(&clp->cl_cb_inflight));
1007 static const struct cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc_clnt *client, struct nfsd4_session *ses)
1009 if (clp->cl_minorversion == 0) {
1010 client->cl_principal = clp->cl_cred.cr_targ_princ ?
1011 clp->cl_cred.cr_targ_princ : "nfs";
1027 static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses)
1029 int maxtime = max_cb_time(clp->net);
1036 .net = clp->net,
1049 if (clp->cl_minorversion == 0) {
1050 if (!clp->cl_cred.cr_principal &&
1051 (clp->cl_cred.cr_flavor >= RPC_AUTH_GSS_KRB5)) {
1052 trace_nfsd_cb_setup_err(clp, -EINVAL);
1055 args.client_name = clp->cl_cred.cr_principal;
1058 args.authflavor = clp->cl_cred.cr_flavor;
1059 clp->cl_cb_ident = conn->cb_ident;
1063 clp->cl_cb_session = ses;
1065 args.prognumber = clp->cl_cb_session->se_cb_prog;
1073 trace_nfsd_cb_setup_err(clp, PTR_ERR(client));
1076 cred = get_backchannel_cred(clp, client, ses);
1078 trace_nfsd_cb_setup_err(clp, -ENOMEM);
1083 if (clp->cl_minorversion != 0)
1084 clp->cl_cb_conn.cb_xprt = conn->cb_xprt;
1085 clp->cl_cb_client = client;
1086 clp->cl_cb_cred = cred;
1088 trace_nfsd_cb_setup(clp, rpc_peeraddr2str(client, RPC_DISPLAY_NETID),
1094 static void nfsd4_mark_cb_state(struct nfs4_client *clp, int newstate)
1096 if (clp->cl_cb_state != newstate) {
1097 clp->cl_cb_state = newstate;
1098 trace_nfsd_cb_new_state(clp);
1102 static void nfsd4_mark_cb_down(struct nfs4_client *clp)
1104 if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags))
1106 nfsd4_mark_cb_state(clp, NFSD4_CB_DOWN);
1109 static void nfsd4_mark_cb_fault(struct nfs4_client *clp)
1111 if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags))
1113 nfsd4_mark_cb_state(clp, NFSD4_CB_FAULT);
1118 struct nfs4_client *clp = container_of(calldata, struct nfs4_client, cl_cb_null);
1121 nfsd4_mark_cb_down(clp);
1123 nfsd4_mark_cb_state(clp, NFSD4_CB_UP);
1128 struct nfs4_client *clp = container_of(calldata, struct nfs4_client, cl_cb_null);
1130 nfsd41_cb_inflight_end(clp);
1145 void nfsd4_probe_callback(struct nfs4_client *clp)
1147 trace_nfsd_cb_probe(clp);
1148 nfsd4_mark_cb_state(clp, NFSD4_CB_UNKNOWN);
1149 set_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags);
1150 nfsd4_run_cb(&clp->cl_cb_null);
1153 void nfsd4_probe_callback_sync(struct nfs4_client *clp)
1155 nfsd4_probe_callback(clp);
1159 void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *conn)
1161 nfsd4_mark_cb_state(clp, NFSD4_CB_UNKNOWN);
1162 spin_lock(&clp->cl_lock);
1163 memcpy(&clp->cl_cb_conn, conn, sizeof(struct nfs4_cb_conn));
1164 spin_unlock(&clp->cl_lock);
1174 struct nfs4_client *clp = cb->cb_clp;
1177 test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) {
1178 rpc_sleep_on(&clp->cl_cb_waitq, task, NULL);
1180 if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) {
1184 rpc_wake_up_queued_task(&clp->cl_cb_waitq, task);
1192 struct nfs4_client *clp = cb->cb_clp;
1196 clear_bit(0, &clp->cl_cb_slot_busy);
1197 rpc_wake_up_next(&clp->cl_cb_waitq);
1203 struct nfs4_client *clp = cb->cb_clp;
1205 trace_nfsd_cb_destroy(clp, cb);
1209 nfsd41_cb_inflight_end(clp);
1219 struct nfs4_client *clp = cb->cb_clp;
1220 u32 minorversion = clp->cl_minorversion;
1235 struct nfs4_client *clp = cb->cb_clp;
1236 struct nfsd4_session *session = clp->cl_cb_session;
1239 if (!clp->cl_minorversion) {
1319 if (!test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) {
1320 trace_nfsd_cb_restart(clp, cb);
1330 struct nfs4_client *clp = cb->cb_clp;
1350 nfsd4_mark_cb_down(clp);
1389 void nfsd4_shutdown_callback(struct nfs4_client *clp)
1391 if (clp->cl_cb_state != NFSD4_CB_UNKNOWN)
1392 trace_nfsd_cb_shutdown(clp);
1394 set_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags);
1400 nfsd4_run_cb(&clp->cl_cb_null);
1402 nfsd41_cb_inflight_wait_complete(clp);
1405 static struct nfsd4_conn * __nfsd4_find_backchannel(struct nfs4_client *clp)
1410 lockdep_assert_held(&clp->cl_lock);
1412 list_for_each_entry(s, &clp->cl_sessions, se_perclnt) {
1430 struct nfs4_client *clp = cb->cb_clp;
1435 trace_nfsd_cb_bc_update(clp, cb);
1441 if (clp->cl_cb_client) {
1442 trace_nfsd_cb_bc_shutdown(clp, cb);
1443 rpc_shutdown_client(clp->cl_cb_client);
1444 clp->cl_cb_client = NULL;
1445 put_cred(clp->cl_cb_cred);
1446 clp->cl_cb_cred = NULL;
1448 if (clp->cl_cb_conn.cb_xprt) {
1449 svc_xprt_put(clp->cl_cb_conn.cb_xprt);
1450 clp->cl_cb_conn.cb_xprt = NULL;
1452 if (test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags))
1455 spin_lock(&clp->cl_lock);
1460 WARN_ON(!(clp->cl_flags & NFSD4_CLIENT_CB_FLAG_MASK));
1461 clear_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags);
1464 c = __nfsd4_find_backchannel(clp);
1470 spin_unlock(&clp->cl_lock);
1472 err = setup_callback_client(clp, &conn, ses);
1474 nfsd4_mark_cb_down(clp);
1486 struct nfs4_client *clp = cb->cb_clp;
1490 trace_nfsd_cb_start(clp);
1492 if (clp->cl_flags & NFSD4_CLIENT_CB_FLAG_MASK)
1495 clnt = clp->cl_cb_client;
1505 if (!cb->cb_ops && clp->cl_minorversion) {
1506 nfsd4_mark_cb_state(clp, NFSD4_CB_UP);
1517 cb->cb_msg.rpc_cred = clp->cl_cb_cred;
1518 flags = clp->cl_minorversion ? RPC_TASK_NOCONNECT : RPC_TASK_SOFTCONN;
1523 void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
1526 cb->cb_clp = clp;
1546 struct nfs4_client *clp = cb->cb_clp;
1549 nfsd41_cb_inflight_begin(clp);
1552 nfsd41_cb_inflight_end(clp);