1. 22 5月, 2009 1 次提交
  2. 08 5月, 2009 1 次提交
  3. 17 4月, 2009 3 次提交
  4. 12 3月, 2009 6 次提交
  5. 05 1月, 2009 1 次提交
    • N
      fs: symlink write_begin allocation context fix · 54566b2c
      Nick Piggin 提交于
      With the write_begin/write_end aops, page_symlink was broken because it
      could no longer pass a GFP_NOFS type mask into the point where the
      allocations happened.  They are done in write_begin, which would always
      assume that the filesystem can be entered from reclaim.  This bug could
      cause filesystem deadlocks.
      
      The funny thing with having a gfp_t mask there is that it doesn't really
      allow the caller to arbitrarily tinker with the context in which it can be
      called.  It couldn't ever be GFP_ATOMIC, for example, because it needs to
      take the page lock.  The only thing any callers care about is __GFP_FS
      anyway, so turn that into a single flag.
      
      Add a new flag for write_begin, AOP_FLAG_NOFS.  Filesystems can now act on
      this flag in their write_begin function.  Change __grab_cache_page to
      accept a nofs argument as well, to honour that flag (while we're there,
      change the name to grab_cache_page_write_begin which is more instructive
      and does away with random leading underscores).
      
      This is really a more flexible way to go in the end anyway -- if a
      filesystem happens to want any extra allocations aside from the pagecache
      ones in ints write_begin function, it may now use GFP_KERNEL (rather than
      GFP_NOFS) for common case allocations (eg.  ocfs2_alloc_write_ctxt, for a
      random example).
      
      [kosaki.motohiro@jp.fujitsu.com: fix ubifs]
      [kosaki.motohiro@jp.fujitsu.com: fix fuse]
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Reviewed-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: <stable@kernel.org>		[2.6.28.x]
      Signed-off-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      [ Cleaned up the calling convention: just pass in the AOP flags
        untouched to the grab_cache_page_write_begin() function.  That
        just simplifies everybody, and may even allow future expansion of the
        logic.   - Linus ]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      54566b2c
  6. 26 12月, 2008 2 次提交
    • S
      [CIFS] remove sparse warning · acc18aa1
      Steve French 提交于
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      acc18aa1
    • S
      [CIFS] add mount option to send mandatory rather than advisory locks · 13a6e42a
      Steve French 提交于
      Some applications/subsystems require mandatory byte range locks
      (as is used for Windows/DOS/OS2 etc). Sending advisory (posix style)
      byte range lock requests (instead of mandatory byte range locks) can
      lead to problems for these applications (which expect that other
      clients be prevented from writing to portions of the file which
      they have locked and are updating).  This mount option allows
      mounting cifs with the new mount option "forcemand" (or
      "forcemandatorylock") in order to have the cifs client use mandatory
      byte range locks (ie SMB/CIFS/Windows/NTFS style locks) rather than
      posix byte range lock requests, even if the server would support
      posix byte range lock requests.  This has no effect if the server
      does not support the CIFS Unix Extensions (since posix style locks
      require support for the CIFS Unix Extensions), but for mounts
      to Samba servers this can be helpful for Wine and applications
      that require mandatory byte range locks.
      Acked-by: NJeff Layton <jlayton@redhat.com>
      CC: Alexander Bokovoy <ab@samba.org>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      13a6e42a
  7. 27 11月, 2008 1 次提交
    • J
      [CIFS] fix regression in cifs_write_begin/cifs_write_end · a98ee8c1
      Jeff Layton 提交于
      The conversion to write_begin/write_end interfaces had a bug where we
      were passing a bad parameter to cifs_readpage_worker. Rather than
      passing the page offset of the start of the write, we needed to pass the
      offset of the beginning of the page. This was reliably showing up as
      data corruption in the fsx-linux test from LTP.
      
      It also became evident that this code was occasionally doing unnecessary
      read calls. Optimize those away by using the PG_checked flag to indicate
      that the unwritten part of the page has been initialized.
      
      CC: Nick Piggin <npiggin@suse.de>
      Acked-by: NDave Kleikamp <shaggy@us.ibm.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      a98ee8c1
  8. 21 11月, 2008 1 次提交
    • S
      [CIFS] Do not attempt to close invalidated file handles · ddb4cbfc
      Steve French 提交于
      If a connection with open file handles has gone down
      and come back up and reconnected without reopening
      the file handle yet, do not attempt to send an SMB close
      request for this handle in cifs_close.  We were
      checking for the connection being invalid in cifs_close
      but since the connection may have been reconnected
      we also need to check whether the file handle
      was marked invalid (otherwise we could close the
      wrong file handle by accident).
      Acked-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      ddb4cbfc
  9. 18 11月, 2008 1 次提交
    • D
      prevent cifs_writepages() from skipping unwritten pages · b066a48c
      Dave Kleikamp 提交于
      Fixes a data corruption under heavy stress in which pages could be left
      dirty after all open instances of a inode have been closed.
      
      In order to write contiguous pages whenever possible, cifs_writepages()
      asks pagevec_lookup_tag() for more pages than it may write at one time.
      Normally, it then resets index just past the last page written before calling
      pagevec_lookup_tag() again.
      
      If cifs_writepages() can't write the first page returned, it wasn't resetting
      index, and the next call to pagevec_lookup_tag() resulted in skipping all of
      the pages it previously returned, even though cifs_writepages() did nothing
      with them.  This can result in data loss when the file descriptor is about
      to be closed.
      
      This patch ensures that index gets set back to the next returned page so
      that none get skipped.
      Signed-off-by: NDave Kleikamp <shaggy@linux.vnet.ibm.com>
      Acked-by: NJeff Layton <jlayton@redhat.com>
      Cc: Shirish S Pargaonkar <shirishp@us.ibm.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      b066a48c
  10. 14 11月, 2008 1 次提交
    • S
      [CIFS] Fix cifs reconnection flags · 3b795210
      Steve French 提交于
      In preparation for Jeff's big umount/mount fixes to remove the possibility of
      various races in cifs mount and linked list handling of sessions, sockets and
      tree connections, this patch cleans up some repetitive code in cifs_mount,
      and addresses a problem with ses->status and tcon->tidStatus in which we
      were overloading the "need_reconnect" state with other status in that
      field.  So the "need_reconnect" flag has been broken out from those
      two state fields (need reconnect was not mutually exclusive from some of the
      other possible tid and ses states).  In addition, a few exit cases in
      cifs_mount were cleaned up, and a problem with a tcon flag (for lease support)
      was not being set consistently for the 2nd mount of the same share
      
      CC: Jeff Layton <jlayton@redhat.com>
      CC: Shirish Pargaonkar <shirishp@us.ibm.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      3b795210
  11. 31 10月, 2008 1 次提交
  12. 20 10月, 2008 1 次提交
    • R
      vmscan: split LRU lists into anon & file sets · 4f98a2fe
      Rik van Riel 提交于
      Split the LRU lists in two, one set for pages that are backed by real file
      systems ("file") and one for pages that are backed by memory and swap
      ("anon").  The latter includes tmpfs.
      
      The advantage of doing this is that the VM will not have to scan over lots
      of anonymous pages (which we generally do not want to swap out), just to
      find the page cache pages that it should evict.
      
      This patch has the infrastructure and a basic policy to balance how much
      we scan the anon lists and how much we scan the file lists.  The big
      policy changes are in separate patches.
      
      [lee.schermerhorn@hp.com: collect lru meminfo statistics from correct offset]
      [kosaki.motohiro@jp.fujitsu.com: prevent incorrect oom under split_lru]
      [kosaki.motohiro@jp.fujitsu.com: fix pagevec_move_tail() doesn't treat unevictable page]
      [hugh@veritas.com: memcg swapbacked pages active]
      [hugh@veritas.com: splitlru: BDI_CAP_SWAP_BACKED]
      [akpm@linux-foundation.org: fix /proc/vmstat units]
      [nishimura@mxp.nes.nec.co.jp: memcg: fix handling of shmem migration]
      [kosaki.motohiro@jp.fujitsu.com: adjust Quicklists field of /proc/meminfo]
      [kosaki.motohiro@jp.fujitsu.com: fix style issue of get_scan_ratio()]
      Signed-off-by: NRik van Riel <riel@redhat.com>
      Signed-off-by: NLee Schermerhorn <Lee.Schermerhorn@hp.com>
      Signed-off-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: NHugh Dickins <hugh@veritas.com>
      Signed-off-by: NDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4f98a2fe
  13. 25 9月, 2008 1 次提交
  14. 23 9月, 2008 1 次提交
    • J
      cifs: have find_writeable_file prefer filehandles opened by same task · 2846d386
      Jeff Layton 提交于
      When the CIFS client goes to write out pages, it needs to pick a
      filehandle to write to. find_writeable_file however just picks the
      first filehandle that it finds. This can cause problems when a lock
      is issued against a particular filehandle and we pick a different
      filehandle to write to.
      
      This patch tries to avert this situation by having find_writable_file
      prefer filehandles that have a pid that matches the current task.
      This seems to fix lock test 11 from the connectathon test suite when
      run against a windows server.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      2846d386
  15. 28 8月, 2008 1 次提交
    • J
      cifs: fix O_APPEND on directio mounts · 838726c4
      Jeff Layton 提交于
      The direct I/O write codepath for CIFS is done through
      cifs_user_write(). That function does not currently call
      generic_write_checks() so the file position isn't being properly set
      when the file is opened with O_APPEND.  It's also not doing the other
      "normal" checks that should be done for a write call.
      
      The problem is currently that when you open a file with O_APPEND on a
      mount with the directio mount option, the file position is set to the
      beginning of the file. This makes any subsequent writes clobber the data
      in the file starting at the beginning.
      
      This seems to fix the problem in cursory testing. It is, however
      important to note that NFS disallows the combination of
      (O_DIRECT|O_APPEND). If my understanding is correct, the concern is
      races with multiple clients appending to a file clobbering each others'
      data. Since the write model for CIFS and NFS is pretty similar in this
      regard, CIFS is probably subject to the same sort of races. What's
      unclear to me is why this is a particular problem with O_DIRECT and not
      with buffered writes...
      
      Regardless, disallowing O_APPEND on an entire mount is probably not
      reasonable, so we'll probably just have to deal with it and reevaluate
      this flag combination when we get proper support for O_DIRECT. In the
      meantime this patch at least fixes the existing problem.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Cc: Stable Tree <stable@kernel.org>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      838726c4
  16. 06 8月, 2008 1 次提交
  17. 05 8月, 2008 1 次提交
  18. 24 5月, 2008 1 次提交
  19. 15 5月, 2008 1 次提交
  20. 29 4月, 2008 1 次提交
  21. 15 3月, 2008 1 次提交
    • S
      [CIFS] file create with acl support enabled is slow · 8b1327f6
      Steve French 提交于
      Shirish Pargaonkar noted:
      With cifsacl mount option, when a file is created on the Windows server,
      exclusive oplock is broken right away because the get cifs acl code
      again opens the file to obtain security descriptor.
      The client does not have the newly created file handle or inode in any
      of its lists yet so it does not respond to oplock break and server waits for
      its duration and then responds to the second open. This slows down file
      creation signficantly.  The fix is to pass the file descriptor to the get
      cifsacl code wherever available so that get cifs acl code does not send
      second open (NT Create ANDX) and oplock is not broken.
      
      CC: Shirish Pargaonkar <shirishp@us.ibm.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      8b1327f6
  22. 13 2月, 2008 1 次提交
  23. 08 2月, 2008 1 次提交
  24. 31 12月, 2007 1 次提交
  25. 21 11月, 2007 1 次提交
    • J
      [CIFS] Fix potential data corruption when writing out cached dirty pages · cea21805
      Jeff Layton 提交于
      Fix RedHat bug 329431
      
      The idea here is separate "conscious" from "unconscious" flushes.
      Conscious flushes are those due to a fsync() or close(). Unconscious
      ones are flushes that occur as a side effect of some other operation or
      due to memory pressure.
      
      Currently, when an error occurs during an unconscious flush (ENOSPC or
      EIO), we toss out the page and don't preserve that error to report to
      the user when a conscious flush occurs. If after the unconscious flush,
      there are no more dirty pages for the inode, the conscious flush will
      simply return success even though there were previous errors when writing
      out pages. This can lead to data corruption.
      
      The easiest way to reproduce this is to mount up a CIFS share that's
      very close to being full or where the user is very close to quota. mv
      a file to the share that's slightly larger than the quota allows. The
      writes will all succeed (since they go to pagecache). The mv will do a
      setattr to set the new file's attributes. This calls
      filemap_write_and_wait,
      which will return an error since all of the pages can't be written out.
      Then later, when the flush and release ops occur, there are no more
      dirty pages in pagecache for the file and those operations return 0. mv
      then assumes that the file was written out correctly and deletes the
      original.
      
      CIFS already has a write_behind_rc variable where it stores the results
      from earlier flushes, but that value is only reported in cifs_close.
      Since the VFS ignores the return value from the release operation, this
      isn't helpful. We should be reporting this error during the flush
      operation.
      
      This patch does the following:
      
      1) changes cifs_fsync to use filemap_write_and_wait and cifs_flush and also
      sync to check its return code. If it returns successful, they then check
      the value of write_behind_rc to see if an earlier flush had reported any
      errors. If so, they return that error and clear write_behind_rc.
      
      2) sets write_behind_rc in a few other places where pages are written
      out as a side effect of other operations and the code waits on them.
      
      3) changes cifs_setattr to only call filemap_write_and_wait for
      ATTR_SIZE changes.
      
      4) makes cifs_writepages accurately distinguish between EIO and ENOSPC
      errors when writing out pages.
      
      Some simple testing indicates that the patch works as expected and that
      it fixes the reproduceable known problem.
      Acked-by: NDave Kleikamp <shaggy@austin.rr.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      cea21805
  26. 17 11月, 2007 1 次提交
  27. 14 11月, 2007 1 次提交
    • S
      [CIFS] Fix buffer overflow if server sends corrupt response to small · 133672ef
      Steve French 提交于
      request
      
      In SendReceive() function in transport.c - it memcpy's
      message payload into a buffer passed via out_buf param. The function
      assumes that all buffers are of size (CIFSMaxBufSize +
      MAX_CIFS_HDR_SIZE) , unfortunately it is also called with smaller
      (MAX_CIFS_SMALL_BUFFER_SIZE) buffers.  There are eight callers
      (SMB worker functions) which are primarily affected by this change:
      
      TreeDisconnect, uLogoff, Close, findClose, SetFileSize, SetFileTimes,
      Lock and PosixLock
      
      CC: Dave Kleikamp <shaggy@austin.ibm.com>
      CC: Przemyslaw Wegrzyn <czajnik@czajsoft.pl>
      Acked-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      133672ef
  28. 26 10月, 2007 1 次提交
  29. 13 10月, 2007 1 次提交
  30. 02 10月, 2007 1 次提交
    • S
      [CIFS] Reduce chance of list corruption in find_writable_file · 9b22b0b7
      Steve French 提交于
      When find_writable_file is racing with close and the session
      to the server goes down, Shaggy noticed that there was a
      chance that an open file in the list of files off the inode
      could have been freed by close since cifs_reconnect can
      block (the spinlock thus not held). This means that
      we have to start over at the beginning of the list in some
      cases.
      
      There is a 2nd change that needs to be made later
      (pointed out by Jeremy Allison and Shaggy) in order to
      prevent cifs_close ever freeing the cifs per file info
      when a write is pending.  Although we delay close from
      freeing this memory for sufficiently long for all known
      cases, ultimately on a very, very slow write
      overlapping a close pending we need to allow close to return
      (without freeing the cifs file info) and defer freeing the
      memory to be the responsibility of the (sloooow) write
      thread (presumably have to look at every place wrtPending
      is decremented - and add a flag for deferred free for
      after wrtPending goes to zero).
      Acked-by: NShaggy <shaggy@us.ibm.com>
      Acked-by: NShirish Pargaonkar <shirishp@us.ibm.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      9b22b0b7
  31. 11 9月, 2007 1 次提交
  32. 08 9月, 2007 1 次提交