public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] Linux-2.4.18 block MTD dead-lock
@ 2002-11-26 13:04 Takeharu KATO
  2002-11-26 13:21 ` David Woodhouse
  0 siblings, 1 reply; 4+ messages in thread
From: Takeharu KATO @ 2002-11-26 13:04 UTC (permalink / raw)
  To: linux-mtd

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

MTD developers:

 I found a bug relevant to MTD device and Linux-2.4.18.
I post the report about the issue.

P.S. I attach the patch to fix this problem.
    If you have no time to read following report.
    please see this patch.

-- the report --

1. The symptom
 When we was trying to mount MTD-block-device twice,
second mount process fall in dead-locked state. This 
is due not to be able to obtain the semaphore of 
the superblock().

 We met this with Linux-2.4.18 kernel on PPC405GP. 
This issue has never taken place with Linux-2.4.2.


2. The reason 
 We found  this was caused in the release method of 
MTD. In particular, this method indirectly call 
sync_super with calling ``invalidate_device'' 
in this method.

 When the kernel attempt to mount the block device,
it call ``get_sb_bdev'' function in fs/super.c. This 
function return the super block information to caller 
and this function perform following operations.

       Step1.  Open the block device to be mounted.

       Step2.  Obtain semaphore of the super block to
              update super block information.

       Step3.  Search the block device in super block list  
              for mounted devices.

       Step4. If the device has been already mounted, 
             it close the block device using its release 
             method then return the super block information.

       Step5  If the device has not been mounted yet,
             the file system read the super block from 
             the device and return the information.

 The reason of the deadlock is that the process
keep waiting for the semaphore owned by itself 
when it call MTD release method.
 The process has already obtained the semaphore since
the Step2 was performed. 

3. The solution

We changed the sequence of the function called ``get_sb_bdev''
 in fs/super.c.  We changed the function to make the block device 
to be mounted checked before opening the device. 
 Please refer the patch to make out the changes in detail.

-- the report --

Sincerely, yours.

-- 
Takeharu KATO
Fujitsu Limited
Email:tkato@cs.fujitsu.co.jp (ext. 7112-4621)

[-- Attachment #2: linux-2.4.18-getsbdev-fix.patch --]
[-- Type: text/plain, Size: 1980 bytes --]

--- linux-2.4.18/fs/super.c	Tue Mar 12 15:04:10 2002
+++ linux-2.4.18-getsbfix/fs/super.c	Tue Nov 26 21:58:02 2002
@@ -15,7 +15,7 @@
  *  Added kerneld support: Jacques Gelinas and Bjorn Ekwall
  *  Added change_root: Werner Almesberger & Hans Lermen, Feb '96
  *  Added options to /proc/mounts:
- *    Torbj

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

* Re: [PATCH] Linux-2.4.18 block MTD dead-lock
  2002-11-26 13:04 [PATCH] Linux-2.4.18 block MTD dead-lock Takeharu KATO
@ 2002-11-26 13:21 ` David Woodhouse
  2002-11-27  0:29   ` Takeharu KATO
  0 siblings, 1 reply; 4+ messages in thread
From: David Woodhouse @ 2002-11-26 13:21 UTC (permalink / raw)
  To: Takeharu KATO; +Cc: linux-mtd

tkato@cs.fujitsu.co.jp said:
> 3. The solution
> We changed the sequence of the function called ``get_sb_bdev''
>  in fs/super.c.  We changed the function to make the block device  to
> be mounted checked before opening the device. 
>  Please refer the patch to make out the changes in detail.

Wrong fix. Use the fix which is already in 2.4.19.

--
dwmw2

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

* Re: [PATCH] Linux-2.4.18 block MTD dead-lock
  2002-11-26 13:21 ` David Woodhouse
@ 2002-11-27  0:29   ` Takeharu KATO
  0 siblings, 0 replies; 4+ messages in thread
From: Takeharu KATO @ 2002-11-27  0:29 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

Dear Woodhouse:

David Woodhouse wrote:
> 
> tkato@cs.fujitsu.co.jp said:
> > 3. The solution
> > We changed the sequence of the function called ``get_sb_bdev''
> >  in fs/super.c.  We changed the function to make the block device  to
> > be mounted checked before opening the device.
> >  Please refer the patch to make out the changes in detail.
> 
> Wrong fix. Use the fix which is already in 2.4.19.
> 
Thank you for your response.
I'll try it later.

Yours, Sincerely.
-- 
Takeharu KATO
Fujitsu Limited
Email:tkato@cs.fujitsu.co.jp (ext. 7112-4621)

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

* Re: [PATCH] Linux-2.4.18 block MTD dead-lock
@ 2002-12-02  9:49 Paul Nash
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Nash @ 2002-12-02  9:49 UTC (permalink / raw)
  To: 'linux-mtd@lists.infradead.org'

Below, David says, "wrong fix -- use the which is already in 2.4.19."

Could someone please summarize where I should look for that in the sense
that I want to get an isolated patch for it if possible?  I can't stably
bite off the full task of upgrading to 2.4.19, but would like to see the
diffs that were this fix.  Not even sure if they were in the MTD CVS or in
the main linux branch, else I guess I could look at a cvs diff.

Pointers appreciated, thx...

-Paul

-----Original Message-----
From: David Woodhouse <dwmw2@infradead.org>
To: Takeharu KATO <tkato@cs.fujitsu.co.jp>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] Linux-2.4.18 block MTD dead-lock 
Date: Tue, 26 Nov 2002 13:21:33 +0000


tkato@cs.fujitsu.co.jp said:
> 3. The solution
> We changed the sequence of the function called ``get_sb_bdev''  in 
> fs/super.c.  We changed the function to make the block device  to be 
> mounted checked before opening the device.  Please refer the patch to 
> make out the changes in detail.

Wrong fix. Use the fix which is already in 2.4.19.

--
dwmw2

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

end of thread, other threads:[~2002-12-02  9:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-26 13:04 [PATCH] Linux-2.4.18 block MTD dead-lock Takeharu KATO
2002-11-26 13:21 ` David Woodhouse
2002-11-27  0:29   ` Takeharu KATO
  -- strict thread matches above, loose matches on Subject: below --
2002-12-02  9:49 Paul Nash

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox