lkml.org 
[lkml]   [2004]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: kernel BUG at fs/ext3/balloc.c:942!
From
Date
On Wed, 2004-05-05 at 14:31, Zwane Mwaikambo wrote:
> Shout at me if you need something else, right now i need to reboot my
> workstation.

Thanks for working this problem with us.

The problem is that the reservation window is being discard too early in
ext3_release_file(). ext3_release_file() calls
ext3_discard_resercation() on the last file_close(). It is possible for
two process who open same file for write, while one process discarded a
reservation window when it is the last one closed it's own filp, while
another process is in the middle of using that reservation window for
block allocation on that inode.

We should really discard the reservation window on the last writer on
the inode, instead of the last writer on the filp.

Here is the patch to fix this issue.

This should fix a reservation window race between multiple processes when one process closed the file while another one is in the middle of block allocation using the inode's reservation window. reservation window should be discard on the last writer on the inode, not the last writer on the filp.


---

src-ming/fs/ext3/file.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN fs/ext3/file.c~ext3_reservation_discard_race_fix fs/ext3/file.c
--- src/fs/ext3/file.c~ext3_reservation_discard_race_fix 2004-05-06 22:46:44.338842592 -0700
+++ src-ming/fs/ext3/file.c 2004-05-07 00:48:58.059947520 -0700
@@ -33,7 +33,8 @@
*/
static int ext3_release_file (struct inode * inode, struct file * filp)
{
- if (filp->f_mode & FMODE_WRITE)
+ /* if we are the last writer on the inode, drop the block reservation */
+ if (filp->f_mode & FMODE_WRITE && (atomic_read(&inode->i_writecount) == 1))
ext3_discard_reservation(inode);
if (is_dx(inode) && filp->private_data)
ext3_htree_free_dir_info(filp->private_data);
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:03    [W:0.827 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site