All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH-2.4] [RESEND] Fix deadlock in journal_create
@ 2003-07-18 21:54 Mark Fasheh
  2003-07-22  1:34 ` Stephen C. Tweedie
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Fasheh @ 2003-07-18 21:54 UTC (permalink / raw)
  To: marcelo; +Cc: sct, linux-kernel

Marcelo,
	I sent this initially against 2.4.21-rc6 and it didn't make it in
 -- even though it got Stephen's OK. Here's a resend -- I've identified that
the bug still exists and 2.4.22-pre7. The patch didn't need to be changed as
it still applies cleanly.

	I ran across a deadlock when trying to do a journal_create
at mount time. The problem is that journal_create does a sync_dev which
eventually tries to do a get_super which does:

down_read(&s->s_umount);

The problem arises if I call journal_create from my read_super method in
which case get_sb_bdev has already done:

down_write(&s->s_umount);

from alloc_super. Replacing the sync_dev call with an fsync_no_super seems
to have fixed the deadlock. 

It you want to test this out using ext3 (I have verified it with my own
filesystem), simply follow these steps:
1) create an ext2 filesystem on a device
2) mount that new partition and make a "journal file" on it (using dd).
get the inode number of that file.
3) unmount it and remount it as an ext3 filesystem using the option:
journal=inode_number where inode number is the inode number of the journal
file you just created.
This will get ext3's read_super method to call ext3_create_journal which
will hang during a journal_create.

A trivial patch to fix this is attached.
	--Mark

--
Mark Fasheh
Software Developer, Oracle Corp
mark.fasheh@oracle.com

--- linux-2.4.22-pre7/fs/jbd/journal.c.orig	2003-05-30 11:49:10.000000000 -0700
+++ linux-2.4.22-pre7/fs/jbd/journal.c	2003-05-30 11:49:18.000000000 -0700
@@ -912,7 +912,7 @@ int journal_create(journal_t *journal)
 		__brelse(bh);
 	}
 
-	sync_dev(journal->j_dev);
+	fsync_no_super(journal->j_dev);
 	jbd_debug(1, "JBD: journal cleared.\n");
 
 	/* OK, fill in the initial static fields in the new superblock */

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

* Re: [PATCH-2.4] [RESEND] Fix deadlock in journal_create
  2003-07-18 21:54 [PATCH-2.4] [RESEND] Fix deadlock in journal_create Mark Fasheh
@ 2003-07-22  1:34 ` Stephen C. Tweedie
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen C. Tweedie @ 2003-07-22  1:34 UTC (permalink / raw)
  To: Mark Fasheh; +Cc: marcelo, linux-kernel, Andrew Morton

Hi,

On Fri, 2003-07-18 at 22:54, Mark Fasheh wrote:
> Marcelo,
> 	I sent this initially against 2.4.21-rc6 and it didn't make it in
>  -- even though it got Stephen's OK. Here's a resend -- I've identified that
> the bug still exists and 2.4.22-pre7. The patch didn't need to be changed as
> it still applies cleanly.

Marcelo, please apply --- the jbd internal journal create code is in
practice unused by ext3 these days now that e2fsprogs groks journals,
but other filesystems wanting to use that code will need this patch.

Cheers,
 Stephen



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

end of thread, other threads:[~2003-07-22  1:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-18 21:54 [PATCH-2.4] [RESEND] Fix deadlock in journal_create Mark Fasheh
2003-07-22  1:34 ` Stephen C. Tweedie

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.