From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luis Chamberlain Date: Thu, 16 Apr 2020 06:44:05 +0000 Subject: [Ocfs2-devel] [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null In-Reply-To: <20200414124304.4470-2-eesposit@redhat.com> References: <20200414124304.4470-1-eesposit@redhat.com> <20200414124304.4470-2-eesposit@redhat.com> Message-ID: <20200416064405.GP11244@42.do-not-panic.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Emanuele Giuseppe Esposito , Goldwyn Rodrigues Cc: Song Liu , linux-usb@vger.kernel.org, bpf@vger.kernel.org, "Rafael J. Wysocki" , David Airlie , Heiko Carstens , Alexei Starovoitov , dri-devel@lists.freedesktop.org, "J. Bruce Fields" , Joseph Qi , Hugh Dickins , Paul Mackerras , John Johansen , linux-s390@vger.kernel.org, ocfs2-devel@oss.oracle.com, Christoph Hellwig , Andrew Donnellan , Matthew Garrett , linux-efi@vger.kernel.org, Arnd Bergmann , Daniel Borkmann , Christian Borntraeger , linux-rdma@vger.kernel.org, Michael Ellerman , Mark Fasheh , Anton Vorontsov , John Fastabend , James Morris , Ard Biesheuvel , Jason Gunthorpe , Doug Ledford , oprofile-list@lists.sf.net, Yonghong Song , Ian Kent , Andrii Nakryiko , Alexey Dobriyan , "Serge E. Hallyn" , netdev@vger.kernel.org, Robert Richter , Thomas Zimmermann , Vasily Gorbik , Tony Luck , Kees Cook , "James E.J. Bottomley" , autofs@vger.kernel.org, Mike Marciniszyn , linux-fsdevel@vger.kernel.org, "Manoj N. Kumar" , Uma Krishnan , Jakub Kicinski , KP Singh , Trond Myklebust , "Matthew R. Ochs" , "David S. Miller" , Felipe Balbi , linux-nfs@vger.kernel.org, Iurii Zaikin , linux-scsi@vger.kernel.org, "Martin K. Petersen" , linux-mm@kvack.org, Greg Kroah-Hartman , Dennis Dalessandro , Miklos Szeredi , linux-kernel@vger.kernel.org, Anna Schumaker , linux-security-module@vger.kernel.org, Chuck Lever , Jeremy Kerr , Colin Cross , Frederic Barrat , Paolo Bonzini , Andrew Morton , Mike Kravetz , linuxppc-dev@lists.ozlabs.org, Martin KaFai Lau , Joel Becker , Alexander Viro On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote: > aa_mk_null_file is using simple_pin_fs/simple_release_fs with local > variables as arguments, for what would amount to a simple > vfs_kern_mount/mntput pair if everything was inlined. Just use > the normal filesystem API since the reference counting is not needed > here. *Why* is refcounting not needed here? Luis > > Signed-off-by: Emanuele Giuseppe Esposito > --- > security/apparmor/apparmorfs.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c > index 280741fc0f5f..828bb1eb77ea 100644 > --- a/security/apparmor/apparmorfs.c > +++ b/security/apparmor/apparmorfs.c > @@ -2525,14 +2525,14 @@ struct path aa_null; > > static int aa_mk_null_file(struct dentry *parent) > { > - struct vfsmount *mount = NULL; > + struct file_system_type *type = parent->d_sb->s_type; > + struct vfsmount *mount; > struct dentry *dentry; > struct inode *inode; > - int count = 0; > - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count); > > - if (error) > - return error; > + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL); > + if (IS_ERR(mount)) > + return PTR_ERR(mount); > > inode_lock(d_inode(parent)); > dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME)); > @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent) > dput(dentry); > out: > inode_unlock(d_inode(parent)); > - simple_release_fs(&mount, &count); > + mntput(mount); > return error; > } > > -- > 2.25.2 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB62EC2D0EF for ; Thu, 16 Apr 2020 06:44:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0599206D6 for ; Thu, 16 Apr 2020 06:44:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0599206D6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4B1AD8E0094; Thu, 16 Apr 2020 02:44:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 461F88E0001; Thu, 16 Apr 2020 02:44:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32B318E0094; Thu, 16 Apr 2020 02:44:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id 184008E0001 for ; Thu, 16 Apr 2020 02:44:09 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id CA7B71F1A for ; Thu, 16 Apr 2020 06:44:08 +0000 (UTC) X-FDA: 76712778576.13.blood23_414307a550159 X-HE-Tag: blood23_414307a550159 X-Filterd-Recvd-Size: 7200 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Apr 2020 06:44:08 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id a23so1019587plm.1 for ; Wed, 15 Apr 2020 23:44:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eihWpoiPluNClprWA5IrbR8QX54DG9JK4Pz3fjQ6jyU=; b=sXx1nCyp5A05M78mwLl7FCa/PG51r0+/z9Nem+owFsR4EHqcBEi26BthbDSJ8+UnyG AbkI8SiiZnV8oyfSrOzDMassXxTiJpr8C5bYKNmZuiaDDRGszday0b6Rvpk2ySoVm0pg QjnofcnpbxEiG6nbjz87V39dqXfDkvSKugenhNL1JZjxL7VeAaEiGNrxfCG3lln0PgIn fQryEv9YMJwXgPhKTJAh90VHodg7Uehe8w/PxqPtDpSDCsl/luhAVkwCHnVXZJ+yU3g0 yUARoxVP6qChFl4Ln7ZZatQHnnMkWLbWc/G7XwvtA0zy4zLx2q+HNCVZcz2kuAvqoo2Y /xgQ== X-Gm-Message-State: AGi0PuapH5XXbkM+uZVWmXOTCejCBllnizzAGLh7vy5ebGvsx0pZtCgU a8SPGzjLBxFbhkvYrR1zvhA= X-Google-Smtp-Source: APiQypICKIRvvkGmz8ppjoCQvnQz4lqP0uU4YHS4vVlOPBKXHmJ3+sfVrDFwAF5gqJSb9SA+HXqWoA== X-Received: by 2002:a17:90a:284e:: with SMTP id p14mr3379414pjf.10.1587019447487; Wed, 15 Apr 2020 23:44:07 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id s74sm821277pgc.50.2020.04.15.23.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 23:44:06 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 4F61640277; Thu, 16 Apr 2020 06:44:05 +0000 (UTC) Date: Thu, 16 Apr 2020 06:44:05 +0000 From: Luis Chamberlain To: Emanuele Giuseppe Esposito , Goldwyn Rodrigues Cc: linux-nfs@vger.kernel.org, Paolo Bonzini , Jeremy Kerr , Arnd Bergmann , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Dennis Dalessandro , Mike Marciniszyn , Doug Ledford , Jason Gunthorpe , Frederic Barrat , Andrew Donnellan , Greg Kroah-Hartman , Robert Richter , "Manoj N. Kumar" , "Matthew R. Ochs" , Uma Krishnan , "James E.J. Bottomley" , "Martin K. Petersen" , Felipe Balbi , Alexander Viro , Ian Kent , Joel Becker , Christoph Hellwig , "Rafael J. Wysocki" , Matthew Garrett , Ard Biesheuvel , Miklos Szeredi , Mike Kravetz , Mark Fasheh , Joseph Qi , Alexey Dobriyan , Kees Cook , Iurii Zaikin , Anton Vorontsov , Colin Cross , Tony Luck , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , Hugh Dickins , Andrew Morton , "J. Bruce Fields" , Chuck Lever , Trond Myklebust , Anna Schumaker , "David S. Miller" , Jakub Kicinski , James Morris , "Serge E. Hallyn" , John Johansen , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, oprofile-list@lists.sf.net, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org, linux-fsdevel@vger.kernel.org, autofs@vger.kernel.org, linux-efi@vger.kernel.org, linux-mm@kvack.org, ocfs2-devel@oss.oracle.com, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null Message-ID: <20200416064405.GP11244@42.do-not-panic.com> References: <20200414124304.4470-1-eesposit@redhat.com> <20200414124304.4470-2-eesposit@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200414124304.4470-2-eesposit@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote: > aa_mk_null_file is using simple_pin_fs/simple_release_fs with local > variables as arguments, for what would amount to a simple > vfs_kern_mount/mntput pair if everything was inlined. Just use > the normal filesystem API since the reference counting is not needed > here. *Why* is refcounting not needed here? Luis > > Signed-off-by: Emanuele Giuseppe Esposito > --- > security/apparmor/apparmorfs.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c > index 280741fc0f5f..828bb1eb77ea 100644 > --- a/security/apparmor/apparmorfs.c > +++ b/security/apparmor/apparmorfs.c > @@ -2525,14 +2525,14 @@ struct path aa_null; > > static int aa_mk_null_file(struct dentry *parent) > { > - struct vfsmount *mount = NULL; > + struct file_system_type *type = parent->d_sb->s_type; > + struct vfsmount *mount; > struct dentry *dentry; > struct inode *inode; > - int count = 0; > - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count); > > - if (error) > - return error; > + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL); > + if (IS_ERR(mount)) > + return PTR_ERR(mount); > > inode_lock(d_inode(parent)); > dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME)); > @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent) > dput(dentry); > out: > inode_unlock(d_inode(parent)); > - simple_release_fs(&mount, &count); > + mntput(mount); > return error; > } > > -- > 2.25.2 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67589C2BB85 for ; Thu, 16 Apr 2020 08:23:56 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FBEC206B9 for ; Thu, 16 Apr 2020 08:23:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FBEC206B9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 492sgs49ZyzDq5W for ; Thu, 16 Apr 2020 18:23:53 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=209.85.215.194; helo=mail-pg1-f194.google.com; envelope-from=mcgrof@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 492qSv25nVzDqvy for ; Thu, 16 Apr 2020 16:44:10 +1000 (AEST) Received: by mail-pg1-f194.google.com with SMTP id n16so1184421pgb.7 for ; Wed, 15 Apr 2020 23:44:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eihWpoiPluNClprWA5IrbR8QX54DG9JK4Pz3fjQ6jyU=; b=toiqgrE4HsT0d3Nm9iwrWt5/VIiA6xV4QcmBpvXVqoP5Fknl+FTYH3W3EmbF98YlhH OZ5TBYZt6oelYHIbv8NpBbdqvAcZcGy3cK9aH/wxSQiCI/WUaPyAES/vLRiZL3r3v3oZ Ehfz0/ngrjQpaEiC80RkC0lbt+6l/p7ouoJgDFWv/EUIZNARNLn+FFrH9cYRBjMQy90K Q+fh5mv/Q0NGVfCL6OFzDjD3awqB95T+kv2scz9p5vC9ZZppc3AYoGk1Q1zSxze4Atgh wj2W9w4bY34NYbd25sx/I4APDaSfOhgAQziLt7DuGlLZ9J0EeRu1jjNPJAz12oJnUDxY 0bAQ== X-Gm-Message-State: AGi0PuY6+wUL5CQT64/7L0WFMHQciEF7636vEKCnCPtirhNlvXlBNsQg 3xT+Bki+Ml4tlcjTNdYkjGE= X-Google-Smtp-Source: APiQypKU4BlzlMTwCZuRiYybUlVtNoxZaoUABDWWVme+WqLsgGvZg5mtQywjuvphRIQcwraiu04gQg== X-Received: by 2002:a63:6604:: with SMTP id a4mr28659379pgc.381.1587019447416; Wed, 15 Apr 2020 23:44:07 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id ml24sm1413754pjb.48.2020.04.15.23.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 23:44:05 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 4F61640277; Thu, 16 Apr 2020 06:44:05 +0000 (UTC) Date: Thu, 16 Apr 2020 06:44:05 +0000 From: Luis Chamberlain To: Emanuele Giuseppe Esposito , Goldwyn Rodrigues Subject: Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null Message-ID: <20200416064405.GP11244@42.do-not-panic.com> References: <20200414124304.4470-1-eesposit@redhat.com> <20200414124304.4470-2-eesposit@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200414124304.4470-2-eesposit@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Mailman-Approved-At: Thu, 16 Apr 2020 18:10:13 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Song Liu , linux-usb@vger.kernel.org, bpf@vger.kernel.org, "Rafael J. Wysocki" , David Airlie , Heiko Carstens , Alexei Starovoitov , dri-devel@lists.freedesktop.org, "J. Bruce Fields" , Joseph Qi , Hugh Dickins , Paul Mackerras , John Johansen , netdev@vger.kernel.org, linux-s390@vger.kernel.org, ocfs2-devel@oss.oracle.com, Christoph Hellwig , Andrew Donnellan , Matthew Garrett , linux-efi@vger.kernel.org, Arnd Bergmann , Daniel Borkmann , Christian Borntraeger , linux-rdma@vger.kernel.org, Mark Fasheh , Anton Vorontsov , John Fastabend , James Morris , Ard Biesheuvel , Jason Gunthorpe , Doug Ledford , oprofile-list@lists.sf.net, Yonghong Song , Ian Kent , Andrii Nakryiko , Alexey Dobriyan , "Serge E. Hallyn" , Robert Richter , Thomas Zimmermann , Vasily Gorbik , Tony Luck , Kees Cook , "James E.J. Bottomley" , autofs@vger.kernel.org, Maarten Lankhorst , Mike Marciniszyn , Maxime Ripard , linux-fsdevel@vger.kernel.org, "Manoj N. Kumar" , Uma Krishnan , Jakub Kicinski , KP Singh , Trond Myklebust , "Matthew R. Ochs" , "David S. Miller" , Felipe Balbi , linux-nfs@vger.kernel.org, Iurii Zaikin , linux-scsi@vger.kernel.org, "Martin K. Petersen" , linux-mm@kvack.org, Greg Kroah-Hartman , Dennis Dalessandro , Miklos Szeredi , linux-kernel@vger.kernel.org, Anna Schumaker , linux-security-module@vger.kernel.org, Chuck Lever , Jeremy Kerr , Daniel Vetter , Colin Cross , Frederic Barrat , Paolo Bonzini , Andrew Morton , Mike Kravetz , linuxppc-dev@lists.ozlabs.org, Martin KaFai Lau , Joel Becker , Alexander Viro Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote: > aa_mk_null_file is using simple_pin_fs/simple_release_fs with local > variables as arguments, for what would amount to a simple > vfs_kern_mount/mntput pair if everything was inlined. Just use > the normal filesystem API since the reference counting is not needed > here. *Why* is refcounting not needed here? Luis > > Signed-off-by: Emanuele Giuseppe Esposito > --- > security/apparmor/apparmorfs.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c > index 280741fc0f5f..828bb1eb77ea 100644 > --- a/security/apparmor/apparmorfs.c > +++ b/security/apparmor/apparmorfs.c > @@ -2525,14 +2525,14 @@ struct path aa_null; > > static int aa_mk_null_file(struct dentry *parent) > { > - struct vfsmount *mount = NULL; > + struct file_system_type *type = parent->d_sb->s_type; > + struct vfsmount *mount; > struct dentry *dentry; > struct inode *inode; > - int count = 0; > - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count); > > - if (error) > - return error; > + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL); > + if (IS_ERR(mount)) > + return PTR_ERR(mount); > > inode_lock(d_inode(parent)); > dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME)); > @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent) > dput(dentry); > out: > inode_unlock(d_inode(parent)); > - simple_release_fs(&mount, &count); > + mntput(mount); > return error; > } > > -- > 2.25.2 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D97ECC2BA2B for ; Thu, 16 Apr 2020 06:44:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4C8E214D8 for ; Thu, 16 Apr 2020 06:44:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4C8E214D8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1393A6EAC7; Thu, 16 Apr 2020 06:44:09 +0000 (UTC) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F0786EAC7 for ; Thu, 16 Apr 2020 06:44:08 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id c23so1197897pgj.3 for ; Wed, 15 Apr 2020 23:44:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eihWpoiPluNClprWA5IrbR8QX54DG9JK4Pz3fjQ6jyU=; b=aEjZJ2NiQf5SKFn/D2xSz3l+u1X8WLWYaDD09ZkiFktvFb4KAC8ij7RosLLcSczok8 UvVsABVoxhvta4sFsr/qwRMNY2JDEhJxXsS3usbRiAuOHHViY6GiqC2+xCgFhjWVNzQg By01t9ckXs2JHbLuQuQIFnVqfikgEUM2w1MqvDcPRw8Pj/GTNgyxJvKpG4dfhGdYUMtO a94pD0c84RJeOhNbBaec7+P0Wluix/pyaAMsbvD0d6SXtGkjC9abJO0eupyT1vuixDn4 726613MfeYwb8dMpFsYArp5CF4TjDucAxxVwFNpSie6nwaPSNR+BtlaOe1PgZYbEdl7A DyRg== X-Gm-Message-State: AGi0PuZdP9lvw39u36vUU3/IJVz1K5efTolg9ERk9MLYO8lwSU9dqc60 8qtciS2AI2Fx/wobBhW6Ut9rVufCSYVv/A== X-Google-Smtp-Source: APiQypKU4BlzlMTwCZuRiYybUlVtNoxZaoUABDWWVme+WqLsgGvZg5mtQywjuvphRIQcwraiu04gQg== X-Received: by 2002:a63:6604:: with SMTP id a4mr28659379pgc.381.1587019447416; Wed, 15 Apr 2020 23:44:07 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id ml24sm1413754pjb.48.2020.04.15.23.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 23:44:05 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 4F61640277; Thu, 16 Apr 2020 06:44:05 +0000 (UTC) Date: Thu, 16 Apr 2020 06:44:05 +0000 From: Luis Chamberlain To: Emanuele Giuseppe Esposito , Goldwyn Rodrigues Subject: Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null Message-ID: <20200416064405.GP11244@42.do-not-panic.com> References: <20200414124304.4470-1-eesposit@redhat.com> <20200414124304.4470-2-eesposit@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200414124304.4470-2-eesposit@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Song Liu , linux-usb@vger.kernel.org, bpf@vger.kernel.org, "Rafael J. Wysocki" , David Airlie , Heiko Carstens , Alexei Starovoitov , dri-devel@lists.freedesktop.org, "J. Bruce Fields" , Joseph Qi , Hugh Dickins , Paul Mackerras , John Johansen , linux-s390@vger.kernel.org, ocfs2-devel@oss.oracle.com, Christoph Hellwig , Andrew Donnellan , Matthew Garrett , linux-efi@vger.kernel.org, Arnd Bergmann , Daniel Borkmann , Christian Borntraeger , linux-rdma@vger.kernel.org, Michael Ellerman , Mark Fasheh , Anton Vorontsov , John Fastabend , James Morris , Ard Biesheuvel , Jason Gunthorpe , Doug Ledford , oprofile-list@lists.sf.net, Yonghong Song , Ian Kent , Andrii Nakryiko , Alexey Dobriyan , "Serge E. Hallyn" , netdev@vger.kernel.org, Robert Richter , Thomas Zimmermann , Vasily Gorbik , Tony Luck , Kees Cook , "James E.J. Bottomley" , autofs@vger.kernel.org, Mike Marciniszyn , linux-fsdevel@vger.kernel.org, "Manoj N. Kumar" , Uma Krishnan , Jakub Kicinski , KP Singh , Trond Myklebust , "Matthew R. Ochs" , "David S. Miller" , Felipe Balbi , linux-nfs@vger.kernel.org, Iurii Zaikin , linux-scsi@vger.kernel.org, "Martin K. Petersen" , linux-mm@kvack.org, Greg Kroah-Hartman , Dennis Dalessandro , Miklos Szeredi , linux-kernel@vger.kernel.org, Anna Schumaker , linux-security-module@vger.kernel.org, Chuck Lever , Jeremy Kerr , Colin Cross , Frederic Barrat , Paolo Bonzini , Andrew Morton , Mike Kravetz , linuxppc-dev@lists.ozlabs.org, Martin KaFai Lau , Joel Becker , Alexander Viro Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote: > aa_mk_null_file is using simple_pin_fs/simple_release_fs with local > variables as arguments, for what would amount to a simple > vfs_kern_mount/mntput pair if everything was inlined. Just use > the normal filesystem API since the reference counting is not needed > here. *Why* is refcounting not needed here? Luis > > Signed-off-by: Emanuele Giuseppe Esposito > --- > security/apparmor/apparmorfs.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c > index 280741fc0f5f..828bb1eb77ea 100644 > --- a/security/apparmor/apparmorfs.c > +++ b/security/apparmor/apparmorfs.c > @@ -2525,14 +2525,14 @@ struct path aa_null; > > static int aa_mk_null_file(struct dentry *parent) > { > - struct vfsmount *mount = NULL; > + struct file_system_type *type = parent->d_sb->s_type; > + struct vfsmount *mount; > struct dentry *dentry; > struct inode *inode; > - int count = 0; > - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count); > > - if (error) > - return error; > + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL); > + if (IS_ERR(mount)) > + return PTR_ERR(mount); > > inode_lock(d_inode(parent)); > dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME)); > @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent) > dput(dentry); > out: > inode_unlock(d_inode(parent)); > - simple_release_fs(&mount, &count); > + mntput(mount); > return error; > } > > -- > 2.25.2 > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luis Chamberlain Subject: Re: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null Date: Thu, 16 Apr 2020 06:44:05 +0000 Message-ID: <20200416064405.GP11244@42.do-not-panic.com> References: <20200414124304.4470-1-eesposit@redhat.com> <20200414124304.4470-2-eesposit@redhat.com> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <20200414124304.4470-2-eesposit@redhat.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane-mx.org@lists.ozlabs.org Sender: "Linuxppc-dev" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Emanuele Giuseppe Esposito , Goldwyn Rodrigues Cc: Song Liu , linux-usb@vger.kernel.org, bpf@vger.kernel.org, "Rafael J. Wysocki" , David Airlie , Heiko Carstens , Alexei Starovoitov , dri-devel@lists.freedesktop.org, "J. Bruce Fields" , Joseph Qi , Hugh Dickins , Paul Mackerras , John Johansen , netdev@vger.kernel.org, linux-s390@vger.kernel.org, ocfs2-devel@oss.oracle.com, Christoph Hellwig , Andrew Donnellan , Matthew Garrett , linux-efi@vger.kernel.org, Arnd Bergmann , Daniel Borkmann , Christian Borntraeger , linux-rdma@vger.kernel.org, Mark Fasheh , Anton Vorontsov <> On Tue, Apr 14, 2020 at 02:42:55PM +0200, Emanuele Giuseppe Esposito wrote: > aa_mk_null_file is using simple_pin_fs/simple_release_fs with local > variables as arguments, for what would amount to a simple > vfs_kern_mount/mntput pair if everything was inlined. Just use > the normal filesystem API since the reference counting is not needed > here. *Why* is refcounting not needed here? Luis > > Signed-off-by: Emanuele Giuseppe Esposito > --- > security/apparmor/apparmorfs.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c > index 280741fc0f5f..828bb1eb77ea 100644 > --- a/security/apparmor/apparmorfs.c > +++ b/security/apparmor/apparmorfs.c > @@ -2525,14 +2525,14 @@ struct path aa_null; > > static int aa_mk_null_file(struct dentry *parent) > { > - struct vfsmount *mount = NULL; > + struct file_system_type *type = parent->d_sb->s_type; > + struct vfsmount *mount; > struct dentry *dentry; > struct inode *inode; > - int count = 0; > - int error = simple_pin_fs(parent->d_sb->s_type, &mount, &count); > > - if (error) > - return error; > + mount = vfs_kern_mount(type, SB_KERNMOUNT, type->name, NULL); > + if (IS_ERR(mount)) > + return PTR_ERR(mount); > > inode_lock(d_inode(parent)); > dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME)); > @@ -2561,7 +2561,7 @@ static int aa_mk_null_file(struct dentry *parent) > dput(dentry); > out: > inode_unlock(d_inode(parent)); > - simple_release_fs(&mount, &count); > + mntput(mount); > return error; > } > > -- > 2.25.2 >