From: Theodore Tso <tytso@MIT.EDU>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: cmm@us.ibm.com, sandeen@redhat.com, linux-ext4@vger.kernel.org
Subject: Re: [PATCH -V4] ext4: Fix lockdep recursive locking warning
Date: Sat, 22 Nov 2008 15:46:25 -0500 [thread overview]
Message-ID: <20081122204625.GF9150@mit.edu> (raw)
In-Reply-To: <1227285646-16263-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
On Fri, Nov 21, 2008 at 10:10:46PM +0530, Aneesh Kumar K.V wrote:
> Indicate that the group locks can be taken in loop.
I've been looking at this patch more closely, and I think there's a
major problem here. You've statically declared alloc_sem_key to be
NR_BG_LOCKS:
> +#ifdef CONFIG_LOCKDEP
> +static struct lock_class_key alloc_sem_key[NR_BG_LOCKS];
> +#endif
NR_BG_LOCKS is defined in include/linux/blockgroup_lock.h, and is 4 if
NR_CPUS is 1 or 2, 8 if NR_CPUS is 3, 16 if NR_CPUS is between 4 and
7, 32 if NR_CPUS is between 8 and 15, and so on.
It gets used this way:
> +#ifdef CONFIG_LOCKDEP
> + __init_rwsem(&meta_group_info[i]->alloc_sem,
> + "&meta_group_info[i]->alloc_sem",
> + &alloc_sem_key[i]);
But i is set thusly:
i = group & (EXT4_DESC_PER_BLOCK(sb) - 1);
which means i is between 0 and 127 if the filesystem has block 4k
filesystem....
It's also not clear to me that this will do the right thing if there
are multiple ext4 filesystems mounted. Since we are using a static
array for the lockdep class keys, that means that sb->s_group_info[x]
for one filesystem is considered in the same lockdep class as
sb->s_group_info[x] for another filesystem. This could cause false
positives if there are multiple ext4 filesystems mounted and two CPU's
are simultaneously accessing the filesystems and then access the two
s_group_info structures in different orders. Am I missing something?
- Ted
next prev parent reply other threads:[~2008-11-22 23:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-21 16:40 [PATCH -V4] ext4: Fix lockdep recursive locking warning Aneesh Kumar K.V
2008-11-21 16:48 ` patchqueue update Aneesh Kumar K.V
2008-11-22 20:46 ` Theodore Tso [this message]
2008-11-23 2:49 ` [PATCH -V4] ext4: Fix lockdep recursive locking warning Theodore Tso
2008-11-23 16:33 ` Aneesh Kumar K.V
2008-11-23 18:32 ` Theodore Tso
2008-11-24 5:02 ` Theodore Tso
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=20081122204625.GF9150@mit.edu \
--to=tytso@mit.edu \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=cmm@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).