]>
Commit | Line | Data |
---|---|---|
723fa9aa JR |
1 | From: Eric Sandeen <sandeen@sgi.com> |
2 | Subject: TAKE - Add buffer to inode's dirty list after truncate() | |
3 | To: undisclosed-recipients: ; | |
4 | Date: Tue, 24 Sep 2002 16:39:35 -0500 | |
5 | Lines: 29 | |
6 | ||
7 | block_truncate_page() does a __mark_buffer_dirty(bh) at the end, but it | |
8 | does not file the buffer on the inode's dirty data queue, so only | |
9 | bdflush can ever get to it, and other sync mechanisms which call | |
10 | fsync_inode_data_buffers() do not see it. | |
11 | ||
12 | This was the root cause of the mapcheck program failing on fsr'd files, | |
13 | it found data past EOF as a result of the failed sync after truncate. | |
14 | ||
15 | This one seems to have the Kernel Gods' blessings, and will hopefully | |
16 | be in 2.4.20. | |
17 | ||
18 | Index: linux/fs/buffer.c | |
19 | =================================================================== | |
20 | RCS file: /cvs/linux-2.4-xfs/linux/fs/buffer.c,v | |
21 | retrieving revision 1.109 | |
22 | retrieving revision 1.110 | |
23 | diff -u -r1.109 -r1.110 | |
24 | --- linux/fs/buffer.c 2002/07/25 15:31:36 1.109 | |
25 | +++ linux/fs/buffer.c 2002/09/24 21:36:23 1.110 | |
26 | @@ -2028,7 +2028,12 @@ | |
27 | flush_dcache_page(page); | |
28 | kunmap(page); | |
29 | ||
30 | - __mark_buffer_dirty(bh); | |
31 | + if (!atomic_set_buffer_dirty(bh)) { | |
32 | + __mark_dirty(bh); | |
33 | + buffer_insert_inode_data_queue(bh, inode); | |
34 | + balance_dirty(); | |
35 | + } | |
36 | + | |
37 | err = 0; | |
38 | ||
39 | unlock: |