From: Emanuele Giuseppe Esposito <eesposit@redhat•com>
To: linux-nfs@vger•kernel.org
Cc: Song Liu <songliubraving@fb•com>,
linux-usb@vger•kernel.org, bpf@vger•kernel.org,
"Rafael J. Wysocki" <rafael@kernel•org>,
David Airlie <airlied@linux•ie>,
Heiko Carstens <heiko.carstens@de•ibm.com>,
Alexei Starovoitov <ast@kernel•org>,
dri-devel@lists•freedesktop.org,
"J. Bruce Fields" <bfields@fieldses•org>,
Joseph Qi <joseph.qi@linux•alibaba.com>,
Hugh Dickins <hughd@google•com>,
Paul Mackerras <paulus@samba•org>,
John Johansen <john.johansen@canonical•com>,
netdev@vger•kernel.org, linux-s390@vger•kernel.org,
Christoph Hellwig <hch@lst•de>,
Andrew Donnellan <ajd@linux•ibm.com>,
Emanuele Giuseppe Esposito <eesposit@redhat•com>,
Matthew Garrett <matthew.garrett@nebula•com>,
linux-efi@vger•kernel.org, Arnd Bergmann <arnd@arndb•de>,
Daniel Borkmann <daniel@iogearbox•net>,
Christian Borntraeger <borntraeger@de•ibm.com>,
linux-rdma@vger•kernel.org, Mark Fasheh <mark@fasheh•com>,
Anton Vorontsov <anton@enomsg•org>,
John Fastabend <john.fastabend@gmail•com>,
James Morris <jmorris@namei•org>,
Ard Biesheuvel <ardb@kernel•org>, Jason Gunthorpe <jgg@ziepe•ca>,
Doug Ledford <dledford@redhat•com>,
oprofile-list@lists•sf.net, Yonghong Song <yhs@fb•com>,
Ian Kent <raven@themaw•net>, Andrii Nakryiko <andriin@fb•com>,
Alexey Dobriyan <adobriyan@gmail•com>,
"Serge E. Hallyn" <serge@hallyn•com>,
Robert Richter <rric@kernel•org>,
Thomas Zimmermann <tzimmermann@suse•de>,
Vasily Gorbik <gor@linux•ibm.com>,
Tony Luck <tony.luck@intel•com>,
Kees Cook <keescook@chromium•org>,
"James E.J. Bottomley" <jejb@linux•ibm.com>,
autofs@vger•kernel.org,
Maarten Lankhorst <maarten.lankhorst@linux•intel.com>,
Uma Krishnan <ukrishn@linux•ibm.com>,
Maxime Ripard <mripard@kernel•org>,
linux-fsdevel@vger•kernel.org,
"Manoj N. Kumar" <manoj@linux•ibm.com>,
Alexander Viro <viro@zeniv•linux.org.uk>,
Jakub Kicinski <kuba@kernel•org>, KP Singh <kpsingh@chromium•org>,
Trond Myklebust <trond.myklebust@hammerspace•com>,
"Matthew R. Ochs" <mrochs@linux•ibm.com>,
"David S. Miller" <davem@davemloft•net>,
Felipe Balbi <balbi@kernel•org>,
Mike Marciniszyn <mike.marciniszyn@intel•com>,
Iurii Zaikin <yzaikin@google•com>,
linux-scsi@vger•kernel.org,
"Martin K. Petersen" <martin.petersen@oracle•com>,
linux-mm@kvack•org,
Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
Dennis Dalessandro <dennis.dalessandro@intel•com>,
Miklos Szeredi <miklos@szeredi•hu>,
linux-security-module@vger•kernel.org,
linux-kernel@vger•kernel.org,
Anna Schumaker <anna.schumaker@netapp•com>,
Luis Chamberlain <mcgrof@kernel•org>,
Chuck Lever <chuck.lever@oracle•com>, Jeremy Kerr <jk@ozlabs•org>,
Daniel Vetter <daniel@ffwll•ch>, Colin Cross <ccross@android•com>,
Frederic Barrat <fbarrat@linux•ibm.com>,
Paolo Bonzini <pbonzini@redhat•com>,
Andrew Morton <akpm@linux-foundation•org>,
Mike Kravetz <mike.kravetz@oracle•com>,
linuxppc-dev@lists•ozlabs.org, Martin KaFai Lau <kafai@fb•com>,
ocfs2-devel@oss•oracle.com, Joel Becker <jlbec@evilplan•org>
Subject: [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null
Date: Tue, 14 Apr 2020 14:42:55 +0200 [thread overview]
Message-ID: <20200414124304.4470-2-eesposit@redhat.com> (raw)
In-Reply-To: <20200414124304.4470-1-eesposit@redhat.com>
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.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat•com>
---
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
next prev parent reply other threads:[~2020-04-14 13:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 12:42 [PATCH 0/8] Simplefs: group and simplify linux fs code Emanuele Giuseppe Esposito
2020-04-14 12:42 ` Emanuele Giuseppe Esposito [this message]
2020-04-16 6:44 ` [PATCH 1/8] apparmor: just use vfs_kern_mount to make .null Luis Chamberlain
2020-04-20 14:00 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` [PATCH 2/8] fs: extract simple_pin/release_fs to separate files Emanuele Giuseppe Esposito
2020-04-14 12:54 ` Greg Kroah-Hartman
2020-04-16 6:52 ` Luis Chamberlain
2020-04-21 11:19 ` Frederic Barrat
2020-04-21 11:26 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` [PATCH 3/8] fs: wrap simple_pin_fs/simple_release_fs arguments in a struct Emanuele Giuseppe Esposito
2020-04-14 13:03 ` Greg Kroah-Hartman
2020-04-14 12:42 ` [PATCH 4/8] fs: introduce simple_new_inode Emanuele Giuseppe Esposito
2020-04-14 13:01 ` Greg Kroah-Hartman
2020-04-20 13:58 ` Emanuele Giuseppe Esposito
2020-04-14 12:42 ` [PATCH 5/8] simplefs: add alloc_anon_inode wrapper Emanuele Giuseppe Esposito
2020-04-14 12:55 ` Greg Kroah-Hartman
2020-04-14 12:43 ` [PATCH 6/8] simplefs: add file creation functions Emanuele Giuseppe Esposito
2020-04-14 12:56 ` Greg Kroah-Hartman
2020-04-20 13:57 ` Emanuele Giuseppe Esposito
2020-04-20 14:28 ` Greg Kroah-Hartman
2020-04-20 14:33 ` Paolo Bonzini
2020-04-14 12:43 ` [PATCH 7/8] debugfs: switch to simplefs inode creation API Emanuele Giuseppe Esposito
2020-04-14 12:43 ` [PATCH 8/8] tracefs: " Emanuele Giuseppe Esposito
2020-04-16 6:59 ` [PATCH 0/8] Simplefs: group and simplify linux fs code Luis Chamberlain
2020-04-20 14:01 ` Emanuele Giuseppe Esposito
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200414124304.4470-2-eesposit@redhat.com \
--to=eesposit@redhat$(echo .)com \
--cc=adobriyan@gmail$(echo .)com \
--cc=airlied@linux$(echo .)ie \
--cc=ajd@linux$(echo .)ibm.com \
--cc=akpm@linux-foundation$(echo .)org \
--cc=andriin@fb$(echo .)com \
--cc=anna.schumaker@netapp$(echo .)com \
--cc=anton@enomsg$(echo .)org \
--cc=ardb@kernel$(echo .)org \
--cc=arnd@arndb$(echo .)de \
--cc=ast@kernel$(echo .)org \
--cc=autofs@vger$(echo .)kernel.org \
--cc=balbi@kernel$(echo .)org \
--cc=bfields@fieldses$(echo .)org \
--cc=borntraeger@de$(echo .)ibm.com \
--cc=bpf@vger$(echo .)kernel.org \
--cc=ccross@android$(echo .)com \
--cc=chuck.lever@oracle$(echo .)com \
--cc=daniel@ffwll$(echo .)ch \
--cc=daniel@iogearbox$(echo .)net \
--cc=davem@davemloft$(echo .)net \
--cc=dennis.dalessandro@intel$(echo .)com \
--cc=dledford@redhat$(echo .)com \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=fbarrat@linux$(echo .)ibm.com \
--cc=gor@linux$(echo .)ibm.com \
--cc=gregkh@linuxfoundation$(echo .)org \
--cc=hch@lst$(echo .)de \
--cc=heiko.carstens@de$(echo .)ibm.com \
--cc=hughd@google$(echo .)com \
--cc=jejb@linux$(echo .)ibm.com \
--cc=jgg@ziepe$(echo .)ca \
--cc=jk@ozlabs$(echo .)org \
--cc=jlbec@evilplan$(echo .)org \
--cc=jmorris@namei$(echo .)org \
--cc=john.fastabend@gmail$(echo .)com \
--cc=john.johansen@canonical$(echo .)com \
--cc=joseph.qi@linux$(echo .)alibaba.com \
--cc=kafai@fb$(echo .)com \
--cc=keescook@chromium$(echo .)org \
--cc=kpsingh@chromium$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=linux-efi@vger$(echo .)kernel.org \
--cc=linux-fsdevel@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-mm@kvack$(echo .)org \
--cc=linux-nfs@vger$(echo .)kernel.org \
--cc=linux-rdma@vger$(echo .)kernel.org \
--cc=linux-s390@vger$(echo .)kernel.org \
--cc=linux-scsi@vger$(echo .)kernel.org \
--cc=linux-security-module@vger$(echo .)kernel.org \
--cc=linux-usb@vger$(echo .)kernel.org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=maarten.lankhorst@linux$(echo .)intel.com \
--cc=manoj@linux$(echo .)ibm.com \
--cc=mark@fasheh$(echo .)com \
--cc=martin.petersen@oracle$(echo .)com \
--cc=matthew.garrett@nebula$(echo .)com \
--cc=mcgrof@kernel$(echo .)org \
--cc=mike.kravetz@oracle$(echo .)com \
--cc=mike.marciniszyn@intel$(echo .)com \
--cc=miklos@szeredi$(echo .)hu \
--cc=mripard@kernel$(echo .)org \
--cc=mrochs@linux$(echo .)ibm.com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=ocfs2-devel@oss$(echo .)oracle.com \
--cc=oprofile-list@lists$(echo .)sf.net \
--cc=paulus@samba$(echo .)org \
--cc=pbonzini@redhat$(echo .)com \
--cc=rafael@kernel$(echo .)org \
--cc=raven@themaw$(echo .)net \
--cc=rric@kernel$(echo .)org \
--cc=serge@hallyn$(echo .)com \
--cc=songliubraving@fb$(echo .)com \
--cc=tony.luck@intel$(echo .)com \
--cc=trond.myklebust@hammerspace$(echo .)com \
--cc=tzimmermann@suse$(echo .)de \
--cc=ukrishn@linux$(echo .)ibm.com \
--cc=viro@zeniv$(echo .)linux.org.uk \
--cc=yhs@fb$(echo .)com \
--cc=yzaikin@google$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox