linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* locking typo in ext4_mb_add_n_trim()
@ 2009-03-27 10:27 Dan Carpenter
  2009-03-27 14:16 ` Eric Sandeen
  2009-03-27 16:35 ` Aneesh Kumar K.V
  0 siblings, 2 replies; 6+ messages in thread
From: Dan Carpenter @ 2009-03-27 10:27 UTC (permalink / raw)
  To: tytso, adilger; +Cc: linux-ext4

Smatch (http://repo.or.cz/w/smatch.git/) complains about the locking in 
ext4_mb_add_n_trim() from fs/ext4/mballoc.c

I think it's meant to be spin_unlock(&tmp_pa->pa_lock); on line 4442.

  4438          list_for_each_entry_rcu(tmp_pa, &lg->lg_prealloc_list[order],
  4439                                                  pa_inode_list) {
  4440                  spin_lock(&tmp_pa->pa_lock);
  4441                  if (tmp_pa->pa_deleted) {
  4442                          spin_unlock(&pa->pa_lock);
  4443                          continue;
  4444                  }

I can send a patch if I'm right or you could just give me a:
Reported-by: Dan Carpenter <error27@gmail.com>

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: locking typo in ext4_mb_add_n_trim()
  2009-03-27 10:27 locking typo in ext4_mb_add_n_trim() Dan Carpenter
@ 2009-03-27 14:16 ` Eric Sandeen
  2009-03-27 23:36   ` Theodore Tso
  2009-03-27 16:35 ` Aneesh Kumar K.V
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Sandeen @ 2009-03-27 14:16 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: tytso, adilger, linux-ext4

Dan Carpenter wrote:
> Smatch (http://repo.or.cz/w/smatch.git/) complains about the locking in 
> ext4_mb_add_n_trim() from fs/ext4/mballoc.c
> 
> I think it's meant to be spin_unlock(&tmp_pa->pa_lock); on line 4442.
> 
>   4438          list_for_each_entry_rcu(tmp_pa, &lg->lg_prealloc_list[order],
>   4439                                                  pa_inode_list) {
>   4440                  spin_lock(&tmp_pa->pa_lock);
>   4441                  if (tmp_pa->pa_deleted) {
>   4442                          spin_unlock(&pa->pa_lock);
>   4443                          continue;
>   4444                  }
> 
> I can send a patch if I'm right or you could just give me a:
> Reported-by: Dan Carpenter <error27@gmail.com>

Seems right to me,

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

although I wonder why we don't trip over this in spinlock debugging
(seems like it'd lead to a double unlock at times)  I wonder if we can
tie this to any other bugs we've seen.

Thanks,
-Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: locking typo in ext4_mb_add_n_trim()
  2009-03-27 10:27 locking typo in ext4_mb_add_n_trim() Dan Carpenter
  2009-03-27 14:16 ` Eric Sandeen
@ 2009-03-27 16:35 ` Aneesh Kumar K.V
  2009-03-27 23:20   ` Theodore Tso
  1 sibling, 1 reply; 6+ messages in thread
From: Aneesh Kumar K.V @ 2009-03-27 16:35 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: tytso, adilger, linux-ext4

On Fri, Mar 27, 2009 at 01:27:04PM +0300, Dan Carpenter wrote:
> Smatch (http://repo.or.cz/w/smatch.git/) complains about the locking in 
> ext4_mb_add_n_trim() from fs/ext4/mballoc.c
> 
> I think it's meant to be spin_unlock(&tmp_pa->pa_lock); on line 4442.
> 
>   4438          list_for_each_entry_rcu(tmp_pa, &lg->lg_prealloc_list[order],
>   4439                                                  pa_inode_list) {
>   4440                  spin_lock(&tmp_pa->pa_lock);
>   4441                  if (tmp_pa->pa_deleted) {
>   4442                          spin_unlock(&pa->pa_lock);
>   4443                          continue;
>   4444                  }
> 
> I can send a patch if I'm right or you could just give me a:
> Reported-by: Dan Carpenter <error27@gmail.com>
> 

Good catch. Can you send a proper patch with signed-off-by. You can add

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>

-aneesh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: locking typo in ext4_mb_add_n_trim()
  2009-03-27 16:35 ` Aneesh Kumar K.V
@ 2009-03-27 23:20   ` Theodore Tso
  0 siblings, 0 replies; 6+ messages in thread
From: Theodore Tso @ 2009-03-27 23:20 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: Dan Carpenter, adilger, linux-ext4

On Fri, Mar 27, 2009 at 10:05:17PM +0530, Aneesh Kumar K.V wrote:
> 
> Good catch. Can you send a proper patch with signed-off-by. You can add

No need, I've already created a proper patch for this problem, and am
adding it to the ext4 patch queue.

Thanks, Dan!!

						- Ted

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: locking typo in ext4_mb_add_n_trim()
  2009-03-27 14:16 ` Eric Sandeen
@ 2009-03-27 23:36   ` Theodore Tso
  2009-03-31 13:00     ` Jan Kara
  0 siblings, 1 reply; 6+ messages in thread
From: Theodore Tso @ 2009-03-27 23:36 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Dan Carpenter, adilger, linux-ext4

On Fri, Mar 27, 2009 at 09:16:59AM -0500, Eric Sandeen wrote:
> 
> although I wonder why we don't trip over this in spinlock debugging
> (seems like it'd lead to a double unlock at times)  I wonder if we can
> tie this to any other bugs we've seen.

I was wondering if it could be tied to the "rm -rf" soft lockup hang....

I wonder if vendor kernels (specifically, Ubuntu in this case) disable
spinlock debugging, which is why we wouldn't have seen the double
unlock warning.  (Or maybe it happened earlier in the log, and users
didn't notice it).

					- Ted

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: locking typo in ext4_mb_add_n_trim()
  2009-03-27 23:36   ` Theodore Tso
@ 2009-03-31 13:00     ` Jan Kara
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2009-03-31 13:00 UTC (permalink / raw)
  To: Theodore Tso; +Cc: Eric Sandeen, Dan Carpenter, adilger, linux-ext4

> On Fri, Mar 27, 2009 at 09:16:59AM -0500, Eric Sandeen wrote:
> > 
> > although I wonder why we don't trip over this in spinlock debugging
> > (seems like it'd lead to a double unlock at times)  I wonder if we can
> > tie this to any other bugs we've seen.
> 
> I was wondering if it could be tied to the "rm -rf" soft lockup hang....
> 
> I wonder if vendor kernels (specifically, Ubuntu in this case) disable
> spinlock debugging, which is why we wouldn't have seen the double
> unlock warning.  (Or maybe it happened earlier in the log, and users
> didn't notice it).
  Don't know about Ubuntu but SUSE has definitely turned off spinlock
debugging (I guess because it may cost some performance) and most other
debug stuff.

								Honza
-- 
Jan Kara <jack@suse.cz>
SuSE CR Labs

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-31 13:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-27 10:27 locking typo in ext4_mb_add_n_trim() Dan Carpenter
2009-03-27 14:16 ` Eric Sandeen
2009-03-27 23:36   ` Theodore Tso
2009-03-31 13:00     ` Jan Kara
2009-03-27 16:35 ` Aneesh Kumar K.V
2009-03-27 23:20   ` Theodore Tso

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).