All of lore.kernel.org
 help / color / mirror / Atom feed
* Semaphore should be released in get_super
@ 2011-05-24 10:06 sdrb
  2011-05-24 11:20 ` Matthew Wilcox
  0 siblings, 1 reply; 3+ messages in thread
From: sdrb @ 2011-05-24 10:06 UTC (permalink / raw)
  To: linux-fsdevel

[-- Attachment #1: Type: text/plain, Size: 151 bytes --]

Hello,

Probably I found a bug in get_super() proc. I think there should be 
semaphore released before return sb.
I attached diff file.

regards,
sdrb

[-- Attachment #2: super.diff --]
[-- Type: text/x-patch, Size: 386 bytes --]

diff --git a/fs/super.c b/fs/super.c
index c04f7e0..361bbec 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -473,8 +473,10 @@ rescan:
 			spin_unlock(&sb_lock);
 			down_read(&sb->s_umount);
 			/* still alive? */
-			if (sb->s_root)
+			if (sb->s_root) {
+				up_read(&sb->s_umount);
 				return sb;
+			}
 			up_read(&sb->s_umount);
 			/* nope, got unmounted */
 			spin_lock(&sb_lock);

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

* Re: Semaphore should be released in get_super
  2011-05-24 10:06 Semaphore should be released in get_super sdrb
@ 2011-05-24 11:20 ` Matthew Wilcox
  2011-05-24 12:04   ` sdrb
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2011-05-24 11:20 UTC (permalink / raw)
  To: sdrb; +Cc: linux-fsdevel

On Tue, May 24, 2011 at 12:06:15PM +0200, sdrb wrote:
> Hello,
>
> Probably I found a bug in get_super() proc. I think there should be  
> semaphore released before return sb.

That's the point of get_super().  It's supposed to return with the
semaphore held.  Users call drop_super() later which releases the
semaphore.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

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

* Re: Semaphore should be released in get_super
  2011-05-24 11:20 ` Matthew Wilcox
@ 2011-05-24 12:04   ` sdrb
  0 siblings, 0 replies; 3+ messages in thread
From: sdrb @ 2011-05-24 12:04 UTC (permalink / raw)
  To: linux-fsdevel

On 05/24/2011 01:20 PM, Matthew Wilcox wrote:
> On Tue, May 24, 2011 at 12:06:15PM +0200, sdrb wrote:
>> Hello,
>>
>> Probably I found a bug in get_super() proc. I think there should be
>> semaphore released before return sb.
>
> That's the point of get_super().  It's supposed to return with the
> semaphore held.  Users call drop_super() later which releases the
> semaphore.

Sorry, my mistake - I noticed drop_user() just a few minutes after I 
sent a post :)

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

end of thread, other threads:[~2011-05-24 12:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 10:06 Semaphore should be released in get_super sdrb
2011-05-24 11:20 ` Matthew Wilcox
2011-05-24 12:04   ` sdrb

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.