From: Andrew Morton <akpm@digeo.com>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [patch] ext3 deadlock fix
Date: Sun, 15 Dec 2002 12:25:25 -0800 [thread overview]
Message-ID: <3DFCE535.3417CEDB@digeo.com> (raw)
My recent fix for the ext3 data=journal umount data loss problem
has a bug. The filesystem can deadlock if someone runs `mount -o remount'
while the filesystem is under load. Everything which writes to that
filesystem gets stuck in `D' state.
This is because:
a) ext3_sync_fs() has to wait until a transaction has finished.
b) a transaction cannot finish when someone else holds lock_super().
Because lock_super() is used in the block allocator.
The patch ensures that ->sync_fs is never run under lock_super().
Documentation/filesystems/Locking | 2 ++
fs/buffer.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
--- 24/Documentation/filesystems/Locking~sync_fs-fix Sun Dec 15 11:12:48 2002
+++ 24-akpm/Documentation/filesystems/Locking Sun Dec 15 11:16:15 2002
@@ -93,6 +93,7 @@ prototypes:
void (*delete_inode) (struct inode *);
void (*put_super) (struct super_block *);
void (*write_super) (struct super_block *);
+ int (*sync_fs) (struct super_block *);
int (*statfs) (struct super_block *, struct statfs *);
int (*remount_fs) (struct super_block *, int *, char *);
void (*clear_inode) (struct inode *);
@@ -108,6 +109,7 @@ delete_inode: no
clear_inode: no
put_super: yes yes maybe (see below)
write_super: yes yes maybe (see below)
+write_super: yes no maybe (see below)
statfs: yes no no
remount_fs: yes yes maybe (see below)
umount_begin: yes no maybe (see below)
--- 24/fs/buffer.c~sync_fs-fix Sun Dec 15 11:12:48 2002
+++ 24-akpm/fs/buffer.c Sun Dec 15 11:13:13 2002
@@ -327,9 +327,9 @@ int fsync_super(struct super_block *sb)
lock_super(sb);
if (sb->s_dirt && sb->s_op && sb->s_op->write_super)
sb->s_op->write_super(sb);
+ unlock_super(sb);
if (sb->s_op && sb->s_op->sync_fs)
sb->s_op->sync_fs(sb);
- unlock_super(sb);
unlock_kernel();
return sync_buffers(dev, 1);
_
next reply other threads:[~2002-12-15 20:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-15 20:25 Andrew Morton [this message]
2002-12-18 0:16 ` Pierre Lombard
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=3DFCE535.3417CEDB@digeo.com \
--to=akpm@digeo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/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
Powered by JetHome