Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp509198imn; Wed, 27 Jul 2022 12:09:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sE/S35TivIvP0vFMgFZ2mKTJrtqtAFPJktuXpmCG7c6JhZWJypICcKqLx618XMLOo0DAQg X-Received: by 2002:a17:907:7604:b0:72b:4ad5:b21c with SMTP id jx4-20020a170907760400b0072b4ad5b21cmr17903613ejc.412.1658948987797; Wed, 27 Jul 2022 12:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658948987; cv=none; d=google.com; s=arc-20160816; b=tScoXlLRd0l9XGiq6GMBCIok+lu91783S0zSJ+Mrb2dwejIhOsoXYBWAqquBJJigZ0 UVc09Eled05WD7DwbTn+x53NUDexgP0DqQSZuHLBNx1zPFNHhPFYsxdTXEsUSHecKBVg OkSo+KokDEK0LjK4dRbSS6xCWHgFZk6AmDcpRpVp4qsRlCESaHqpqiX6IixdxDcHVQcp mlGRGmZ/vUBiJOPh+516apwVQyoP/bqOwS/6WNU2iprkTZ/r3GPs6Rz9WiGtB3bBCPfm p/o87RDCESs1PEXuUR2TAjgL10Uy59khDFQ/ma/jxrHeM3x9HCb94JpSyujY5peckXkM 3IIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject; bh=Jmin7R0NyPpjc4vr3jCGDK0FQJeKtO34Pazn6rjlYhE=; b=igCmliwNj/H01zLkBpwi5Ews9WTukg1xtZHWaa6CTNDws/v+n1gd8k8VoQkf+V5xyd g9NXdNznKdZVkaiuKKjVeESWQbqxeJ6hTzym2B2vniloCGqavyx+Vgqly6rzMTfVLwdc lQSKzwiQ+JOjFGOqC8oIuMMTWBUW1jjhEK4hwQlaOwyYnPoZvis2L/XTm/6T70eywtgz UnOOZsuTtekRIkQ5Dc86JKc/dgbT4PPxg6VwgRMF8FSNwsJ/63zdAE3ZZ4+YNXPKH27p 5PtzztkkXh72QeinUGdMWSfAwqnX30Ou9WwIc4wOVG0/AjeFFSAKr6N/tRYN0lOEdTxA j7Gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc7-20020a170907168700b007262a166933si17574913ejc.165.2022.07.27.12.09.23; Wed, 27 Jul 2022 12:09:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230172AbiG0THm (ORCPT + 99 others); Wed, 27 Jul 2022 15:07:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235498AbiG0THQ (ORCPT ); Wed, 27 Jul 2022 15:07:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECBDF1F7 for ; Wed, 27 Jul 2022 11:41:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A6547B821D5 for ; Wed, 27 Jul 2022 18:41:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4451DC433C1 for ; Wed, 27 Jul 2022 18:41:07 +0000 (UTC) Subject: [PATCH v2 11/13] NFSD: Remove kmalloc from nfsd4_do_async_copy() From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Wed, 27 Jul 2022 14:41:06 -0400 Message-ID: <165894726621.11193.10540376055028362017.stgit@manet.1015granger.net> In-Reply-To: <165894669884.11193.6386905165076468843.stgit@manet.1015granger.net> References: <165894669884.11193.6386905165076468843.stgit@manet.1015granger.net> User-Agent: StGit/1.5.dev2+g9ce680a5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Instead of manufacturing a phony struct nfsd_file, pass the struct file returned by nfs42_ssc_open() directly to nfsd4_do_copy(). Signed-off-by: Chuck Lever --- fs/nfsd/nfs4proc.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index d00d517f8c7d..336fdfae2230 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1763,29 +1763,31 @@ static void cleanup_async_copy(struct nfsd4_copy *copy) nfs4_put_copy(copy); } +/** + * nfsd4_do_async_copy - kthread function for background server-side COPY + * @data: arguments for COPY operation + * + * Return values: + * %0: Copy operation is done. + */ static int nfsd4_do_async_copy(void *data) { struct nfsd4_copy *copy = (struct nfsd4_copy *)data; struct nfsd4_copy *cb_copy; if (nfsd4_ssc_is_inter(copy)) { - copy->nf_src = kzalloc(sizeof(struct nfsd_file), GFP_KERNEL); - if (!copy->nf_src) { - copy->nfserr = nfserr_serverfault; - nfsd4_interssc_disconnect(copy->ss_mnt); - goto do_callback; - } - copy->nf_src->nf_file = nfs42_ssc_open(copy->ss_mnt, ©->c_fh, - ©->stateid); - if (IS_ERR(copy->nf_src->nf_file)) { + struct file *filp; + + filp = nfs42_ssc_open(copy->ss_mnt, ©->c_fh, + ©->stateid); + if (IS_ERR(filp)) { copy->nfserr = nfserr_offload_denied; nfsd4_interssc_disconnect(copy->ss_mnt); goto do_callback; } - copy->nfserr = nfsd4_do_copy(copy, copy->nf_src->nf_file, + copy->nfserr = nfsd4_do_copy(copy, filp, copy->nf_dst->nf_file, false); - nfsd4_cleanup_inter_ssc(copy->ss_mnt, copy->nf_src->nf_file, - copy->nf_dst); + nfsd4_cleanup_inter_ssc(copy->ss_mnt, filp, copy->nf_dst); } else { copy->nfserr = nfsd4_do_copy(copy, copy->nf_src->nf_file, copy->nf_dst->nf_file, false); @@ -1807,8 +1809,6 @@ static int nfsd4_do_async_copy(void *data) ©->fh, copy->cp_count, copy->nfserr); nfsd4_run_cb(&cb_copy->cp_cb); out: - if (nfsd4_ssc_is_inter(copy)) - kfree(copy->nf_src); cleanup_async_copy(copy); return 0; }