mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Andrey Borzenkov <arvidjaar@mail.ru>
Cc: Andrew Morton <akpm@osdl.org>,
	Jim Faulkner <jfaulkne@ccs.neu.edu>,
	linux-kernel@vger.kernel.org
Subject: Re: kernel BUG under 2.6.1-mm5
Date: Wed, 4 Feb 2004 15:40:45 +0000	[thread overview]
Message-ID: <20040204154044.A19543@infradead.org> (raw)
In-Reply-To: <20040201190905.GA3873@localhost.localdomain>; from arvidjaar@mail.ru on Sun, Feb 01, 2004 at 10:09:05PM +0300

> good. here is extended version that includes the same fix + some
> cleanup. It removes dead code, removes long obsolete attempt to manage
> module refcounting, unifies bdev and cdev - they are treated equal now.
> 
> andrew please consider for -mm for testing.
> 
> More cleanup will follow.


-struct bdev_type
-{
-    dev_t dev;
-};
-
-struct cdev_type
-{
-    struct file_operations *ops;
-    dev_t dev;
-    unsigned char autogen:1;
-};

Okay, this cleanup is nice, but could you separate it from the bugfixes?

+ *	TODO it must be called asynchronously due to the fact
+ *	that devfs is initialized relatively late. Proper way
+ *	is to remove module_init from init_devfs_fs and manually
+ *	call it early enough during system init

What about doing this?  This lazy initialization scheme always
bothere me..

+    /*
+     * FIXME HACK
+     *
+     * make sure that
+     *   d_instantiate always runs under lock
+     *   we release i_sem lock before going to sleep
+     *
+     * unfortunately sometimes d_revalidate is called with
+     * and sometimes without i_sem lock held. The following checks
+     * attempt to deduce when we need to add (and drop resp.) lock
+     * here. This relies on current (2.6.2) calling coventions:
+     *
+     *   lookup_hash is always run under i_sem and is passing NULL
+     *   as nd
+     *
+     *   open(...,O_CREATE,...) calls _lookup_hash under i_sem
+     *   and sets flags to LOOKUP_OPEN|LOOKUP_CREATE
+     *
+     *   all other invocations of ->d_revalidate seem to happen
+     *   outside of i_sem
+     */
+    need_lock = nd &&
+		(!(nd->flags & LOOKUP_CREATE) || (nd->flags & LOOKUP_PARENT));
+
+    if (need_lock)
+	down(&dir->i_sem);

Yikes!  Don't do such hacks, they will stop working sooner or later.
I'd rather add i_sem to all calls to ->d_revalidate in a way that punish
filesystems not having ->d_revalidate than such a hack


      reply	other threads:[~2004-02-04 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-21 22:23 Jim Faulkner
2004-01-21 22:48 ` Andrew Morton
2004-01-26 15:30   ` Andrey Borzenkov
2004-01-26 21:22     ` Jim Faulkner
2004-02-01 19:09   ` Andrey Borzenkov
2004-02-04 15:40     ` Christoph Hellwig [this message]

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=20040204154044.A19543@infradead.org \
    --to=hch@infradead.org \
    --cc=akpm@osdl.org \
    --cc=arvidjaar@mail.ru \
    --cc=jfaulkne@ccs.neu.edu \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome