From patchwork Fri Sep 14 14:25:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Kinsbursky X-Patchwork-Id: 1459181 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B2EF840220 for ; Fri, 14 Sep 2012 14:34:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757330Ab2INOc7 (ORCPT ); Fri, 14 Sep 2012 10:32:59 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:47855 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756632Ab2INOc4 (ORCPT ); Fri, 14 Sep 2012 10:32:56 -0400 Received: from localhost.localdomain ([10.30.21.131]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id q8EEWi1I001335; Fri, 14 Sep 2012 18:32:44 +0400 (MSK) Subject: [PATCH 1/3] lockd: use rpc client's cl_nodename for id encoding To: Trond.Myklebust@netapp.com From: Stanislav Kinsbursky Cc: bfields@fieldses.org, linux-nfs@vger.kernel.org, devel@openvz.org, linux-kernel@vger.kernel.org, jlayton@redhat.com Date: Fri, 14 Sep 2012 18:25:55 +0400 Message-ID: <20120914142555.10835.53544.stgit@localhost.localdomain> In-Reply-To: <20120914140811.10835.81465.stgit@localhost.localdomain> References: <20120914140811.10835.81465.stgit@localhost.localdomain> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Taking hostname from uts namespace if not safe, because this cuold be performind during umount operation on child reaper death. And in this case current->nsproxy is NULL already. Signed-off-by: Stanislav Kinsbursky Cc: --- fs/lockd/mon.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index 7ef14b3..c6186fb 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c @@ -426,11 +426,12 @@ static void encode_mon_name(struct xdr_stream *xdr, const struct nsm_args *argp) * (via the NLMPROC_SM_NOTIFY call) that the state of host "mon_name" * has changed. */ -static void encode_my_id(struct xdr_stream *xdr, const struct nsm_args *argp) +static void encode_my_id(struct xdr_stream *xdr, const struct nsm_args *argp, + char *nodename) { __be32 *p; - encode_nsm_string(xdr, utsname()->nodename); + encode_nsm_string(xdr, nodename); p = xdr_reserve_space(xdr, 4 + 4 + 4); *p++ = cpu_to_be32(argp->prog); *p++ = cpu_to_be32(argp->vers); @@ -441,10 +442,11 @@ static void encode_my_id(struct xdr_stream *xdr, const struct nsm_args *argp) * The "mon_id" argument specifies the non-private arguments * of an NSMPROC_MON or NSMPROC_UNMON call. */ -static void encode_mon_id(struct xdr_stream *xdr, const struct nsm_args *argp) +static void encode_mon_id(struct xdr_stream *xdr, const struct nsm_args *argp, + char *nodename) { encode_mon_name(xdr, argp); - encode_my_id(xdr, argp); + encode_my_id(xdr, argp, nodename); } /* @@ -463,14 +465,14 @@ static void encode_priv(struct xdr_stream *xdr, const struct nsm_args *argp) static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr, const struct nsm_args *argp) { - encode_mon_id(xdr, argp); + encode_mon_id(xdr, argp, req->rq_task->tk_client->cl_nodename); encode_priv(xdr, argp); } static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr, const struct nsm_args *argp) { - encode_mon_id(xdr, argp); + encode_mon_id(xdr, argp, req->rq_task->tk_client->cl_nodename); } static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp,