1. 07 10月, 2008 1 次提交
    • T
      NFS: Fix nfs_file_llseek() · d5e66348
      Trond Myklebust 提交于
      After the BKL removal patches were applied to the rest of the NFS code, the
      BKL protection in nfs_file_llseek() is no longer sufficient to ensure that
      inode->i_size is read safely in generic_file_llseek_unlocked().
      
      In order to fix the situation, we either have to replace the naked read of
      inode->i_size in generic_file_llseek_unlocked() with i_size_read(), or the
      whole thing needs to be executed under the inode->i_lock;
      In order to avoid disrupting other filesystems, avoid touching
      generic_file_llseek_unlocked() for now...
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      d5e66348
  2. 16 7月, 2008 2 次提交
  3. 10 7月, 2008 9 次提交
  4. 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
  5. 17 5月, 2008 1 次提交
  6. 20 4月, 2008 1 次提交
  7. 09 4月, 2008 1 次提交
  8. 20 3月, 2008 1 次提交
  9. 30 1月, 2008 2 次提交
  10. 20 10月, 2007 1 次提交
  11. 17 10月, 2007 1 次提交
  12. 10 10月, 2007 5 次提交
  13. 01 9月, 2007 1 次提交
    • T
      NFS: Fix a write request leak in nfs_invalidate_page() · 1b3b4a1a
      Trond Myklebust 提交于
      Ryusuke Konishi says:
      
      The recent truncate_complete_page() clears the dirty flag from a page
      before calling a_ops->invalidatepage(),
      ^^^^^^
      static void
      truncate_complete_page(struct address_space *mapping, struct page *page)
      {
              ...
              cancel_dirty_page(page, PAGE_CACHE_SIZE);  <--- Inserted here at
      kernel 2.6.20
      
              if (PagePrivate(page))
                      do_invalidatepage(page, 0);   ---> will call
      a_ops->invalidatepage()
              ...
      }
      
      and this is disturbing nfs_wb_page_priority() from calling 
      nfs_writepage_locked() that is expected to handle the pending
      request (=nfs_page) associated with the page.
      
      int nfs_wb_page_priority(struct inode *inode, struct page *page, int how)
      {
              ...
              if (clear_page_dirty_for_io(page)) {
                      ret = nfs_writepage_locked(page, &wbc);
                      if (ret < 0)
                              goto out;
              }
              ...
      }
      
      Since truncate_complete_page() will get rid of the page after
      a_ops->invalidatepage() returns, the request (=nfs_page) associated
      with the page becomes a garbage in nfs_inode->nfs_page_tree.
      ------------------------
      
      Fix this by ensuring that nfs_wb_page_priority() recognises that it may
      also need to clear out non-dirty pages that have an nfs_page associated
      with them.
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      1b3b4a1a
  14. 19 7月, 2007 2 次提交
    • J
      locks: make posix_test_lock() interface more consistent · 6d34ac19
      J. Bruce Fields 提交于
      Since posix_test_lock(), like fcntl() and ->lock(), indicates absence or
      presence of a conflict lock by setting fl_type to, respectively, F_UNLCK
      or something other than F_UNLCK, the return value is no longer needed.
      Signed-off-by: N"J. Bruce Fields" <bfields@citi.umich.edu>
      6d34ac19
    • J
      nfs: disable leases over NFS · 370f6599
      J. Bruce Fields 提交于
      As Peter Staubach says elsewhere
      (http://marc.info/?l=linux-kernel&m=118113649526444&w=2):
      
      > The problem is that some file system such as NFSv2 and NFSv3 do
      > not have sufficient support to be able to support leases correctly.
      > In particular for these two file systems, there is no over the wire
      > protocol support.
      >
      > Currently, these two file systems fail the fcntl(F_SETLEASE) call
      > accidentally, due to a reference counting difference.  These file
      > systems should fail more consciously, with a proper error to
      > indicate that the call is invalid for them.
      
      Define an nfs setlease method that just returns -EINVAL.
      
      If someone can demonstrate a real need, perhaps we could reenable
      them in the presence of the "nolock" mount option.
      Signed-off-by: N"J. Bruce Fields" <bfields@citi.umich.edu>
      Cc: Peter Staubach <staubach@redhat.com>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      370f6599
  15. 10 7月, 2007 1 次提交
  16. 22 5月, 2007 1 次提交
    • A
      Detach sched.h from mm.h · e8edc6e0
      Alexey Dobriyan 提交于
      First thing mm.h does is including sched.h solely for can_do_mlock() inline
      function which has "current" dereference inside. By dealing with can_do_mlock()
      mm.h can be detached from sched.h which is good. See below, why.
      
      This patch
      a) removes unconditional inclusion of sched.h from mm.h
      b) makes can_do_mlock() normal function in mm/mlock.c
      c) exports can_do_mlock() to not break compilation
      d) adds sched.h inclusions back to files that were getting it indirectly.
      e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
         getting them indirectly
      
      Net result is:
      a) mm.h users would get less code to open, read, preprocess, parse, ... if
         they don't need sched.h
      b) sched.h stops being dependency for significant number of files:
         on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
         after patch it's only 3744 (-8.3%).
      
      Cross-compile tested on
      
      	all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
      	alpha alpha-up
      	arm
      	i386 i386-up i386-defconfig i386-allnoconfig
      	ia64 ia64-up
      	m68k
      	mips
      	parisc parisc-up
      	powerpc powerpc-up
      	s390 s390-up
      	sparc sparc-up
      	sparc64 sparc64-up
      	um-x86_64
      	x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig
      
      as well as my two usual configs.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e8edc6e0
  17. 07 5月, 2007 1 次提交
  18. 13 2月, 2007 1 次提交
  19. 31 1月, 2007 1 次提交
  20. 12 1月, 2007 1 次提交
    • T
      [PATCH] NFS: Fix race in nfs_release_page() · e3db7691
      Trond Myklebust 提交于
          NFS: Fix race in nfs_release_page()
      
          invalidate_inode_pages2() may find the dirty bit has been set on a page
          owing to the fact that the page may still be mapped after it was locked.
          Only after the call to unmap_mapping_range() are we sure that the page
          can no longer be dirtied.
          In order to fix this, NFS has hooked the releasepage() method and tries
          to write the page out between the call to unmap_mapping_range() and the
          call to remove_mapping(). This, however leads to deadlocks in the page
          reclaim code, where the page may be locked without holding a reference
          to the inode or dentry.
      
          Fix is to add a new address_space_operation, launder_page(), which will
          attempt to write out a dirty page without releasing the page lock.
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      
          Also, the bare SetPageDirty() can skew all sort of accounting leading to
          other nasties.
      
      [akpm@osdl.org: cleanup]
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e3db7691
  21. 09 12月, 2006 1 次提交
  22. 06 12月, 2006 4 次提交