1. 03 4月, 2009 1 次提交
    • G
      preadv/pwritev: Add preadv and pwritev system calls. · f3554f4b
      Gerd Hoffmann 提交于
      This patch adds preadv and pwritev system calls.  These syscalls are a
      pretty straightforward combination of pread and readv (same for write).
      They are quite useful for doing vectored I/O in threaded applications.
      Using lseek+readv instead opens race windows you'll have to plug with
      locking.
      
      Other systems have such system calls too, for example NetBSD, check
      here: http://www.daemon-systems.org/man/preadv.2.html
      
      The application-visible interface provided by glibc should look like
      this to be compatible to the existing implementations in the *BSD family:
      
        ssize_t preadv(int d, const struct iovec *iov, int iovcnt, off_t offset);
        ssize_t pwritev(int d, const struct iovec *iov, int iovcnt, off_t offset);
      
      This prototype has one problem though: On 32bit archs is the (64bit)
      offset argument unaligned, which the syscall ABI of several archs doesn't
      allow to do.  At least s390 needs a wrapper in glibc to handle this.  As
      we'll need a wrappers in glibc anyway I've decided to push problem to
      glibc entriely and use a syscall prototype which works without
      arch-specific wrappers inside the kernel: The offset argument is
      explicitly splitted into two 32bit values.
      
      The patch sports the actual system call implementation and the windup in
      the x86 system call tables.  Other archs follow as separate patches.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: <linux-api@vger.kernel.org>
      Cc: <linux-arch@vger.kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f3554f4b
  2. 14 1月, 2009 5 次提交
  3. 06 1月, 2009 1 次提交
    • A
      vfs: lseek(fd, 0, SEEK_CUR) race condition · 5b6f1eb9
      Alain Knaff 提交于
      This patch fixes a race condition in lseek. While it is expected that
      unpredictable behaviour may result while repositioning the offset of a
      file descriptor concurrently with reading/writing to the same file
      descriptor, this should not happen when merely *reading* the file
      descriptor's offset.
      
      Unfortunately, the only portable way in Unix to read a file
      descriptor's offset is lseek(fd, 0, SEEK_CUR); however executing this
      concurrently with read/write may mess up the position.
      
      [with fixes from akpm]
      Signed-off-by: NAlain Knaff <alain@knaff.lu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      5b6f1eb9
  4. 23 10月, 2008 1 次提交
  5. 03 7月, 2008 1 次提交
    • A
      Remove BKL from remote_llseek v2 · 9465efc9
      Andi Kleen 提交于
      - Replace remote_llseek with generic_file_llseek_unlocked (to force compilation
      failures in all users)
      - Change all users to either use generic_file_llseek_unlocked directly or
      take the BKL around. I changed the file systems who don't use the BKL
      for anything (CIFS, GFS) to call it directly. NCPFS and SMBFS and NFS
      take the BKL, but explicitely in their own source now.
      
      I moved them all over in a single patch to avoid unbisectable sections.
      
      Open problem: 32bit kernels can corrupt fpos because its modification
      is not atomic, but they can do that anyways because there's other paths who
      modify it without BKL.
      
      Do we need a special lock for the pos/f_version = 0 checks?
      
      Trond says the NFS BKL is likely not needed, but keep it for now
      until his full audit.
      
      v2: Use generic_file_llseek_unlocked instead of remote_llseek_unlocked
          and factor duplicated code (suggested by hch)
      
      Cc: Trond.Myklebust@netapp.com
      Cc: swhiteho@redhat.com
      Cc: sfrench@samba.org
      Cc: vandrove@vc.cvut.cz
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NJonathan Corbet <corbet@lwn.net>
      9465efc9
  6. 23 4月, 2008 1 次提交
  7. 09 2月, 2008 1 次提交
  8. 29 1月, 2008 1 次提交
  9. 25 1月, 2008 1 次提交
  10. 15 11月, 2007 1 次提交
    • A
      mark sys_open/sys_read exports unused · cb51f973
      Arjan van de Ven 提交于
      sys_open / sys_read were used in the early 1.2 days to load firmware from
      disk inside drivers.  Since 2.0 or so this was deprecated behavior, but
      several drivers still were using this.  Since a few years we have a
      request_firmware() API that implements this in a nice, consistent way.
      Only some old ISA sound drivers (pre-ALSA) still straggled along for some
      time....  however with commit c2b1239a the
      last user is now gone.
      
      This is a good thing, since using sys_open / sys_read etc for firmware is a
      very buggy to dangerous thing to do; these operations put an fd in the
      process file descriptor table....  which then can be tampered with from
      other threads for example.  For those who don't want the firmware loader,
      filp_open()/vfs_read are the better APIs to use, without this security
      issue.
      
      The patch below marks sys_open and sys_read unused now that they're
      really not used anymore, and for deletion in the 2.6.25 timeframe.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cb51f973
  11. 10 10月, 2007 1 次提交
    • P
      Cleanup macros for distinguishing mandatory locks · a16877ca
      Pavel Emelyanov 提交于
      The combination of S_ISGID bit set and S_IXGRP bit unset is used to mark the
      inode as "mandatory lockable" and there's a macro for this check called
      MANDATORY_LOCK(inode).  However, fs/locks.c and some filesystems still perform
      the explicit i_mode checking.  Besides, Andrew pointed out, that this macro is
      buggy itself, as it dereferences the inode arg twice.
      
      Convert this macro into static inline function and switch its users to it,
      making the code shorter and more readable.
      
      The __mandatory_lock() helper is to be used in places where the IS_MANDLOCK()
      for superblock is already known to be true.
      Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Eric Van Hensbergen <ericvh@gmail.com>
      Cc: Ron Minnich <rminnich@sandia.gov>
      Cc: Latchesar Ionkov <lucho@ionkov.net>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      a16877ca
  12. 10 7月, 2007 3 次提交
  13. 09 5月, 2007 2 次提交
  14. 13 2月, 2007 1 次提交
    • E
      [PATCH] FS: speed up rw_verify_area() · 163da958
      Eric Dumazet 提交于
      oprofile hunting showed a stall in rw_verify_area(), because of triple
      indirection and potential cache misses.
      (file->f_path.dentry->d_inode->i_flock)
      
      By moving initialization of 'struct inode' pointer before the pos/count
      sanity tests, we allow the compiler and processor to perform two loads by
      anticipation, reducing stall, without prefetch() hints.  Even x86 arch has
      enough registers to not use temporary variables and not increase text size.
      
      I validated this patch running a bench and studied oprofile changes, and
      absolute perf of the test program.
      
      Results of my epoll_pipe_bench (source available on request) on a Pentium-M
      1.6 GHz machine
      
      Before :
      # ./epoll_pipe_bench -l 30 -t 20
      Avg: 436089 evts/sec read_count=8843037 write_count=8843040 21.218390 samples
      per call
      (best value out of 10 runs)
      
      After :
      # ./epoll_pipe_bench -l 30 -t 20
      Avg: 470980 evts/sec read_count=9549871 write_count=9549894 21.216694 samples
      per call
      (best value out of 10 runs)
      
      oprofile CPU_CLK_UNHALTED events gave a reduction from 5.3401 % to 2.5851 %
      for the rw_verify_area() function.
      Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      163da958
  15. 12 2月, 2007 1 次提交
  16. 14 12月, 2006 1 次提交
  17. 09 12月, 2006 1 次提交
  18. 01 10月, 2006 4 次提交
  19. 11 7月, 2006 1 次提交
  20. 11 4月, 2006 1 次提交
  21. 29 3月, 2006 1 次提交
  22. 26 3月, 2006 1 次提交
  23. 10 1月, 2006 1 次提交
  24. 05 1月, 2006 1 次提交
    • L
      Relax the rw_verify_area() error checking. · e28cc715
      Linus Torvalds 提交于
      In particular, allow over-large read- or write-requests to be downgraded
      to a more reasonable range, rather than considering them outright errors.
      
      We want to protect lower layers from (the sadly all too common) overflow
      conditions, but prefer to do so by chopping the requests up, rather than
      just refusing them outright.
      
      Cc: Peter Anvin <hpa@zytor.com>
      Cc: Ulrich Drepper <drepper@redhat.com>
      Cc: Andi Kleen <ak@suse.de>
      Cc: Al Viro <viro@ftp.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e28cc715
  25. 30 9月, 2005 1 次提交
  26. 08 9月, 2005 1 次提交
  27. 13 7月, 2005 1 次提交
    • R
      [PATCH] inotify · 0eeca283
      Robert Love 提交于
      inotify is intended to correct the deficiencies of dnotify, particularly
      its inability to scale and its terrible user interface:
      
              * dnotify requires the opening of one fd per each directory
                that you intend to watch. This quickly results in too many
                open files and pins removable media, preventing unmount.
              * dnotify is directory-based. You only learn about changes to
                directories. Sure, a change to a file in a directory affects
                the directory, but you are then forced to keep a cache of
                stat structures.
              * dnotify's interface to user-space is awful.  Signals?
      
      inotify provides a more usable, simple, powerful solution to file change
      notification:
      
              * inotify's interface is a system call that returns a fd, not SIGIO.
      	  You get a single fd, which is select()-able.
              * inotify has an event that says "the filesystem that the item
                you were watching is on was unmounted."
              * inotify can watch directories or files.
      
      Inotify is currently used by Beagle (a desktop search infrastructure),
      Gamin (a FAM replacement), and other projects.
      
      See Documentation/filesystems/inotify.txt.
      Signed-off-by: NRobert Love <rml@novell.com>
      Cc: John McCutchan <ttb@tentacle.dhs.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      0eeca283
  28. 24 6月, 2005 1 次提交
  29. 17 4月, 2005 2 次提交