From: 易林 <yilin@iie.ac.cn>
To: linux-nfs@vger.kernel.org
Subject: should the svc_xprt_get called after the object assigned to a global variable?
Date: Mon, 1 Apr 2019 17:30:32 +0800 (GMT+08:00) [thread overview]
Message-ID: <47cb2860.1503.169d83c6bae.Coremail.yilin@iie.ac.cn> (raw)
Hi, all:
when analyzing the v5.1 source code, I notice that in function nfsd4_process_cb_update,
the object c->cn_xprt assigned to a local variable conn.cb_xprt with a refcount increased:
if (c) {
svc_xprt_get(c->cn_xprt);
conn.cb_xprt = c->cn_xprt;
ses = c->cn_session;
}
and the variable conn.cb_xprt will be assigned to a global object clp->cl_cb_conn.cb_xprt
in callee setup_callback_client with a condition that clp->cl_minorversion != 0:
if (clp->cl_minorversion == 0) {
if (!clp->cl_cred.cr_principal &&
(clp->cl_cred.cr_flavor >= RPC_AUTH_GSS_KRB5))
return -EINVAL;
args.client_name = clp->cl_cred.cr_principal;
args.prognumber = conn->cb_prog;
args.protocol = XPRT_TRANSPORT_TCP;
args.authflavor = clp->cl_cred.cr_flavor;
clp->cl_cb_ident = conn->cb_ident;
} else {
if (!conn->cb_xprt)
return -EINVAL;
clp->cl_cb_conn.cb_xprt = conn->cb_xprt;
clp->cl_cb_session = ses;
args.bc_xprt = conn->cb_xprt;
args.prognumber = clp->cl_cb_session->se_cb_prog;
args.protocol = conn->cb_xprt->xpt_class->xcl_ident |
XPRT_TRANSPORT_BC;
args.authflavor = ses->se_cb_sec.flavor;
}
what if the cl_minorversion equals 0 ? the c->cn_xprt's refcount will increased without a assignment.
Can it be ensured that the cl_minorversion won't be zero with the refcount increment?
Best Regards
Lin Yi
next reply other threads:[~2019-04-01 9:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-01 9:30 易林 [this message]
2019-04-07 11:40 should the svc_xprt_get called after the object assigned to a global variable? 易林
2019-04-08 16:27 ` J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47cb2860.1503.169d83c6bae.Coremail.yilin@iie.ac.cn \
--to=yilin@iie.ac.cn \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.