From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christoph Hellwig <hch@lst.de>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH] vfs: move ACL cache lookup into generic code
Date: Sat, 23 Jul 2011 04:29:44 +0100 [thread overview]
Message-ID: <20110723032944.GA24703@ZenIV.linux.org.uk> (raw)
In-Reply-To: <alpine.LFD.2.02.1107221932120.27112@i5.linux-foundation.org>
On Fri, Jul 22, 2011 at 07:34:43PM -0700, Linus Torvalds wrote:
> Comments on this part? It's untested, but it's a very straightforward
> conversion of my previous patch (that I did test).
Looks fine and I'm OK with applying and throwing into the next pull request,
but...
> + * Under RCU walk, we cannot even do a "get_cached_acl()",
> + * because that involves locking and getting a refcount on
> + * a cached ACL.
... why is that a problem? Locking there is mere ->i_lock and getting
a refcount is atomic_inc(). Grabbing a reference might be Not Nice from
the cacheline bouncing POV, but...
IIRC, these suckers (in-core ones) are copy-on-write. If so we should be
reasonably safe here. We obviously have no business trying to get ACL
from fs if it's not cached, but other than that...
Mind you, if they *are* C-O-W, we could do freeing them via RCU and avoid
even bothering with reference...
<checks> oh, my... All callers of posix_acl_chmod_masq() have exactly the
same form:
clone = posix_acl_clone(acl, some_flags);
if (clone)
error = -ENOMEM;
sod off
posix_acl_release(acl);
error = posix_acl_chmod_masq(clone, mode);
if (error)
posix_acl_release(clone);
sod off
do something useful
Sounds like a really dumb API to me...
They are C-O-W, all right. With too low-level helpers exposed...
posix_acl_create_masq(): same story, apparently. Whee... on ocfs2:
clone = posix_acl_clone(acl, GFP_NOFS);
ret = -ENOMEM;
if (!clone)
goto cleanup;
mode = inode->i_mode;
ret = posix_acl_create_masq(clone, &mode);
if (ret >= 0) {
ret2 = ocfs2_acl_set_mode(inode, di_bh, handle, mode);
if (ret2) {
mlog_errno(ret2);
ret = ret2;
goto cleanup;
...
cleanup:
posix_acl_release(acl);
return ret;
Leaks'R'Us...
OK, unless there are serious objections, I
* apply Linus' patch as-is
* fix that ocfs2 leak
* replace posix_acl_..._masq() with saner helpers (take original
acl + other arguments, return modified clone or ERR_PTR) and kill open-coded
instances...
next prev parent reply other threads:[~2011-07-23 3:29 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-22 17:37 VFS pathname walking cleanups (i_op and ACL access) Linus Torvalds
2011-07-22 17:37 ` [PATCH 1/2] VFS: Cut down inode->i_op->xyz accesses in path walking Linus Torvalds
2011-07-22 17:47 ` Christoph Hellwig
2011-07-22 23:40 ` Al Viro
2011-07-22 23:54 ` Linus Torvalds
2011-07-23 3:55 ` [PATCH] " Linus Torvalds
2011-07-23 13:35 ` Christoph Hellwig
2011-07-23 14:46 ` Al Viro
2011-07-23 14:51 ` Christoph Hellwig
2011-07-23 15:45 ` Linus Torvalds
[not found] ` <alpine.LFD.2.02.1107251852220.13796@i5.linux-foundation.org>
2011-07-26 3:05 ` Al Viro
2011-07-26 3:23 ` Linus Torvalds
2011-07-26 18:41 ` Al Viro
2011-07-26 18:45 ` Linus Torvalds
2011-08-07 6:06 ` Linus Torvalds
2011-08-07 6:51 ` Al Viro
2011-08-07 23:43 ` Linus Torvalds
2011-07-22 17:40 ` VFS pathname walking cleanups (i_op and ACL access) Christoph Hellwig
2011-07-22 17:45 ` [PATCH 2/2] vfs: move ACL cache lookup into generic code Linus Torvalds
2011-07-22 17:50 ` Christoph Hellwig
2011-07-22 17:54 ` Linus Torvalds
2011-07-23 2:34 ` [PATCH] " Linus Torvalds
2011-07-23 3:29 ` Al Viro [this message]
2011-07-23 3:42 ` Linus Torvalds
2011-07-23 4:31 ` Al Viro
2011-07-23 6:06 ` Al Viro
2011-07-25 8:15 ` Aneesh Kumar K.V
2011-07-25 8:16 ` Aneesh Kumar K.V
2011-07-23 7:47 ` Al Viro
2011-07-23 14:50 ` Christoph Hellwig
2011-07-23 15:32 ` Al Viro
2011-07-23 17:02 ` Al Viro
2011-07-23 17:31 ` Linus Torvalds
2011-07-23 18:20 ` Al Viro
2011-07-23 18:29 ` Linus Torvalds
2011-07-23 21:53 ` Al Viro
2011-07-23 22:38 ` Al Viro
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=20110723032944.GA24703@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.