mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Sage Weil <sage@newdream.net>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: WTF is ceph_lookup_open() doing with nd->intent.open.file?
Date: Sun, 26 Jun 2011 01:42:34 +0100	[thread overview]
Message-ID: <20110626004234.GB11013@ZenIV.linux.org.uk> (raw)

ceph_lookup_open() does the following:

        struct file *file = nd->intent.open.file;
        struct inode *parent_inode = get_dentry_parent_inode(file->f_dentry);

Note that at this point nd->intent.open.file is going to have NULL ->f_dentry.
What's more, we end up calling ceph_init_file() on that struct file.  If
open(2) fails *after* the call of that sucker, we'll end up leaking
from ceph_file_cachep, since ->release() will *not* be called - VFS will
have no damn indication that it needs to.  Not that calling ->i_fop->open()
on something without ->f_op (and ->f_dentry, and...) would be a good idea...

What is that code supposed to do, anyway?  Looks like a bastardized
variant of the atomic open tricks NFS is pulling off, without the
proper use of lookup_instantiate_filp()...  The thing is,
lookup_instantiate_filp() takes care to set ->f_path.dentry, which is
what distinguishes struct file that had been through ->open() from
ones that had not.  So no ->release() for you...

Moreover, what would you expect to set ->f_dentry by the time you call
->lookup()?  Looks like you expect that parent_inode to be the directory
you are doing lookup in, so why not use the dir argument of ceph_lookup_open()?
While we are at it, what's "locked_dir" and what is it for?  AFAICS,
nothing has ever looked at it - not since the mainline merge...

Either I'm seriously confused, or that code is...

             reply	other threads:[~2011-06-26  0:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-26  0:42 Al Viro [this message]
2011-06-27  5:24 ` Sage Weil

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=20110626004234.GB11013@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sage@newdream.net \
    /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

all inboxes | Powered by JetHome®