1. 09 1月, 2006 25 次提交
    • A
      [PATCH] fix possible PAGE_CACHE_SHIFT overflows · 54b21a79
      Andrew Morton 提交于
      We've had two instances recently of overflows when doing
      
      	64_bit_value = (32_bit_value << PAGE_CACHE_SHIFT)
      
      I did a tree-wide grep of `<<.*PAGE_CACHE_SHIFT' and this is the result.
      
      - afs_rxfs_fetch_descriptor.offset is of type off_t, which seems broken.
      
      - jfs and jffs are limited to 4GB anyway.
      
      - reiserfs map_block_for_writepage() takes an unsigned long for the block -
        it should take sector_t.  (It'll fail for huge filesystems with
        blocksize<PAGE_CACHE_SIZE)
      
      - cramfs_read() needs to use sector_t (I think cramsfs is busted on large
        filesystems anyway)
      
      - affs is limited in file size anyway.
      
      - I generally didn't fix 32-bit overflows in directory operations.
      
      - arm's __flush_dcache_page() is peculiar.  What if the page lies beyond 4G?
      
      - gss_wrap_req_priv() needs checking (snd_buf->page_base)
      
      Cc: Oleg Drokin <green@linuxhacker.ru>
      Cc: David Howells <dhowells@redhat.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: <reiserfs-dev@namesys.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Anton Altaparmakov <aia21@cantab.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Cc: <linux-fsdevel@vger.kernel.org>
      Cc: Miklos Szeredi <miklos@szeredi.hu>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Cc: Neil Brown <neilb@cse.unsw.edu.au>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      54b21a79
    • N
      [PATCH] Fix overflow tests for compat_sys_fcntl64 locking · 2520f14c
      NeilBrown 提交于
      When making an fctl locking call through compat_sys_fcntl64 (i.e.  a 32bit
      app on a 64bit kernel), the syscall can return a locking range that is in
      conflict with the queried lock.
      
      If some aspect of this range does not fit in the 32bit structure, something
      needs to be done.
      
      The current code is wrong in several respects:
      
      - It returns data to userspace even if no conflict was found
         i.e. it should check l_type for F_UNLCK
      - It returns -EOVERFLOW too agressively.   A lock range covering
        the last possible byte of the file (start = COMPAT_OFF_T_MAX,
        len = 1) should be possible, but is rejected with the current test.
      - A extra-long 'len' should not be a problem.  If only that part
        of the conflicting lock that would be visible to the 32bit
        app needs to be reported to the 32bit app anyway.
      
      This patch addresses those three issues and adds a comment to (hopefully)
      record it for posterity.
      
      Note: this patch mainly affects test-cases.  Real applications rarely is
      ever see the problems.
      
      This patch has been tested (LSB test suite), and works.
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Matthew Wilcox <willy@debian.org>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      2520f14c
    • N
      [PATCH] Fix some problems with truncate and mtime semantics. · 4a30131e
      NeilBrown 提交于
      SUS requires that when truncating a file to the size that it currently
      is:
        truncate and ftruncate should NOT modify ctime or mtime
        O_TRUNC SHOULD modify ctime and mtime.
      
      Currently mtime and ctime are always modified on most local
      filesystems (side effect of ->truncate) or never modified (on NFS).
      
      With this patch:
        ATTR_CTIME|ATTR_MTIME are sent with ATTR_SIZE precisely when
          an update of these times is required whether size changes or not
          (via a new argument to do_truncate).  This allows NFS to do
          the right thing for O_TRUNC.
        inode_setattr nolonger forces ATTR_MTIME|ATTR_CTIME when the ATTR_SIZE
          sets the size to it's current value.  This allows local filesystems
          to do the right thing for f?truncate.
      
      Also, the logic in inode_setattr is changed a bit so there are two return
      points.  One returns the error from vmtruncate if it failed, the other
      returns 0 (there can be no other failure).
      
      Finally, if vmtruncate succeeds, and ATTR_SIZE is the only change
      requested, we now fall-through and mark_inode_dirty.  If a filesystem did
      not have a ->truncate function, then vmtruncate will have changed i_size,
      without marking the inode as 'dirty', and I think this is wrong.
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      4a30131e
    • C
      [PATCH] udf: remove bogus inode == NULL check in inode_bmap · b8b0af24
      Christoph Hellwig 提交于
      inode can never be NULL when calling this function.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      b8b0af24
    • T
      [PATCH] relayfs: cleanup, change relayfs_file_* to relay_file_* · 761da5c8
      Tom Zanussi 提交于
      This patch renames relayfs_file_operations to relay_file_operations, and the
      file operations themselves from relayfs_XXX to relay_file_XXX, to make it more
      clear that they refer to relay files.
      Signed-off-by: NTom Zanussi <zanussi@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      761da5c8
    • T
      [PATCH] relayfs: add support for global relay buffers · e6c08367
      Tom Zanussi 提交于
      This patch adds the optional is_global outparam to the create_buf_file()
      callback.  This can be used by clients to create a single global relayfs
      buffer instead of the default per-cpu buffers.  This was suggested as being
      useful for certain debugging applications where it's more convenient to be
      able to get all the data from a single channel without having to go to the
      bother of dealing with per-cpu files.
      Signed-off-by: NTom Zanussi <zanussi@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e6c08367
    • T
      [PATCH] relayfs: add support for relay files in other filesystems · 08c541a7
      Tom Zanussi 提交于
      This patch adds a couple of callback functions that allow a client to hook
      into relay_open()/close() and supply the files that will be used to represent
      the channel buffers; the default implementation if no callbacks are defined is
      to create the files in relayfs.  This is to support the creation and use of
      relay files in other filesystems such as debugfs, as implied by the fact that
      relayfs_file_operations are exported.
      Signed-off-by: NTom Zanussi <zanussi@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      08c541a7
    • T
      [PATCH] relayfs: remove unused alloc/destroy_inode() · aaea25d7
      Tom Zanussi 提交于
      Since we're no longer using relayfs_inode_info, remove relayfs_alloc_inode()
      and relayfs_destroy_inode() along with the relayfs inode cache.
      Signed-off-by: NTom Zanussi <zanussi@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      aaea25d7
    • T
      [PATCH] relayfs: use generic_ip for private data · 51008f9f
      Tom Zanussi 提交于
      Use inode->u.generic_ip instead of relayfs_inode_info to store pointer to user
      data.  Clients using relayfs_file_create() to create their own files would
      probably more expect their data to be stored in generic_ip; we also intend in
      the next set of patches to get rid of relayfs-specific stuff in the file
      operations, so we might as well do it here.
      Signed-off-by: NTom Zanussi <zanussi@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      51008f9f
    • T
      [PATCH] relayfs: add relayfs_remove_file() · 74317337
      Tom Zanussi 提交于
      This patch adds and exports relayfs_remove_file(), for API symmetry (with
      relayfs_create_file()).
      Signed-off-by: NTom Zanussi <zanussi@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      74317337
    • T
      [PATCH] relayfs: export relayfs_create_file() with fileops param · 907f2c77
      Tom Zanussi 提交于
      This patch adds a mandatory fileops param to relayfs_create_file() and exports
      that function so that clients can use it to create files defined by their own
      set of file operations, in relayfs.  The purpose is to allow relayfs
      applications to create their own set of 'control' files alongside their relay
      files in relayfs rather than having to create them in /proc or debugfs for
      instance.  relayfs_create_file() is also used by relay_open_buf() to create
      the relay files for a channel.  In this case, a pointer to
      relayfs_file_operations is passed in, along with a pointer to the buffer
      associated with the file.
      Signed-off-by: NTom Zanussi <zanussi@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      907f2c77
    • T
      [PATCH] relayfs: decouple buffer creation from inode creation · 6625b861
      Tom Zanussi 提交于
      The patch series implementa or fixes 3 things that were specifically requested
      or suggested by relayfs users:
      
      - support for non-relay files (patches 1-6)
      
      Currently, the relayfs API only supports the creation of directories
      (relayfs_create_dir()) and relay files (relay_open()).  These patches adds
      support for non-relay files (relayfs_create_file()).  This is so relayfs
      applications can create 'control files' in relayfs itself rather than in /proc
      or via a netlink channel, as is currently done in the relay-app examples.
      Basically what this amounts to is exporting relayfs_create_file() with an
      additional file_ops param that clients can use to supply file operations for
      their own special-purpose files in relayfs.
      
      - make exported relay file ops useful (patches 7-8)
      
      The relayfs relay_file_operations have always been exported, the intent being
      to make it possible to create relay files in other filesystems such as
      debugfs.  The problem, though, is that currently the file operations are too
      tightly coupled to relayfs to actually be used for this purpose.  This patch
      fixes that by adding a couple of callback functions that allow a client to
      hook into relay_open()/close() and supply the files that will be used to
      represent the channel buffers; the default implementation if no callbacks are
      defined is to create the files in relayfs.
      
      - add an option to create global relay buffer (patches 9-10) The file creation
      callback also supplies an optional param, is_global, that can be used by
      clients to create a single global relayfs buffer instead of the default
      per-cpu buffers.  This was suggested as being useful for certain debugging
      applications where it's more convenient to be able to get all the data from a
      single channel without having to go to the bother of dealing with per-cpu
      files.
      
      - cleanup, some renaming and Documentation updates (patches 11-12)
      
      There were several comments that the use of netlink in the example code was
      non-intuitive and in fact the whole relay-app business was needlessly
      confusing.  Based on that feedback, the example code has been completely
      converted over to relayfs control files as supported by this patch, and have
      also been made completely self-contained.
      
      The converted examples along with a couple of new examples that demonstrate
      using exported relay files can be found in relay-apps tarball:
      http://prdownloads.sourceforge.net/relayfs/relay-apps-0.9.tar.gz?download
      
      This patch:
      
      Separate buffer create/destroy from inode create/destroy.  We want to be able
      to associate other data and not just relay buffers with inodes.  Buffer
      create/destroy is moved out of inode.c and into relayfs core code.
      Signed-off-by: NTom Zanussi <zanussi@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      6625b861
    • N
      [PATCH] rcu file: use atomic primitives · 095975da
      Nick Piggin 提交于
      Use atomic_inc_not_zero for rcu files instead of special case rcuref.
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      095975da
    • O
      [PATCH] Fix and add EXPORT_SYMBOL(filemap_write_and_wait) · 28fd1298
      OGAWA Hirofumi 提交于
      This patch add EXPORT_SYMBOL(filemap_write_and_wait) and use it.
      
      See mm/filemap.c:
      
      And changes the filemap_write_and_wait() and filemap_write_and_wait_range().
      
      Current filemap_write_and_wait() doesn't wait if filemap_fdatawrite()
      returns error.  However, even if filemap_fdatawrite() returned an
      error, it may have submitted the partially data pages to the device.
      (e.g. in the case of -ENOSPC)
      
      <quotation>
      Andrew Morton writes,
      
      If filemap_fdatawrite() returns an error, this might be due to some
      I/O problem: dead disk, unplugged cable, etc.  Given the generally
      crappy quality of the kernel's handling of such exceptions, there's a
      good chance that the filemap_fdatawait() will get stuck in D state
      forever.
      </quotation>
      
      So, this patch doesn't wait if filemap_fdatawrite() returns the -EIO.
      
      Trond, could you please review the nfs part?  Especially I'm not sure,
      nfs must use the "filemap_fdatawrite(inode->i_mapping) == 0", or not.
      Acked-by: NTrond Myklebust <trond.myklebust@fys.uio.no>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      28fd1298
    • O
      [PATCH] fat: support a truncate() for expanding size (generic_cont_expand) · 05eb0b51
      OGAWA Hirofumi 提交于
      This patch changes generic_cont_expand(), in order to share the code
      with fatfs.
      
        - Use vmtruncate() if ->prepare_write() returns a error.
      
      Even if ->prepare_write() returns an error, it may already have added some
      blocks.  So, this truncates blocks outside of ->i_size by vmtruncate().
      
        - Add generic_cont_expand_simple().
      
      The generic_cont_expand_simple() assumes that ->prepare_write() can handle
      the block boundary.  With this, we don't need to care the extra byte.
      
      And for expanding a file size by truncate(), fatfs uses the
      added generic_cont_expand_simple().
      Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      05eb0b51
    • O
      [PATCH] fat: support ->direct_IO() · e5174baa
      OGAWA Hirofumi 提交于
      This patch add to support of ->direct_IO() for mostly read.
      
      The user of this seems to want to use for streaming read.  So, current direct
      I/O has limitation, it can only overwrite.  (For write operation, mainly we
      need to handle the hole etc..)
      Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e5174baa
    • O
      [PATCH] fat: s/EXPORT_SYMBOL/EXPORT_SYMBOL_GPL/ · 7c709d00
      OGAWA Hirofumi 提交于
      All EXPORT_SYMBOL of fatfs is only for vfat/msdos. _GPL would be proper.
      Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      7c709d00
    • O
      a5425d29
    • O
      [PATCH] fat: use sb_find_get_block() instead of sb_getblk() · 83b7c996
      OGAWA Hirofumi 提交于
      We don't need to allocate buffer for checking the buffer is uptodate.  This
      use sb_find_get_block() instead, and if it returns NULL it's not uptodate.
      Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      83b7c996
    • O
      [PATCH] fat: move fat_clusters_flush() to write_super() · a6bf6b21
      OGAWA Hirofumi 提交于
      It is overkill to update the FS_INFO whenever modifying
      prev_free/free_clusters, because those are just a hint.
      
      So, this patch uses ->write_super() for updating FS_INFO instead.
      Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      a6bf6b21
    • M
      [PATCH] slob: introduce the SLOB allocator · 10cef602
      Matt Mackall 提交于
      configurable replacement for slab allocator
      
      This adds a CONFIG_SLAB option under CONFIG_EMBEDDED.  When CONFIG_SLAB is
      disabled, the kernel falls back to using the 'SLOB' allocator.
      
      SLOB is a traditional K&R/UNIX allocator with a SLAB emulation layer,
      similar to the original Linux kmalloc allocator that SLAB replaced.  It's
      signicantly smaller code and is more memory efficient.  But like all
      similar allocators, it scales poorly and suffers from fragmentation more
      than SLAB, so it's only appropriate for small systems.
      
      It's been tested extensively in the Linux-tiny tree.  I've also
      stress-tested it with make -j 8 compiles on a 3G SMP+PREEMPT box (not
      recommended).
      
      Here's a comparison for otherwise identical builds, showing SLOB saving
      nearly half a megabyte of RAM:
      
      $ size vmlinux*
         text    data     bss     dec     hex filename
      3336372  529360  190812 4056544  3de5e0 vmlinux-slab
      3323208  527948  190684 4041840  3dac70 vmlinux-slob
      
      $ size mm/{slab,slob}.o
         text    data     bss     dec     hex filename
        13221     752      48   14021    36c5 mm/slab.o
         1896      52       8    1956     7a4 mm/slob.o
      
      /proc/meminfo:
                        SLAB          SLOB      delta
      MemTotal:        27964 kB      27980 kB     +16 kB
      MemFree:         24596 kB      25092 kB    +496 kB
      Buffers:            36 kB         36 kB       0 kB
      Cached:           1188 kB       1188 kB       0 kB
      SwapCached:          0 kB          0 kB       0 kB
      Active:            608 kB        600 kB      -8 kB
      Inactive:          808 kB        812 kB      +4 kB
      HighTotal:           0 kB          0 kB       0 kB
      HighFree:            0 kB          0 kB       0 kB
      LowTotal:        27964 kB      27980 kB     +16 kB
      LowFree:         24596 kB      25092 kB    +496 kB
      SwapTotal:           0 kB          0 kB       0 kB
      SwapFree:            0 kB          0 kB       0 kB
      Dirty:               4 kB         12 kB      +8 kB
      Writeback:           0 kB          0 kB       0 kB
      Mapped:            560 kB        556 kB      -4 kB
      Slab:             1756 kB          0 kB   -1756 kB
      CommitLimit:     13980 kB      13988 kB      +8 kB
      Committed_AS:     4208 kB       4208 kB       0 kB
      PageTables:         28 kB         28 kB       0 kB
      VmallocTotal:  1007312 kB    1007312 kB       0 kB
      VmallocUsed:        48 kB         48 kB       0 kB
      VmallocChunk:  1007264 kB    1007264 kB       0 kB
      
      (this work has been sponsored in part by CELF)
      
      From: Ingo Molnar <mingo@elte.hu>
      
         Fix 32-bitness bugs in mm/slob.c.
      Signed-off-by: NMatt Mackall <mpm@selenic.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      10cef602
    • I
      [PATCH] RCU signal handling · e56d0903
      Ingo Molnar 提交于
      RCU tasklist_lock and RCU signal handling: send signals RCU-read-locked
      instead of tasklist_lock read-locked.  This is a scalability improvement on
      SMP and a preemption-latency improvement under PREEMPT_RCU.
      Signed-off-by: NPaul E. McKenney <paulmck@us.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Acked-by: NWilliam Irwin <wli@holomorphy.com>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e56d0903
    • D
      [PATCH] frv: suppress configuration of certain features for FRV · 2919b510
      David Howells 提交于
      Suppress configuration of certain features for the FRV arch as they can't be
      built for FRV at the moment:
      
       (*) RTC
      
       (*) HISAX_*
      
       (*) PARPORT_PC
      
       (*) VGA_CONSOLE
      
       (*) BINFMT_ELF
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      2919b510
    • C
      [PATCH] Fold numa_maps into mempolicies.c · 1a75a6c8
      Christoph Lameter 提交于
      First discussed at http://marc.theaimsgroup.com/?t=113149255100001&r=1&w=2
      
      - Use the check_range() in mempolicy.c to gather statistics.
      
      - Improve the numa_maps code in general and fix some comments.
      Signed-off-by: NChristoph Lameter <clameter@sgi.com>
      Cc: Andi Kleen <ak@muc.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      1a75a6c8
    • A
      [PATCH] drop-pagecache · 9d0243bc
      Andrew Morton 提交于
      Add /proc/sys/vm/drop_caches.  When written to, this will cause the kernel to
      discard as much pagecache and/or reclaimable slab objects as it can.  THis
      operation requires root permissions.
      
      It won't drop dirty data, so the user should run `sync' first.
      
      Caveats:
      
      a) Holds inode_lock for exorbitant amounts of time.
      
      b) Needs to be taught about NUMA nodes: propagate these all the way through
         so the discarding can be controlled on a per-node basis.
      
      This is a debugging feature: useful for getting consistent results between
      filesystem benchmarks.  We could possibly put it under a config option, but
      it's less than 300 bytes.
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9d0243bc
  2. 07 1月, 2006 15 次提交