Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1971568pxb; Mon, 8 Mar 2021 10:37:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIz4qLUrnTWkLOePHn5y42i3fua7kmFO2ZHfVHkTiUvhGm9oQv0UQNtYN15ZqfNDvFYZcV X-Received: by 2002:a05:6402:168c:: with SMTP id a12mr19795903edv.344.1615228651691; Mon, 08 Mar 2021 10:37:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615228651; cv=none; d=google.com; s=arc-20160816; b=zZeIwo4KzO3Awl2yr3x8xnLK1CUFCj9E1bPV7d/UWHGfCviSRzO1k5dCNiZ7dVxBKk vyVM/BxGH0dgEWhpO8iSUqys5w00AdO0NqxrnkoOTkghpmI2ljY1vj8NFxwZR4RvoNEN sIAXzl26QzkTy+Yt4u2kHlk00z83hj7SNzFkZAMfMrTikFyosNUHlp+9KWvdA0aiCvq/ pxclPSG2+Q0Ir63iyqqKbQ2FVg8R7Dml/Hy2gIa9xhe891iZoTX+jZ1jh/M5uug7Mcym lHrRRSZszIFkmHUjAc5E4FTIqVQzYaz7B+XzsdXLNGyl9x2AYayWwbsqUKqvMWEyBo4D L6Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TCs/YwRvijlrnCFQVqWxI+H4chwt7gzPnt+CQTEpNkA=; b=qgwWuTPP7e+pG6fdRy4ekgTFVk6Hf9NKvSYoTIPnzK0xUovi7Tu1sJs79kgxTc8mBt tY1PaFW6Qv02AL4QFlLfaj64ymfo+BWVzZlPOuEPFYLZ9GLhA94llYLqtr/vr6qO9t8q jiYoHHxSGieYz7RQJCCz2urSjzIkvctJM0Ms+0Tgl28sdqoUehJVsraKo0voSxzDaZsA 0o2sfTRhxC+CAP7TLbde7MXYea35hMdjzLv6tC2bJymP9zpJpPANfBlEY6sN9BYOhND+ xOQiRnuse3HrP8DpflFwO4CUwL2nlIRlWYobiHnAGDXbNQUgAqenHo8c8cRrIJHiCRhQ 3VqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=luxLbTnE; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si3548927edc.137.2021.03.08.10.37.01; Mon, 08 Mar 2021 10:37:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=luxLbTnE; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230476AbhCHSg2 (ORCPT + 99 others); Mon, 8 Mar 2021 13:36:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbhCHSgE (ORCPT ); Mon, 8 Mar 2021 13:36:04 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 185E1C06174A for ; Mon, 8 Mar 2021 10:36:04 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id b7so16217501edz.8 for ; Mon, 08 Mar 2021 10:36:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TCs/YwRvijlrnCFQVqWxI+H4chwt7gzPnt+CQTEpNkA=; b=luxLbTnEQAv175zlPTi4YD6WxuIu5waKw7ZzpRI6Pwy61RqxAhDUFGI00ePgf59uw9 ebZg+EQESjkjMQzsGJD4wvHDUMEtPcJRAkdY48vjHLdcM4EbSjHPoz5UzDhCZ56ernEQ VzBYiX3gXLANfwdYSxTPw5eBt72NIi/Wd0fvwqg1M7uEaTKORh4Tsq96wcLaYZGtHKj5 8mlIRYyQm5zHRoEDnTXetBk+pjxG9r7EJ4/60W2dIqVLVpfMoj6XiBovJ2zD8hrrkViW LO6Rjm8rGINQiC66UyqFqoyt50e5526xxgq2vPvw7XnqPU1t6kHLxM4bQPcjSynUK+ax XNTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TCs/YwRvijlrnCFQVqWxI+H4chwt7gzPnt+CQTEpNkA=; b=pLp1ffhbl9+0yeQZ/j5h6vEmDgv1DRXr37+o6rXz0U5TGhSb9Iwmt1C9qphfa656e7 TCuNdC8GOxc56uSLmfbzXygfwAxvGc0SI2b8Zau8upnOmulNsUK6755uRZpeu3Pcm0Gu 1QrcwxzWaKUBbrU759BbvZOQGkZf1yJc+b2qrpI+hd1sB3HxckAjyxhYs/lttY2+43ME 0cNH6jVVLMvaQIgKkkJ6ohFKcoV+4ulM8DkK9xnLi7IZASuyRjk8BSE+ov9VfohjQZ9E 2jmYkQF9fFS8SwrXdA0qetM1T9rkeL1muGIZ2nbsMUuxvap3BOOYb/sCn+1eJpMzEhAq vY+Q== X-Gm-Message-State: AOAM532Wm5zU87S1I21pmaBZ8cQ9zNdnp3FPt6sDlATcQEd7DFiy073D SNEThtUUoiZGZmUJIwqDcVxo+y8ajDMOemy5IgvmDc4V X-Received: by 2002:aa7:da98:: with SMTP id q24mr12594433eds.84.1615228562696; Mon, 08 Mar 2021 10:36:02 -0800 (PST) MIME-Version: 1.0 References: <20210302194659.98563-1-dai.ngo@oracle.com> In-Reply-To: <20210302194659.98563-1-dai.ngo@oracle.com> From: Olga Kornievskaia Date: Mon, 8 Mar 2021 13:35:50 -0500 Message-ID: Subject: Re: [PATCH] NFSv4.2: destination file needs to be released after inter-server copy is done. To: Dai Ngo Cc: Trond Myklebust , linux-nfs Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, Mar 2, 2021 at 2:47 PM Dai Ngo wrote: > > This patch is to fix the resource leak problem of the source file > when doing inter-server copy. The fix is to close and release the > file in __nfs42_ssc_close after the copy is done. > > Signed-off-by: Dai Ngo > --- > fs/nfs/nfs4file.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c > index 57b3821d975a..20163fe702a7 100644 > --- a/fs/nfs/nfs4file.c > +++ b/fs/nfs/nfs4file.c > @@ -405,6 +405,12 @@ static void __nfs42_ssc_close(struct file *filep) > struct nfs_open_context *ctx = nfs_file_open_context(filep); > > ctx->state->flags = 0; > + > + if (!filep) > + return; > + get_file(filep); > + filp_close(filep, NULL); > + fput(filep); > } I don't understand this logic. There is no reason to call filp_close()? All this would be done by doing a fput(). Also fput() would drop a reference on the mount point. So we are doing this then we can't call that extra disconnect that was added by another patch. Anyway I don't see why there is any reason to call anything but the fput(), I'm not sure why __nfs42_ssc_close() is a better function and doesn't lead to the "use_after_free". > > static const struct nfs4_ssc_client_ops nfs4_ssc_clnt_ops_tbl = { > -- > 2.9.5 >