public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Takeharu KATO <tkato@cs.fujitsu.co.jp>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] Linux-2.4.18 block MTD dead-lock
Date: Tue, 26 Nov 2002 22:04:32 +0900	[thread overview]
Message-ID: <3DE37160.A152A2F5@cs.fujitsu.co.jp> (raw)

[-- 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

             reply	other threads:[~2002-11-26 12:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-26 13:04 Takeharu KATO [this message]
2002-11-26 13:21 ` [PATCH] Linux-2.4.18 block MTD dead-lock 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

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=3DE37160.A152A2F5@cs.fujitsu.co.jp \
    --to=tkato@cs.fujitsu.co.jp \
    --cc=linux-mtd@lists.infradead.org \
    /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