From: Martin Wilck <martin.wilck@ts.fujitsu.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, fmayhar@google.com,
esandeen@redhat.com, Martin Wilck <martin.wilck@ts.fujitsu.com>
Subject: [resend PATCH] ext4: avoid deadlock on sync-mounted ext2 FS
Date: Fri, 10 Feb 2012 11:31:57 +0100 [thread overview]
Message-ID: <1328869917-21492-1-git-send-email-martin.wilck@ts.fujitsu.com> (raw)
In-Reply-To: <1327941292-3907-1-git-send-email-martin.wilck@ts.fujitsu.com>
I don't want to bother, but could someone have a look at this
patch please?
Martin
Processes hang forever on a sync-mounted ext2 file system that
is mounted with the ext4 module (default in Fedora 16).
I can reproduce this reliably by mounting an ext2 partition with
"-o sync" and opening a new file an that partition with vim. vim
will hang in "D" state forever.
I am attaching a small patch here that solves this issue for me.
In the sync mounted case, ext4_handle_dirty_metadata() may call
sync_dirty_buffer(), which can't be called with buffer lock held.
My knowledge of locking in ext4 is insufficient to judge if this
patch is correct, but it may serve as starting point for others.
Signed-off-by: Martin.Wilck@ts.fujitsu.com
---
fs/ext4/xattr.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 93a00d8..eb771ea 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -487,8 +487,10 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
ext4_free_blocks(handle, inode, bh, 0, 1,
EXT4_FREE_BLOCKS_METADATA |
EXT4_FREE_BLOCKS_FORGET);
+ unlock_buffer(bh);
} else {
le32_add_cpu(&BHDR(bh)->h_refcount, -1);
+ unlock_buffer(bh);
error = ext4_handle_dirty_metadata(handle, inode, bh);
if (IS_SYNC(inode))
ext4_handle_sync(handle);
@@ -498,7 +500,6 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
if (ce)
mb_cache_entry_release(ce);
}
- unlock_buffer(bh);
out:
ext4_std_error(inode->i_sb, error);
return;
--
1.7.7.5
next prev parent reply other threads:[~2012-02-10 10:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-30 16:34 [PATCH] ext4: avoid deadlock on sync-mounted ext2 FS Martin Wilck
2012-02-10 10:31 ` Martin Wilck [this message]
2012-02-10 22:43 ` [resend PATCH] " Eric Sandeen
2012-02-10 23:15 ` Eric Sandeen
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=1328869917-21492-1-git-send-email-martin.wilck@ts.fujitsu.com \
--to=martin.wilck@ts.fujitsu.com \
--cc=adilger.kernel@dilger.ca \
--cc=esandeen@redhat.com \
--cc=fmayhar@google.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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