[PATCH] Re: The INN/mmap bug

From: Alexander Viro (viro@math.psu.edu)
Date: Mon Sep 18 2000 - 16:05:11 EDT

  • Next message: Victor Zandy: "2.0/2.2 Bug: SIGTRAP lost"

            That's to fs/buffer.c, generic_file_write() part will go
    separately (it's a separate bug actually - if copy_from_user() in
    generic_file_write() fails we mark page as not-uptodate; if memory
    pressure will drop the buffer_heads attempts to read will blow the page
    contents away).
            
            Linus, does this look OK with you?

    --- buffer.c Mon Sep 18 18:56:29 2000
    +++ buffer.c.new Mon Sep 18 19:11:06 2000
    @@ -1495,6 +1495,8 @@
                             err = get_block(inode, block, bh, 1);
                             if (err)
                                     goto out;
    + if (Page_Uptodate(page))
    + mark_buffer_uptodate(bh, 1);
                             if (buffer_new(bh)) {
                                     unmap_underlying_metadata(bh);
                                     if (block_end > to)
    @@ -1600,8 +1602,10 @@
                             continue;
     
                     if (!buffer_mapped(bh)) {
    - if (iblock < lblock)
    - get_block(inode, iblock, bh, 0);
    + if (iblock < lblock) {
    + if (get_block(inode, iblock, bh, 0))
    + continue;
    + }
                             if (!buffer_mapped(bh)) {
                                     if (!kaddr)
                                             kaddr = kmap(page);
    @@ -1789,7 +1793,11 @@
                     /* Hole? Nothing to do */
                     if (buffer_uptodate(bh))
                             goto unlock;
    - get_block(inode, iblock, bh, 0);
    + err = get_block(inode, iblock, bh, 0);
    + if (err)
    + goto unlock;
    + if (Page_Uptodate(page))
    + mark_buffer_uptodate(bh, 1);
                     /* Still unmapped? Nothing to do */
                     if (!buffer_mapped(bh))
                             goto unlock;

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



    This archive was generated by hypermail 2b29 : Mon Sep 18 2000 - 16:06:16 EDT