From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:42850 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727607AbeKXKPh (ORCPT ); Sat, 24 Nov 2018 05:15:37 -0500 Date: Fri, 23 Nov 2018 15:29:22 -0800 From: Andrew Morton To: Ian Kent Cc: Al Viro , autofs mailing list , linux-fsdevel , Kernel Mailing List Subject: Re: [PATCH v2 1/5] autofs - improve ioctl sbi checks Message-Id: <20181123152922.de3ed41c5b97ac84eaa22846@linux-foundation.org> In-Reply-To: <154296970987.9889.1597442413573683096.stgit@pluto-themaw-net> References: <154296962626.9889.644199825100770992.stgit@pluto-themaw-net> <154296970987.9889.1597442413573683096.stgit@pluto-themaw-net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, 23 Nov 2018 18:41:50 +0800 Ian Kent wrote: > Al Viro made some suggestions to improve the implementation > of commit 0633da48f0 "fix autofs_sbi() does not check super > block type". > > The check is unnessesary in all cases except for ioctl usage > so placing the check in the super block accessor function > adds a small overhead to the common case where it isn't > needed. > > So it's sufficient to do this in the ioctl code only. > > Also the check in the ioctl code is needlessly complex. > > ... > > --- a/fs/autofs/dev-ioctl.c > +++ b/fs/autofs/dev-ioctl.c > @@ -14,6 +14,8 @@ > > #include "autofs_i.h" > > +extern struct file_system_type autofs_fs_type; > + > /* > * This module implements an interface for routing autofs ioctl control > * commands via a miscellaneous device file. It's naughty to declare externs in C files, for various reasons. Is this OK? --- a/fs/autofs/autofs_i.h~autofs-improve-ioctl-sbi-checks-fix +++ a/fs/autofs/autofs_i.h @@ -42,6 +42,8 @@ #endif #define pr_fmt(fmt) KBUILD_MODNAME ":pid:%d:%s: " fmt, current->pid, __func__ +extern struct file_system_type autofs_fs_type; + /* * Unified info structure. This is pointed to by both the dentry and * inode structures. Each file in the filesystem has an instance of this --- a/fs/autofs/dev-ioctl.c~autofs-improve-ioctl-sbi-checks-fix +++ a/fs/autofs/dev-ioctl.c @@ -14,8 +14,6 @@ #include "autofs_i.h" -extern struct file_system_type autofs_fs_type; - /* * This module implements an interface for routing autofs ioctl control * commands via a miscellaneous device file. _