/[linux-patches]/genpatches-2.6/trunk/2.6.14/1446_15.5_ext2-deadlock.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.14/1446_15.5_ext2-deadlock.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 328 - (show annotations) (download) (as text)
Tue Mar 14 13:34:17 2006 UTC (14 years, 8 months ago) by johnm
File MIME type: text/x-diff
File size: 1900 byte(s)
2.6.14-11, rebase against local tree
1 From: Peter Staubach <staubach@redhat.com>
2 Date: Fri, 17 Feb 2006 21:52:36 +0000 (-0800)
3 Subject: [PATCH] fix deadlock in ext2
4 X-Git-Url: http://www.kernel.org/git/?p=linux/kernel/git/chrisw/linux-2.6.15.y.git;a=commitdiff;h=8fef8ea2a1f28a7611ad0b8ff7b48ceb38db9535
5
6 [PATCH] fix deadlock in ext2
7
8 Fix a deadlock possible in the ext2 file system implementation. This
9 deadlock occurs when a file is removed from an ext2 file system which was
10 mounted with the "sync" mount option.
11
12 The problem is that ext2_xattr_delete_inode() was invoking the routine,
13 sync_dirty_buffer(), using a buffer head which was previously locked via
14 lock_buffer(). The first thing that sync_dirty_buffer() does is to lock
15 the buffer head that it was passed. It does this via lock_buffer(). Oops.
16
17 The solution is to unlock the buffer head in ext2_xattr_delete_inode()
18 before invoking sync_dirty_buffer(). This makes the code in
19 ext2_xattr_delete_inode() obey the same locking rules as all other callers
20 of sync_dirty_buffer() in the ext2 file system implementation.
21
22 Signed-off-by: Peter Staubach <staubach@redhat.com>
23 Signed-off-by: Andrew Morton <akpm@osdl.org>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
25 ---
26
27 --- a/fs/ext2/xattr.c
28 +++ b/fs/ext2/xattr.c
29 @@ -796,18 +796,20 @@ ext2_xattr_delete_inode(struct inode *in
30 ext2_free_blocks(inode, EXT2_I(inode)->i_file_acl, 1);
31 get_bh(bh);
32 bforget(bh);
33 + unlock_buffer(bh);
34 } else {
35 HDR(bh)->h_refcount = cpu_to_le32(
36 le32_to_cpu(HDR(bh)->h_refcount) - 1);
37 if (ce)
38 mb_cache_entry_release(ce);
39 + ea_bdebug(bh, "refcount now=%d",
40 + le32_to_cpu(HDR(bh)->h_refcount));
41 + unlock_buffer(bh);
42 mark_buffer_dirty(bh);
43 if (IS_SYNC(inode))
44 sync_dirty_buffer(bh);
45 DQUOT_FREE_BLOCK(inode, 1);
46 }
47 - ea_bdebug(bh, "refcount now=%d", le32_to_cpu(HDR(bh)->h_refcount) - 1);
48 - unlock_buffer(bh);
49 EXT2_I(inode)->i_file_acl = 0;
50
51 cleanup:

  ViewVC Help
Powered by ViewVC 1.1.20