lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimhArQ_NStZqxKcq-bzMWG3NpWK-N9+njdqfR0c@mail.gmail.com>
Date:	Fri, 19 Nov 2010 11:41:25 -0800
From:	Tim Pepper <lnxninja@...ux.vnet.ibm.com>
To:	Nick Piggin <npiggin@...nel.dk>
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [patch 14/28] fs: dcache scale subdirs

On Tue, Nov 16, 2010 at 6:09 AM, Nick Piggin <npiggin@...nel.dk> wrote:

> Index: linux-2.6/fs/dcache.c
> ===================================================================
> --- linux-2.6.orig/fs/dcache.c  2010-11-17 00:52:37.000000000 +1100
> +++ linux-2.6/fs/dcache.c       2010-11-17 01:05:44.000000000 +1100

> @@ -217,24 +219,22 @@ static void dentry_lru_move_tail(struct
>  *
>  * If this is the root of the dentry tree, return NULL.
>  *
> - * dcache_lock and d_lock must be held by caller, are dropped by d_kill.
> + * dcache_lock and d_lock and d_parent->d_lock must be held by caller, and
> + * are dropped by d_kill.
>  */
> -static struct dentry *d_kill(struct dentry *dentry)
> +static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent)
>        __releases(dentry->d_lock)
> +       __releases(parent->d_lock)
>        __releases(dcache_lock)
>  {
> -       struct dentry *parent;
> -
>        list_del(&dentry->d_u.d_child);
> +       if (parent)
> +               spin_unlock(&parent->d_lock);
>        dentry_iput(dentry);
>        /*
>         * dentry_iput drops the locks, at which point nobody (except
>         * transient RCU lookups) can reach this dentry.
>         */
> -       if (IS_ROOT(dentry))
> -               parent = NULL;
> -       else
> -               parent = dentry->d_parent;
>        d_free(dentry);
>        return parent;
>  }
> @@ -270,6 +270,7 @@ static struct dentry *d_kill(struct dent
>
>  void dput(struct dentry *dentry)
>  {
> +       struct dentry *parent;
>        if (!dentry)
>                return;
>
> @@ -277,6 +278,10 @@ void dput(struct dentry *dentry)
>        if (dentry->d_count == 1)
>                might_sleep();
>        spin_lock(&dentry->d_lock);
> +       if (IS_ROOT(dentry))
> +               parent = NULL;
> +       else
> +               parent = dentry->d_parent;
>        if (dentry->d_count == 1) {
>                if (!spin_trylock(&dcache_lock)) {
>                        /*

Removed one and added three of the IS_ROOT() checks I think...Maybe
add a macro for setting the local parent pointer?  Ah never mind.  In
patch 28 they collapse back into a single instance.

In this patch the nested locking starts to feel a little more natural
to me.  The last number of patches in the series end up re-simplifying
a lot of intermediate complexity.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ