Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp603105rwl; Thu, 23 Mar 2023 22:27:31 -0700 (PDT) X-Google-Smtp-Source: AKy350Z8lO0uM5fLzxPJ68AiNR3an3B7BlLyqTIIUg35dPYpdIn2laA5XLA7ykKxu8dkVAzDSJfy X-Received: by 2002:a17:906:6849:b0:930:e3a0:8636 with SMTP id a9-20020a170906684900b00930e3a08636mr1536485ejs.57.1679635651318; Thu, 23 Mar 2023 22:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679635651; cv=none; d=google.com; s=arc-20160816; b=by4tARXIw8XhzraDO21tazAiq07itVBccfwhGW1dgc7kRqp481qBYXP6541VksHroT 2LU1WSMqlopPgp1o7Oiv4o+yAsQbhAV+NuGJ49hQVHDyzdiZcmjcyOOxp18+1YNT45mM 7qStJcyvATCvORfrRtPPsvsF1hURpdab2+g3CpCSyxUgzJxuEm12JB/pdDVn7w31Cqzu 6+sp+4D7Nj+YIitgtyziMbFo26L4U8ZI2x6B/+ClKj8ItwpL8pbLYMZSvdNNP34uM+E/ ZTacumUNjavMr3yWjK90L73D8vdgI4jrItsYrxBZQxese5o0nUXFe8Scs5i3ZnWihqXd 2/8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lWW9PVqLe3/9juBXgwjKTyYaGeIui89h/DnPHia9ygk=; b=uq0XYNKv5x9ttni/9HdwwSYoxNdV4sbSZ8GbZ18NsQTWSAxSUDbgPLAXT6tEOf3844 rpejGSQj8VLTzujgHOusQ6kocS2pUmSjWxZUGpKMBmlHdVuTqIRkyF6yy1gGaQRtmygx VR+Hw1Qb37+hZ8lFYwN7MrrtVHL9iwMqHYk9u2e+PJ3BICQdCe1PDx4+9EhHOSSGB5Qt 2DiMYPqqGM7TzcOfn+7eAtuThTc+rZZdY3aVNLgYZJmSivV91GekfIsZwsOJ2RWGqiS7 3sTBIJ9eRcshVlMmH24/77ojE7JIimltLtPJS6W05xOudRdUbKCIhFUy22K6/+rme0hp BbEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=BxO6iQ99; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id br12-20020a170906d14c00b008cef4d78046si19479997ejb.601.2023.03.23.22.27.05; Thu, 23 Mar 2023 22:27:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=BxO6iQ99; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229522AbjCXF0T (ORCPT + 99 others); Fri, 24 Mar 2023 01:26:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231453AbjCXFZc (ORCPT ); Fri, 24 Mar 2023 01:25:32 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A5342B2A1; Thu, 23 Mar 2023 22:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lWW9PVqLe3/9juBXgwjKTyYaGeIui89h/DnPHia9ygk=; b=BxO6iQ99W+zTHMj2QHBCJhGl15 q2lXUF+oqg6ib8AW/SChw/d0ZLzn9mqj7zeWtH0gc4MM7QQAoCoCwUqrs8CdCsr27PoAGg3v1GeuB KcE1XYPW+8FsVeyMjCd80rsK54rorbS+xJHi4oeVf1HTk7/bMW86B0lzUQvvgTu1W2k9srGTITdZJ yt2ZKy09k5+Q4TGwJ5kg+CtzH9LREQI7oBpV8UOhXJ1/EbPKUy+xK8gV3w0xffrrD/kM6KL8bz+lq WbrAU8ndKYKWnuT+ypDt5ImkJn7Zds3deyagHbLOjySro1phDTGHS26b0yG8JmnR+d9yr6593h8va vOAuQEaQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pfZuc-004bi4-ET; Fri, 24 Mar 2023 05:24:26 +0000 Date: Fri, 24 Mar 2023 05:24:26 +0000 From: Matthew Wilcox To: aloktiagi Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, David.Laight@aculab.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, keescook@chromium.org, hch@infradead.org, Tycho Andersen Subject: Re: [RFC v3 3/3] file, epoll: Implement do_replace() and eventpoll_replace() Message-ID: References: <20230324051526.963702-1-aloktiagi@gmail.com> <20230324051526.963702-3-aloktiagi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230324051526.963702-3-aloktiagi@gmail.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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-kernel@vger.kernel.org On Fri, Mar 24, 2023 at 05:15:26AM +0000, aloktiagi wrote: > diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h > index 3337745d81bd..38904fce3840 100644 > --- a/include/linux/eventpoll.h > +++ b/include/linux/eventpoll.h > @@ -25,6 +25,8 @@ struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd, unsigned long t > /* Used to release the epoll bits inside the "struct file" */ > void eventpoll_release_file(struct file *file); > > +void eventpoll_replace_file(struct file *toreplace, struct file *file); > + > /* > * This is called from inside fs/file_table.c:__fput() to unlink files > * from the eventpoll interface. We need to have this facility to cleanup > @@ -53,6 +55,22 @@ static inline void eventpoll_release(struct file *file) > eventpoll_release_file(file); > } > > + > +/* > + * This is called from fs/file.c:do_replace() to replace a linked file in the > + * epoll interface with a new file received from another process. This is useful > + * in cases where a process is trying to install a new file for an existing one > + * that is linked in the epoll interface > + */ > +static inline void eventpoll_replace(struct file *toreplace, struct file *file) > +{ > + /* > + * toreplace is the file being replaced. Install the new file for the > + * existing one that is linked in the epoll interface > + */ > + eventpoll_replace_file(toreplace, file); > +} Why do we have both eventpoll_replace() and eventpoll_replace_file()? They seem identical? > diff --git a/include/linux/file.h b/include/linux/file.h > index 39704eae83e2..80e56b2b44fb 100644 > --- a/include/linux/file.h > +++ b/include/linux/file.h > @@ -36,6 +36,7 @@ struct fd { > struct file *file; > unsigned int flags; > }; > + > #define FDPUT_FPUT 1 > #define FDPUT_POS_UNLOCK 2 > You should drop this hunk of the patch.