1. 20 1月, 2015 1 次提交
    • S
      Complete oplock break jobs before closing file handle · ca7df8e0
      Sachin Prabhu 提交于
      Commit
      c11f1df5
      requires writers to wait for any pending oplock break handler to
      complete before proceeding to write. This is done by waiting on bit
      CIFS_INODE_PENDING_OPLOCK_BREAK in cifsFileInfo->flags. This bit is
      cleared by the oplock break handler job queued on the workqueue once it
      has completed handling the oplock break allowing writers to proceed with
      writing to the file.
      
      While testing, it was noticed that the filehandle could be closed while
      there is a pending oplock break which results in the oplock break
      handler on the cifsiod workqueue being cancelled before it has had a
      chance to execute and clear the CIFS_INODE_PENDING_OPLOCK_BREAK bit.
      Any subsequent attempt to write to this file hangs waiting for the
      CIFS_INODE_PENDING_OPLOCK_BREAK bit to be cleared.
      
      We fix this by ensuring that we also clear the bit
      CIFS_INODE_PENDING_OPLOCK_BREAK when we remove the oplock break handler
      from the workqueue.
      
      The bug was found by Red Hat QA while testing using ltp's fsstress
      command.
      Signed-off-by: NSachin Prabhu <sprabhu@redhat.com>
      Acked-by: NShirish Pargaonkar <shirishpargaonkar@gmail.com>
      Signed-off-by: NJeff Layton <jlayton@samba.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NSteve French <steve.french@primarydata.com>
      ca7df8e0
  2. 11 12月, 2014 1 次提交
  3. 20 11月, 2014 1 次提交
  4. 17 10月, 2014 1 次提交
    • S
      Allow mknod and mkfifo on SMB2/SMB3 mounts · db8b631d
      Steve French 提交于
      The "sfu" mount option did not work on SMB2/SMB3 mounts.
      With these changes when the "sfu" mount option is passed in
      on an smb2/smb2.1/smb3 mount the client can emulate (and
      recognize) fifo and device (character and device files).
      
      In addition the "sfu" mount option should not conflict
      with "mfsymlinks" (symlink emulation) as we will never
      create "sfu" style symlinks, but using "sfu" mount option
      will allow us to recognize existing symlinks, created with
      Microsoft "Services for Unix" (SFU and SUA).
      
      To enable the "sfu" mount option for SMB2/SMB3 the calling
      syntax of the generic cifs/smb2/smb3 sync_read and sync_write
      protocol dependent function needed to be changed (we
      don't have a file struct in all cases), but this actually
      ended up simplifying the code a little.
      Signed-off-by: NSteve French <smfrench@gmail.com>
      db8b631d
  5. 09 10月, 2014 1 次提交
  6. 03 10月, 2014 1 次提交
  7. 22 8月, 2014 1 次提交
  8. 17 8月, 2014 1 次提交
    • P
      CIFS: Fix SMB2 readdir error handling · 52755808
      Pavel Shilovsky 提交于
      SMB2 servers indicates the end of a directory search with
      STATUS_NO_MORE_FILE error code that is not processed now.
      This causes generic/257 xfstest to fail. Fix this by triggering
      the end of search by this error code in SMB2_query_directory.
      
      Also when negotiating CIFS protocol we tell the server to close
      the search automatically at the end and there is no need to do
      it itself. In the case of SMB2 protocol, we need to close it
      explicitly - separate close directory checks for different
      protocols.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NPavel Shilovsky <pshilovsky@samba.org>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      52755808
  9. 02 8月, 2014 22 次提交
  10. 16 7月, 2014 1 次提交
    • N
      sched: Remove proliferation of wait_on_bit() action functions · 74316201
      NeilBrown 提交于
      The current "wait_on_bit" interface requires an 'action'
      function to be provided which does the actual waiting.
      There are over 20 such functions, many of them identical.
      Most cases can be satisfied by one of just two functions, one
      which uses io_schedule() and one which just uses schedule().
      
      So:
       Rename wait_on_bit and        wait_on_bit_lock to
              wait_on_bit_action and wait_on_bit_lock_action
       to make it explicit that they need an action function.
      
       Introduce new wait_on_bit{,_lock} and wait_on_bit{,_lock}_io
       which are *not* given an action function but implicitly use
       a standard one.
       The decision to error-out if a signal is pending is now made
       based on the 'mode' argument rather than being encoded in the action
       function.
      
       All instances of the old wait_on_bit and wait_on_bit_lock which
       can use the new version have been changed accordingly and their
       action functions have been discarded.
       wait_on_bit{_lock} does not return any specific error code in the
       event of a signal so the caller must check for non-zero and
       interpolate their own error code as appropriate.
      
      The wait_on_bit() call in __fscache_wait_on_invalidate() was
      ambiguous as it specified TASK_UNINTERRUPTIBLE but used
      fscache_wait_bit_interruptible as an action function.
      David Howells confirms this should be uniformly
      "uninterruptible"
      
      The main remaining user of wait_on_bit{,_lock}_action is NFS
      which needs to use a freezer-aware schedule() call.
      
      A comment in fs/gfs2/glock.c notes that having multiple 'action'
      functions is useful as they display differently in the 'wchan'
      field of 'ps'. (and /proc/$PID/wchan).
      As the new bit_wait{,_io} functions are tagged "__sched", they
      will not show up at all, but something higher in the stack.  So
      the distinction will still be visible, only with different
      function names (gds2_glock_wait versus gfs2_glock_dq_wait in the
      gfs2/glock.c case).
      
      Since first version of this patch (against 3.15) two new action
      functions appeared, on in NFS and one in CIFS.  CIFS also now
      uses an action function that makes the same freezer aware
      schedule call as NFS.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Acked-by: David Howells <dhowells@redhat.com> (fscache, keys)
      Acked-by: Steven Whitehouse <swhiteho@redhat.com> (gfs2)
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Steve French <sfrench@samba.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20140707051603.28027.72349.stgit@notabene.brownSigned-off-by: NIngo Molnar <mingo@kernel.org>
      74316201
  11. 22 5月, 2014 2 次提交
    • J
      cifs: fix potential races in cifs_revalidate_mapping · 4f73c7d3
      Jeff Layton 提交于
      The handling of the CIFS_INO_INVALID_MAPPING flag is racy. It's possible
      for two tasks to attempt to revalidate the mapping at the same time. The
      first sees that CIFS_INO_INVALID_MAPPING is set. It clears the flag and
      then calls invalidate_inode_pages2 to start shooting down the pagecache.
      
      While that's going on, another task checks the flag and sees that it's
      clear. It then ends up trusting the pagecache to satisfy a read when it
      shouldn't.
      
      Fix this by adding a bitlock to ensure that the clearing of the flag is
      atomic with respect to the actual cache invalidation. Also, move the
      other existing users of cifs_invalidate_mapping to use a new
      cifs_zap_mapping() function that just sets the INVALID_MAPPING bit and
      then uses the standard codepath to handle the invalidation.
      Signed-off-by: NJeff Layton <jlayton@poochiereds.net>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      4f73c7d3
    • J
      cifs: convert booleans in cifsInodeInfo to a flags field · aff8d5ca
      Jeff Layton 提交于
      In later patches, we'll need to have a bitlock, so go ahead and convert
      these bools to use atomic bitops instead.
      
      Also, clean up the initialization of the flags field. There's no need
      to unset each bit individually just after it was zeroed on allocation.
      Signed-off-by: NJeff Layton <jlayton@poochiereds.net>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      aff8d5ca
  12. 07 5月, 2014 5 次提交
  13. 17 4月, 2014 2 次提交
    • M
      cif: fix dead code · 1f80c0cc
      Michael Opdenacker 提交于
      This issue was found by Coverity (CID 1202536)
      
      This proposes a fix for a statement that creates dead code.
      The "rc < 0" statement is within code that is run
      with "rc > 0".
      
      It seems like "err < 0" was meant to be used here.
      This way, the error code is returned by the function.
      Signed-off-by: NMichael Opdenacker <michael.opdenacker@free-electrons.com>
      Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      1f80c0cc
    • J
      cifs: fix error handling cifs_user_readv · bae9f746
      Jeff Layton 提交于
      Coverity says:
      
      *** CID 1202537:  Dereference after null check  (FORWARD_NULL)
      /fs/cifs/file.c: 2873 in cifs_user_readv()
      2867     		cur_len = min_t(const size_t, len - total_read, cifs_sb->rsize);
      2868     		npages = DIV_ROUND_UP(cur_len, PAGE_SIZE);
      2869
      2870     		/* allocate a readdata struct */
      2871     		rdata = cifs_readdata_alloc(npages,
      2872     					    cifs_uncached_readv_complete);
      >>>     CID 1202537:  Dereference after null check  (FORWARD_NULL)
      >>>     Comparing "rdata" to null implies that "rdata" might be null.
      2873     		if (!rdata) {
      2874     			rc = -ENOMEM;
      2875     			goto error;
      2876     		}
      2877
      2878     		rc = cifs_read_allocate_pages(rdata, npages);
      
      ...when we "goto error", rc will be non-zero, and then we end up trying
      to do a kref_put on the rdata (which is NULL). Fix this by replacing
      the "goto error" with a "break".
      
      Reported-by: <scan-admin@coverity.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      bae9f746