From patchwork Thu Oct 17 13:36:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13840041 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBC931DD864 for ; Thu, 17 Oct 2024 13:36:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729172198; cv=none; b=dBd8BjJgxOvlxz0eD6FNkj1Mwkobh5/eS2QEg7EDzhE/qfPHwuQrWi0tw28nE4VM17N/AYfoUS2PrxebUxkvnLw6x+a6Bq0vHT6x/Gnz+qsQyg+0cYCSx7l1zu8FAa519TNDaiFBhc3MNK2NimQt3D0VKG6TJ3ZK6siBRM053Cg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729172198; c=relaxed/simple; bh=RGErqXw6Y0xa7GsEkwfdHf8++QF1/f1750VF1aJl5xY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iPY9otsPiQQ1R3edRsZjcoAviJRRPrTv139aCXVqfotcLDa277K2wqEkVowB6V4T65ydMcHta3V7KKhWLWqcCe2lLNcFz8FjG91RwszLPPj0AZPp4ZTk7QzjdhAVA8u7Ue3sZEqoQm4ku7QtNLTfvmVPcXapA1VORFE74yvyeb8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nPnRRjCP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nPnRRjCP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1826C4CED0; Thu, 17 Oct 2024 13:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729172197; bh=RGErqXw6Y0xa7GsEkwfdHf8++QF1/f1750VF1aJl5xY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nPnRRjCPCmMSrtnrW51Z6TEz70klBTQKD/1sWW4Cmb+QgsKGKSpe0ByUMtKR3Ikg0 /aoa4RC2ZWn7Ghmocvn5zZd82wDBzVy6DWtUbv9bkKlNW0HJy/FLlsd0A0fXk/izM0 ybBuoyTix66WCHytEQERZ4n94mkQBmt2Jc+bl76V7U67ZEERSSO2/s5oScZyNzpesz 7BWPt1iAN6ccUzG78F6uF48x8gml/GLJNKLwXxSGPRTp00juDYKFiixErEtyg3YECf lRATBSDOVZbNL8j1BATsnIRRwdgkddhCGu2WAn1ydt80VWyUK9IwCZ3UXxOstUZ6Rz 0ALtHcAGJLa5w== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH 1/5] lockd: Remove unused typedef Date: Thu, 17 Oct 2024 09:36:27 -0400 Message-ID: <20241017133631.213274-2-cel@kernel.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241017133631.213274-1-cel@kernel.org> References: <20241017133631.213274-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever Clean up: Looks like the last usage of this typedef was removed by commit 026fec7e7c47 ("sunrpc: properly type pc_decode callbacks") in 2017. Signed-off-by: Chuck Lever --- include/linux/lockd/xdr.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h index 80cca9426761..17d53165d9f2 100644 --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h @@ -73,8 +73,6 @@ struct nlm_args { u32 fsm_mode; }; -typedef struct nlm_args nlm_args; - /* * Generic lockd result */ From patchwork Thu Oct 17 13:36:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13840042 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E6F81DE3AA for ; Thu, 17 Oct 2024 13:36:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729172198; cv=none; b=fLuOLyqggi1KiiCsZPcRiOFVIivoYOyxYCvxmWKzOLgCALgGVhmfw9FRNFGcLuK8PDyBYJeuG0+/V+W6S/EB/wU0JdWPTgTXvKdSCnJa4gywv2d8H/GQH8faOETZni9OhyE+9Jk0ItiUnE22RFlxHebOSqeJq4RedscI8k0Coxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729172198; c=relaxed/simple; bh=gfObLMjWgDs33nfvlJo8fHcPSyaAUdV/b7Igyo2Quxc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LonuJHNuXBhM+htXCKkP9MIJ57jf06SHweZgMzZ8XlMpjaSBr2iN8ZsteXx6LYu9+QZaHxaEYiQeUCR8BuDN6V0F8/BC9Rg1X+ak8iCBqTzVIm3zEWQltWUd3VOVwLRGt30TLLmx+9A8fnfm3fNLSxL5JkCp6eo98Z5UKm1nml4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ssARHWCk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ssARHWCk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2DD5C4CEC5; Thu, 17 Oct 2024 13:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729172198; bh=gfObLMjWgDs33nfvlJo8fHcPSyaAUdV/b7Igyo2Quxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ssARHWCkmhPoI0gMKRr8xVRF0lANHIgZ/elCNrDcceiTORvkSRFBkJzbw9Sj6l0RZ Gk7xDnMrfIzaeR8mJycFG5QojJVr+frq7A7pkMwzyJ2wnsL2rTXxNA1h30Mhe6O7OJ BBetTNjMn8Y8Qp51CCAtP6D5NMVZaocFJrxHXRn1xfkjKfsAi9rO5pGcrHOptLJlL3 dVDUXlFYJMOpxLOW2bs9OyugeHsHH4yod3LS83zOIq+XMvHlaoiv1t0aGn6LFyyu0b pBxooFec886pgM2RWgEgWnco0qIf1FULCykCaytIOvYSh4V9GmxNslaMjABpGRq2nR S34mHXj/fRFKg== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH 2/5] lockd: Remove unnecessary memset() Date: Thu, 17 Oct 2024 09:36:28 -0400 Message-ID: <20241017133631.213274-3-cel@kernel.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241017133631.213274-1-cel@kernel.org> References: <20241017133631.213274-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever Since commit 103cc1fafee4 ("SUNRPC: Parametrize how much of argsize should be zeroed") (and possibly long before that, even) all of the memory underlying rqstp->rq_argp is zeroed already. There's no need for the memset() in nlm4svc_decode_shareargs(). Signed-off-by: Chuck Lever --- fs/lockd/xdr4.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c index 3d28b9c3ed15..60466b8bac58 100644 --- a/fs/lockd/xdr4.c +++ b/fs/lockd/xdr4.c @@ -268,7 +268,6 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) struct nlm_args *argp = rqstp->rq_argp; struct nlm_lock *lock = &argp->lock; - memset(lock, 0, sizeof(*lock)); locks_init_lock(&lock->fl); lock->svid = ~(u32)0; From patchwork Thu Oct 17 13:36:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13840043 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EFA21DDC09 for ; Thu, 17 Oct 2024 13:36:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729172199; cv=none; b=JCeeJ4zLQHQ03tlDhRknKImQ+AGth8ijRRdtFaNfLw4icCsMNPJKhc7v2t6L+REBE6koRdLL0XjnzEA4N257nUIHVfqqD5Y9WEHX0PmD6fP4iToRoFLGrPaGkKs8Kpna02s/8u5cIgupOTFy64B7CAW6bH5bzO649XjSL6btJWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729172199; c=relaxed/simple; bh=G1zgE4U+FZDFacoFDNj97/oqQOgIBgKTnVwyOA8k0l8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QmVirtgJxxPeVjYAK0ezQXt9pZKhCekvGaU6aUZ0v+FfCFYRcwa3PsK6XnxUEI4La+L8dAmSMETPBVo1VtxAq3u5wEqFWys9pkvpSC+fvHyaTQ47GvdfqIRyYGqNbupFBlCnrXwbr0QJEN77yZMNN+tUnDBydtl5AFIqqwuAywM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bTyV3J5i; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bTyV3J5i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9974AC4CED0; Thu, 17 Oct 2024 13:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729172199; bh=G1zgE4U+FZDFacoFDNj97/oqQOgIBgKTnVwyOA8k0l8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bTyV3J5iGHwikUGSSZK6b5zdEenW38rpex8etnhiVQNgYFi1CdWJUVwWNaPrX5Njw KVThypMZbOGaK/TMuvJOTtslzWno6k3Hu5sLh2kb3fSI9/XY3Sw6E+yqgdHKmuB2IS VLPNQ6nu0+ZKMqwPKXieBPZTjghdwsCogNlgURd264gdRGv8kloaUcOgN1UGR4Mr6n ifIZl+Uwef7GZzTuWh0PW29/jRD5qia3JsTHbmY6t7euISZrxFE8+p/JU0ltVxfrJx uUecR1ZDA6B26D+fa70SEJlBpxo7FywES7S2mKtws2JLO1vViX3sxegQ3gCWEchGMF dtv5aEImC8yYQ== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH 3/5] lockd: Remove some snippets of unfinished code Date: Thu, 17 Oct 2024 09:36:29 -0400 Message-ID: <20241017133631.213274-4-cel@kernel.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241017133631.213274-1-cel@kernel.org> References: <20241017133631.213274-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever Clean up. Signed-off-by: Chuck Lever --- fs/lockd/svc4proc.c | 12 ------------ fs/lockd/svcproc.c | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index 8a72c418cdcc..1d0400d94b3d 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c @@ -142,18 +142,6 @@ __nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp) if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; -#if 0 - /* If supplied state doesn't match current state, we assume it's - * an old request that time-warped somehow. Any error return would - * do in this case because it's irrelevant anyway. - * - * NB: We don't retrieve the remote host's state yet. - */ - if (host->h_nsmstate && host->h_nsmstate != argp->state) { - resp->status = nlm_lck_denied_nolocks; - } else -#endif - /* Now try to lock the file */ resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock, argp->block, &argp->cookie, diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index a03220e66ce0..d959a5dbe0ae 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c @@ -165,18 +165,6 @@ __nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp) if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; -#if 0 - /* If supplied state doesn't match current state, we assume it's - * an old request that time-warped somehow. Any error return would - * do in this case because it's irrelevant anyway. - * - * NB: We don't retrieve the remote host's state yet. - */ - if (host->h_nsmstate && host->h_nsmstate != argp->state) { - resp->status = nlm_lck_denied_nolocks; - } else -#endif - /* Now try to lock the file */ resp->status = cast_status(nlmsvc_lock(rqstp, file, host, &argp->lock, argp->block, &argp->cookie, From patchwork Thu Oct 17 13:36:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13840044 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51E181DDC09 for ; Thu, 17 Oct 2024 13:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729172200; cv=none; b=rUF9MMNJvqq1h+5iWylpC7LDKo1KqGvb2wzGBKA4ob7t1NA4GF2+kApaQRtLZAkx5D5/S9vbo9c/7PezgI0L9C8yd3km/gVOMPqyzmKQ5iuTqez2KOt8uzejuYSo89tUy62yi9eAUBuNddrgWHORC3kDOd2/tcyrcU5XJYXm2HM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729172200; c=relaxed/simple; bh=RICdl1H+4mLMX4ZJNGjIA0pKMOWWkCj4salfc/LMce8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=slQ1CtaY8MTS+jDk9+bFPsmkyOCL7IHKDN03I1e0FTIfCm+YT7FWIiMeIZff5HPyJYL/D7XcIJRTdh9GUXlQeqVtBHNghBTGFV2+ZfPeLZ4N8auRh/hoDao7S02tII0Xds2Yx2QYIYGOagg4aSWSx3nwOMhwHflUThCymQcfZGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vGJh66kR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vGJh66kR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FE5BC4CEC5; Thu, 17 Oct 2024 13:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729172200; bh=RICdl1H+4mLMX4ZJNGjIA0pKMOWWkCj4salfc/LMce8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vGJh66kRQY6vFLj0mdW2Mm7fcPObrKf1lKDkFMCTW+T4TER6ZznWPHnF7X10VsIyb 4Og5PUocsJQi1OX4pYBp9488sr/ibKBicWrhh3sI7cLbDyRlSDaP/9+nJPlUxGY/Go 6k7ZCeS+UyJzSzC7M0z7poPaaSTFmztoTIsUIb1Bc2yfUxItrICHMLc8xj+zfzrK81 0Wv1pH8bjjRBtLWNY8K0VLrYIcbscwdsqEOxGnDn4cowZyM3aUP2QvyA/mcd2Oeoe3 DptnDYMxgp4+DDHzNiOhy+pZNt7EdvdJqntbE47jhkh/KIcrIy73hRuPkTDld/RoT/ syZMgrxnqTIjA== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH 4/5] lockd: Remove unused parameter to nlmsvc_testlock() Date: Thu, 17 Oct 2024 09:36:30 -0400 Message-ID: <20241017133631.213274-5-cel@kernel.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241017133631.213274-1-cel@kernel.org> References: <20241017133631.213274-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever This parameter has been unused since commit 09802fd2a8ca ("lockd: rip out deferred lock handling from testlock codepath"). Signed-off-by: Chuck Lever --- fs/lockd/svc4proc.c | 3 ++- fs/lockd/svclock.c | 2 +- fs/lockd/svcproc.c | 3 ++- include/linux/lockd/lockd.h | 6 +++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index 1d0400d94b3d..2cb603013111 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c @@ -108,7 +108,8 @@ __nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp) test_owner = argp->lock.fl.c.flc_owner; /* Now check for conflicting locks */ - resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie); + resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, + &resp->lock); if (resp->status == nlm_drop_reply) rc = rpc_drop_reply; else diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 1f2149db10f2..33e1fd159934 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c @@ -609,7 +609,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file, __be32 nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, struct nlm_host *host, struct nlm_lock *lock, - struct nlm_lock *conflock, struct nlm_cookie *cookie) + struct nlm_lock *conflock) { int error; int mode; diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index d959a5dbe0ae..f53d5177f267 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c @@ -130,7 +130,8 @@ __nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp) test_owner = argp->lock.fl.c.flc_owner; /* Now check for conflicting locks */ - resp->status = cast_status(nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie)); + resp->status = cast_status(nlmsvc_testlock(rqstp, file, host, + &argp->lock, &resp->lock)); if (resp->status == nlm_drop_reply) rc = rpc_drop_reply; else diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index 61c4b9c41904..c8f0f9458f2c 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h @@ -278,9 +278,9 @@ __be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, struct nlm_host *, struct nlm_lock *, int, struct nlm_cookie *, int); __be32 nlmsvc_unlock(struct net *net, struct nlm_file *, struct nlm_lock *); -__be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *, - struct nlm_host *, struct nlm_lock *, - struct nlm_lock *, struct nlm_cookie *); +__be32 nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, + struct nlm_host *host, struct nlm_lock *lock, + struct nlm_lock *conflock); __be32 nlmsvc_cancel_blocked(struct net *net, struct nlm_file *, struct nlm_lock *); void nlmsvc_retry_blocked(struct svc_rqst *rqstp); void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, From patchwork Thu Oct 17 13:36:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13840045 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38F481DDC09 for ; Thu, 17 Oct 2024 13:36:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729172201; cv=none; b=G7ai4mWMXTG5RY7PJfZ8vDXi4Xltl4x6c8Sf8HcPsoj6yHeaW2hCk4xrxX4EN3VAMmECO2QdJOyDtVOXqDy28+ggOBJxombJQqp1ZdeIj/SuzJ3GLf+JbQ7gEid8Q/6rKCEG4UNOXL9Kj9hp/2eOFK6P6C6Pm52jX79zS78diEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729172201; c=relaxed/simple; bh=AtB1uZOHYnTXzqHqoo9ViXeSOx3KXI11OZZOzkeKAKE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AOkjkUxgD9cwpVgipyQBmZ4UAFvPQTmnq81skmaVu7M4RCMpHRPYY6uQ6VpHm2v9hiD96+7YIqR3KYtr7BI2c1jVFFNQpP7sS7WGrCPyuyQ8rSIS6GXgYopYOjLMjvJ6NJE+pCSh4f3N1EFdReYUU84q2zIw8d+9e75118jCEXg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t3m70ktx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t3m70ktx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 660CCC4CEC7; Thu, 17 Oct 2024 13:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729172201; bh=AtB1uZOHYnTXzqHqoo9ViXeSOx3KXI11OZZOzkeKAKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t3m70ktxhpzO/yQqXYlOaF3/UAW5Ffn2j0/3BSoCil9pEmUCaHb7lhiEu8yO4ybp1 /PjCl063hBZDJUlABauc7S/hOWmLj2E0Qu275J+gLwGJg6VFlffq1nl5i84iCx4fuA v0nxccJuEISK4bHHM7Nc8MutE/nfmkmKgyhkRS6dibsfr+NwOl4lM5nVfJT9izMm92 kc8/w4sGybdnFb7N9FC63Dg6rsVM78orYAkN/Yko4Y0CvTLEEX3FG+p6//bnm//O+M ObFSSHs3rfkz4lEcsdKIsO7JDG3vp98S9aBcX4FF2JZ9Z6Lg8Wn395WtgXIcZTID6R s0lVOg4NGBGhg== From: cel@kernel.org To: Neil Brown , Jeff Layton , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: , Chuck Lever Subject: [PATCH 5/5] lockd: Remove unneeded initialization of file_lock::c.flc_flags Date: Thu, 17 Oct 2024 09:36:31 -0400 Message-ID: <20241017133631.213274-6-cel@kernel.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241017133631.213274-1-cel@kernel.org> References: <20241017133631.213274-1-cel@kernel.org> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chuck Lever Since commit 75c7940d2a86 ("lockd: set missing fl_flags field when retrieving args"), nlmsvc_retrieve_args() initializes the flc_flags field. svcxdr_decode_lock() no longer needs to do this. This clean up removes one dependency on the nlm_lock:fl field. No behavior change is expected. Analysis: svcxdr_decode_lock() is called by: nlm4svc_decode_testargs() nlm4svc_decode_lockargs() nlm4svc_decode_cancargs() nlm4svc_decode_unlockargs() nlm4svc_decode_testargs() is used by: - NLMPROC4_TEST and NLMPROC4_TEST_MSG, which call nlmsvc_retrieve_args() - NLMPROC4_GRANTED and NLMPROC4_GRANTED_MSG, which don't pass the lock's file_lock to the generic lock API nlm4svc_decode_lockargs() is used by: - NLMPROC4_LOCK and NLM4PROC4_LOCK_MSG, which call nlmsvc_retrieve_args() - NLMPROC4_UNLOCK and NLM4PROC4_UNLOCK_MSG, which call nlmsvc_retrieve_args() - NLMPROC4_NM_LOCK, which calls nlmsvc_retrieve_args() nlm4svc_decode_cancargs() is used by: - NLMPROC4_CANCEL and NLMPROC4_CANCEL_MSG, which call nlmsvc_retrieve_args() nlm4svc_decode_unlockargs() is used by: - NLMPROC4_UNLOCK and NLMPROC4_UNLOCK_MSG, which call nlmsvc_retrieve_args() All callers except GRANTED/GRANTED_MSG eventually call nlmsvc_retrieve_args() before using nlm_lock::fl.c.flc_flags. Thus this change is safe. Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton --- fs/lockd/svc4proc.c | 5 +++-- fs/lockd/xdr4.c | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index 2cb603013111..109e5caae8c7 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c @@ -46,14 +46,15 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, if (filp != NULL) { int mode = lock_to_openmode(&lock->fl); + lock->fl.c.flc_flags = FL_POSIX; + error = nlm_lookup_file(rqstp, &file, lock); if (error) goto no_locks; *filp = file; /* Set up the missing parts of the file_lock structure */ - lock->fl.c.flc_flags = FL_POSIX; - lock->fl.c.flc_file = file->f_file[mode]; + lock->fl.c.flc_file = file->f_file[mode]; lock->fl.c.flc_pid = current->tgid; lock->fl.fl_start = (loff_t)lock->lock_start; lock->fl.fl_end = lock->lock_len ? diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c index 60466b8bac58..e343c820301f 100644 --- a/fs/lockd/xdr4.c +++ b/fs/lockd/xdr4.c @@ -89,7 +89,6 @@ svcxdr_decode_lock(struct xdr_stream *xdr, struct nlm_lock *lock) return false; locks_init_lock(fl); - fl->c.flc_flags = FL_POSIX; fl->c.flc_type = F_RDLCK; nlm4svc_set_file_lock_range(fl, lock->lock_start, lock->lock_len); return true;