linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: hch@infradead.org, linux-fsdevel@vger.kernel.org,
	viro@ZenIV.linux.org.uk, linux-kernel@vger.kernel.org
Subject: Re: [patch 04/14] gfs2: dont call permission()
Date: Fri, 23 May 2008 11:18:50 +0100	[thread overview]
Message-ID: <1211537930.3635.569.camel@quoit> (raw)
In-Reply-To: <E1JzTsy-0001b8-Cr@pomaz-ex.szeredi.hu>

Hi,

On Fri, 2008-05-23 at 11:48 +0200, Miklos Szeredi wrote:
> > Bad idea.  You're duplicating bits out of permission for no good
> > reason.  I spent quite a bit of effort to make sure we don't have
> > this duplicated logic around.
> 
> In this case you are wrong.  Look at the ugly conditional locking
> gfs2_permission() does, which is probably due to the fact that it's
> doing a recursion via calling permission() from inside already locked
> parts in the filesystem.
> 
> That's _much_ worse than a duplicated IS_IMMUTABLE() call.  Which btw,
> is a filesystem implementation detail: it needs to re-check the
> immutability of the file after it has been locked.  I'm not even sure
> it's strictly needed.  Steven?
> 
Given the fact that (a) its only a very minor change and (b) as soon as
we have a solution to what we really want to do:

 - inode/file operation:
   - Do lookup via VFS
   - Get GFS2 glock
     - Do perm check via VFS
     - Do actual operation
   - Drop GFS2 glock

as opposed to the current situation of:

 - Do lookup via VFS:
   - Get GFS2 glock
   - Do perm check
   - Drop GFS2 glock
 - inode/file operation:
   - Get GFS2 glock
   - Recheck perms
   - Do the actual operation
   - Drop GFS2 glock

then the rechecking of perms will no longer be required anyway. I'm
inclined to agree with Miklos and say that its ok, but strictly on the
basis that its days are already numbered.

> Generally this sort of recursion through the VFS is ugly and
> unnecessary, it's much better to provide helper for what the VFS is
> doing if there's a lot of duplication.  But in this case there's
> really no point in that at all.
> 
> Miklos

Indeed I've spent a lot of time tracking down these cases and at least
now its possible to see them all by greping for
gfs2_glock_is_locked_by_me() in gfs2, whereas previously these cases
were hidden and less obvious,

Steve.

  parent reply	other threads:[~2008-05-23 10:18 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-21 17:14 [patch 00/14] vfs: permission API cleanup Miklos Szeredi
2008-05-21 17:14 ` [patch 01/14] vfs: add path_getxattr() Miklos Szeredi
2008-05-21 17:15 ` [patch 02/14] vfs: add path_listxattr() Miklos Szeredi
2008-05-21 17:15 ` [patch 03/14] hppfs: remove hppfs_permission Miklos Szeredi
2008-05-23  9:17   ` Christoph Hellwig
2008-05-21 17:15 ` [patch 04/14] gfs2: dont call permission() Miklos Szeredi
2008-05-23  9:12   ` Steven Whitehouse
2008-05-23  9:30     ` Miklos Szeredi
2008-05-23  9:32     ` Christoph Hellwig
2008-05-23  9:18   ` Christoph Hellwig
2008-05-23  9:48     ` Miklos Szeredi
2008-05-23 10:00       ` Miklos Szeredi
2008-05-25 19:24         ` Christoph Hellwig
2008-05-23 10:18       ` Steven Whitehouse [this message]
2008-05-23 11:01         ` Miklos Szeredi
2008-05-25 19:23       ` Christoph Hellwig
2008-05-21 17:15 ` [patch 05/14] hpfs: " Miklos Szeredi
2008-05-23  9:20   ` Christoph Hellwig
2008-05-21 17:15 ` [patch 06/14] hfsplus: remove hfsplus_permission() Miklos Szeredi
2008-05-21 20:35   ` Roman Zippel
2008-05-22  7:58     ` Miklos Szeredi
2008-05-22 12:02       ` Roman Zippel
2008-05-22 12:17         ` Miklos Szeredi
2008-05-22 12:28           ` Roman Zippel
2008-05-22 12:37             ` Miklos Szeredi
2008-05-23  9:21               ` Christoph Hellwig
2008-05-23 15:18                 ` Roman Zippel
2008-05-23 15:31                   ` Miklos Szeredi
2008-05-23 15:49                     ` Miklos Szeredi
2008-05-23 16:30                       ` Roman Zippel
2008-05-23 18:02                         ` Miklos Szeredi
2008-05-23 18:33                           ` Roman Zippel
2008-05-23 19:05                             ` Miklos Szeredi
2008-05-23 21:52                               ` Roman Zippel
2008-05-24  6:59                                 ` Miklos Szeredi
2008-05-23 15:11               ` Roman Zippel
2008-05-21 17:15 ` [patch 07/14] vfs: pass dentry to permission() Miklos Szeredi
2008-05-21 20:29   ` Al Viro
2008-05-22  7:00     ` Miklos Szeredi
2008-05-22  7:12       ` Miklos Szeredi
2008-05-21 17:15 ` [patch 08/14] vfs: cleanup i_op->permission() Miklos Szeredi
2008-05-21 17:15 ` [patch 09/14] security: dont pass nameidata to security_inode_permission() Miklos Szeredi
2008-05-21 22:52   ` James Morris
2008-05-21 17:15 ` [patch 10/14] vfs: pass flags to dentry_permission() Miklos Szeredi
2008-05-21 17:15 ` [patch 11/14] vfs: move executable checking into ->permission() Miklos Szeredi
2008-05-21 18:16   ` Trond Myklebust
2008-05-21 19:09     ` Miklos Szeredi
2008-05-21 19:26       ` Trond Myklebust
2008-05-21 19:34         ` Miklos Szeredi
2008-05-23  9:26   ` Christoph Hellwig
2008-05-23  9:52     ` Miklos Szeredi
2008-05-21 17:15 ` [patch 12/14] vfs: create path_permission() Miklos Szeredi
2008-05-21 17:15 ` [patch 13/14] vfs: dont use dentry_permission() Miklos Szeredi
2008-05-21 17:15 ` [patch 14/14] vfs: path_permission() clean up flags Miklos Szeredi

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=1211537930.3635.569.camel@quoit \
    --to=swhiteho@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).