]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] random fixes
authorAndrew Morton <akpm@zip.com.au>
Tue, 13 Aug 2002 08:08:17 +0000 (01:08 -0700)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Tue, 13 Aug 2002 08:08:17 +0000 (01:08 -0700)
- I changed the sector_t thing in max_block to use davem's approach.
  I agree with Anton, but making it explicit doesn't hurt.

- Remove a dead comment in copy_strings.

Old stuff:

- Remove the IO error warning in end_buffer_io_sync().  Failed READA
  attempts trigger it.

- Emit a warning when an ext2 is mounting an ext3 filesystem.

  We have had quite a few problem reports related to this, mainly
  arising from initrd problems.  And mount(8) tends to report the
  fstype from /etc/fstab rather than reporting what has really
  happened.

Fixes some bogosity which I added to max_block():

- `size' doesn't need to be sector_t

- `retval' should not be initialised to "~0UL" because that is
  0x00000000ffffffff with 64-bit sector_t.

- Allocate task_structs with GFP_KERNEL, as discussed.

- Convert the EXPORT_SYMBOL for generic_file_direct_IO() to
  EXPORT_SYMBOL_GPL.  That was only exported as a practicality for the
  raw driver.

- Make the loop thread run balance_dirty_pages() after dirtying the
  backing file.  So it will perform writeback of the backing file when
  dirty memory levels are high.  Export balance_dirty_pages to GPL
  modules for this.

  This makes loop work a lot better - I suspect it broke when callers
  of balance_dirty_pages() started writing back only their own queue.

  There are many page allocation failures under heavy loop writeout.
  Coming from blk_queue_bounce()'s allocation from the page_pool
  mempool.  So...

- Disable page allocation warnings around the initial atomic
  allocation attempt in mempool_alloc() - the one where __GFP_WAIT and
  __GFP_IO were turned off.  That one can easily fail.

- Add some commentary in block_write_full_page()

drivers/block/loop.c
fs/block_dev.c
fs/buffer.c
fs/exec.c
fs/ext2/super.c
kernel/fork.c
kernel/ksyms.c
mm/mempool.c
mm/page-writeback.c

index 8235f3e205ff74349904aad1a5a6c42b51333366..a66f21b8e348250e5099acdc9631913e178da200 100644 (file)
@@ -74,6 +74,7 @@
 #include <linux/slab.h>
 #include <linux/loop.h>
 #include <linux/suspend.h>
+#include <linux/writeback.h>
 #include <linux/buffer_head.h>         /* for invalidate_bdev() */
 
 #include <asm/uaccess.h>
@@ -235,6 +236,7 @@ do_lo_send(struct loop_device *lo, struct bio_vec *bvec, int bsize, loff_t pos)
        up(&mapping->host->i_sem);
 out:
        kunmap(bvec->bv_page);
+       balance_dirty_pages(mapping);
        return ret;
 
 unlock:
index 7aa40fbcdc5bd545dac18e4f97786350197fe0f8..c0c57fe9e9b8a5a173e99304a4e6aee77013caa3 100644 (file)
 
 static sector_t max_block(struct block_device *bdev)
 {
-       sector_t retval = ~0U;
+       sector_t retval = ~((sector_t)0);
        loff_t sz = bdev->bd_inode->i_size;
 
        if (sz) {
-               sector_t size = block_size(bdev);
-               unsigned sizebits = blksize_bits(size);
+               unsigned int size = block_size(bdev);
+               unsigned int sizebits = blksize_bits(size);
                retval = (sz >> sizebits);
        }
        return retval;
index bebac5237a09ae8ff042f3066d419911d699b8e2..588255f134bc9b63efac6f9d2119345cc9ab3b2b 100644 (file)
@@ -180,7 +180,10 @@ void end_buffer_io_sync(struct buffer_head *bh, int uptodate)
        if (uptodate) {
                set_buffer_uptodate(bh);
        } else {
-               buffer_io_error(bh);
+               /*
+                * This happens, due to failed READA attempts.
+                * buffer_io_error(bh);
+                */
                clear_buffer_uptodate(bh);
        }
        unlock_buffer(bh);
@@ -2307,7 +2310,13 @@ int block_write_full_page(struct page *page, get_block_t *get_block)
                return -EIO;
        }
 
-       /* The page straddles i_size */
+       /*
+        * The page straddles i_size.  It must be zeroed out on each and every
+        * writepage invokation because it may be mmapped.  "A file is mapped
+        * in multiples of the page size.  For a file that is not a multiple of
+        * the  page size, the remaining memory is zeroed when mapped, and
+        * writes to that region are not written out to the file."
+        */
        kaddr = kmap(page);
        memset(kaddr + offset, 0, PAGE_CACHE_SIZE - offset);
        flush_dcache_page(page);
index cc1e09c5aa74a29616cc67192fcfcb476917cb7f..fd97224fbe53bb89ae0bb220510acb295ec7855a 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -209,11 +209,6 @@ int copy_strings(int argc,char ** argv, struct linux_binprm *bprm)
                /* XXX: add architecture specific overflow check here. */ 
                pos = bprm->p;
 
-               /*
-                * The only sleeping function which we are allowed to call in
-                * this loop is copy_from_user().  Otherwise, copy_user_state
-                * could get trashed.
-                */
                while (len > 0) {
                        int i, new, err;
                        int offset, bytes_to_copy;
index d07d36b9f3960e02d891a00876965f59004ebeca..86b12fb1f1d3bc77515e88e2b89d40be3a77e9c9 100644 (file)
@@ -698,6 +698,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
                        printk(KERN_ERR "EXT2-fs: get root inode failed\n");
                goto failed_mount2;
        }
+       if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL))
+               ext2_warning(sb, __FUNCTION__,
+                       "mounting ext3 filesystem as ext2\n");
        ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY);
        return 0;
 failed_mount2:
index 3cb62cfcf4fd541e8c783da959bd8ddf1803856e..e4944ff2d8456d26983211d7b35c912cea2f5b88 100644 (file)
@@ -131,9 +131,10 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
        struct thread_info *ti;
 
        ti = alloc_thread_info();
-       if (!ti) return NULL;
+       if (!ti)
+               return NULL;
 
-       tsk = kmem_cache_alloc(task_struct_cachep,GFP_ATOMIC);
+       tsk = kmem_cache_alloc(task_struct_cachep, GFP_KERNEL);
        if (!tsk) {
                free_thread_info(ti);
                return NULL;
index df2891739e70674caa0db133f2f7ca03a1803b1b..da09faf43b179b6ce4962c8d943c9d128aa7c829 100644 (file)
@@ -344,7 +344,7 @@ EXPORT_SYMBOL(register_disk);
 EXPORT_SYMBOL(read_dev_sector);
 EXPORT_SYMBOL(init_buffer);
 EXPORT_SYMBOL(wipe_partitions);
-EXPORT_SYMBOL(generic_file_direct_IO);
+EXPORT_SYMBOL_GPL(generic_file_direct_IO);
 
 /* tty routines */
 EXPORT_SYMBOL(tty_hangup);
index 72ec82d40cd779574aa41829985eceb3cc856c17..94a5352feb8cc5f91b07e523d0df6b1d3703ca60 100644 (file)
@@ -189,7 +189,9 @@ void * mempool_alloc(mempool_t *pool, int gfp_mask)
        int gfp_nowait = gfp_mask & ~(__GFP_WAIT | __GFP_IO);
 
 repeat_alloc:
+       current->flags |= PF_NOWARN;
        element = pool->alloc(gfp_nowait, pool->pool_data);
+       current->flags &= ~PF_NOWARN;
        if (likely(element != NULL))
                return element;
 
index 618983fbe4715aacc98398354648378d8a99d378..6f5486a7e0bc7c65f2329ba5bbdc630346ecf2b8 100644 (file)
@@ -136,6 +136,7 @@ void balance_dirty_pages(struct address_space *mapping)
        if (!writeback_in_progress(bdi) && ps.nr_dirty > background_thresh)
                pdflush_operation(background_writeout, 0);
 }
+EXPORT_SYMBOL_GPL(balance_dirty_pages);
 
 /**
  * balance_dirty_pages_ratelimited - balance dirty memory state