All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: linux-kernel@vger.kernel.org, akpm@osdl.org, trond.myklebust@fys.uio.no
Subject: [PATCH] Add lookup_instantiate_filp usage warning
Date: Tue, 21 Feb 2006 23:53:40 +0200	[thread overview]
Message-ID: <20060221215340.GA5091@linuxhacker.ru> (raw)

Hello!

    I think it would be nice to put an usage warning in header of
    lookup_instantiate_filp() to indicate it is unsafe to use it on
    anything but regular files (even that is potentially unsafe, but there
    your ->open() is usually in your hands anyway), so that others won't
    fall into the same trap I did.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
CC: Trond Myklebust <trond.myklebust@fys.uio.no>

--- linux-2.6.16-rc4/fs/open.c.orig	2006-02-21 23:34:42.000000000 +0200
+++ linux-2.6.16-rc4/fs/open.c	2006-02-21 23:44:20.000000000 +0200
@@ -890,6 +890,10 @@ EXPORT_SYMBOL(filp_open);
  * a fully instantiated struct file to the caller.
  * This function is meant to be called from within a filesystem's
  * lookup method.
+ * Beware of calling it for non-regular files! Those ->open methods might block
+ * (e.g. in fifo_open), leaving you with parent locked (and in case of fifo,
+ * leading to a deadlock, as nobody can open that fifo anymore, because
+ * another process to open fifo will block on locked parent when doing lookup).
  * Note that in case of error, nd->intent.open.file is destroyed, but the
  * path information remains valid.
  * If the open callback is set to NULL, then the standard f_op->open()

                 reply	other threads:[~2006-02-21 21:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060221215340.GA5091@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    /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.