1. 23 9月, 2017 1 次提交
  2. 21 9月, 2017 5 次提交
  3. 20 9月, 2017 4 次提交
  4. 18 9月, 2017 3 次提交
  5. 13 9月, 2017 1 次提交
  6. 07 9月, 2017 1 次提交
  7. 05 9月, 2017 3 次提交
    • S
      cifs: Check for timeout on Negotiate stage · 76e75270
      Samuel Cabrero 提交于
      Some servers seem to accept connections while booting but never send
      the SMBNegotiate response neither close the connection, causing all
      processes accessing the share hang on uninterruptible sleep state.
      
      This happens when the cifs_demultiplex_thread detects the server is
      unresponsive so releases the socket and start trying to reconnect.
      At some point, the faulty server will accept the socket and the TCP
      status will be set to NeedNegotiate. The first issued command accessing
      the share will start the negotiation (pid 5828 below), but the response
      will never arrive so other commands will be blocked waiting on the mutex
      (pid 55352).
      
      This patch checks for unresponsive servers also on the negotiate stage
      releasing the socket and reconnecting if the response is not received
      and checking again the tcp state when the mutex is acquired.
      
      PID: 55352  TASK: ffff880fd6cc02c0  CPU: 0   COMMAND: "ls"
       #0 [ffff880fd9add9f0] schedule at ffffffff81467eb9
       #1 [ffff880fd9addb38] __mutex_lock_slowpath at ffffffff81468fe0
       #2 [ffff880fd9addba8] mutex_lock at ffffffff81468b1a
       #3 [ffff880fd9addbc0] cifs_reconnect_tcon at ffffffffa042f905 [cifs]
       #4 [ffff880fd9addc60] smb_init at ffffffffa042faeb [cifs]
       #5 [ffff880fd9addca0] CIFSSMBQPathInfo at ffffffffa04360b5 [cifs]
       ....
      
      Which is waiting a mutex owned by:
      
      PID: 5828   TASK: ffff880fcc55e400  CPU: 0   COMMAND: "xxxx"
       #0 [ffff880fbfdc19b8] schedule at ffffffff81467eb9
       #1 [ffff880fbfdc1b00] wait_for_response at ffffffffa044f96d [cifs]
       #2 [ffff880fbfdc1b60] SendReceive at ffffffffa04505ce [cifs]
       #3 [ffff880fbfdc1bb0] CIFSSMBNegotiate at ffffffffa0438d79 [cifs]
       #4 [ffff880fbfdc1c50] cifs_negotiate_protocol at ffffffffa043b383 [cifs]
       #5 [ffff880fbfdc1c80] cifs_reconnect_tcon at ffffffffa042f911 [cifs]
       #6 [ffff880fbfdc1d20] smb_init at ffffffffa042faeb [cifs]
       #7 [ffff880fbfdc1d60] CIFSSMBQFSInfo at ffffffffa0434eb0 [cifs]
       ....
      Signed-off-by: NSamuel Cabrero <scabrero@suse.de>
      Reviewed-by: NAurélien Aptel <aaptel@suse.de>
      Reviewed-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      76e75270
    • R
      cifs: Add support for writing attributes on SMB2+ · 5517554e
      Ronnie Sahlberg 提交于
      This adds support for writing extended attributes on SMB2+ shares.
      Attributes can be written using the setfattr command.
      
      RH-bz: 1110709
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      5517554e
    • R
      cifs: Add support for reading attributes on SMB2+ · 95907fea
      Ronnie Sahlberg 提交于
      SMB1 already has support to read attributes. This adds similar support
      to SMB2+.
      
      With this patch, tools such as 'getfattr' will now work with SMB2+ shares.
      
      RH-bz: 1110709
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      95907fea
  8. 01 9月, 2017 1 次提交
  9. 31 8月, 2017 2 次提交
  10. 24 8月, 2017 2 次提交
    • R
      cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup() · d3edede2
      Ronnie Sahlberg 提交于
      Add checking for the path component length and verify it is <= the maximum
      that the server advertizes via FileFsAttributeInformation.
      
      With this patch cifs.ko will now return ENAMETOOLONG instead of ENOENT
      when users to access an overlong path.
      
      To test this, try to cd into a (non-existing) directory on a CIFS share
      that has a too long name:
      cd /mnt/aaaaaaaaaaaaaaa...
      
      and it now should show a good error message from the shell:
      bash: cd: /mnt/aaaaaaaaaaaaaaaa...aaaaaa: File name too long
      
      rh bz 1153996
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Cc: <stable@vger.kernel.org>
      d3edede2
    • S
      cifs: Fix df output for users with quota limits · 42bec214
      Sachin Prabhu 提交于
      The df for a SMB2 share triggers a GetInfo call for
      FS_FULL_SIZE_INFORMATION. The values returned are used to populate
      struct statfs.
      
      The problem is that none of the information returned by the call
      contains the total blocks available on the filesystem. Instead we use
      the blocks available to the user ie. quota limitation when filling out
      statfs.f_blocks. The information returned does contain Actual free units
      on the filesystem and is used to populate statfs.f_bfree. For users with
      quota enabled, it can lead to situations where the total free space
      reported is more than the total blocks on the system ending up with df
      reports like the following
      
       # df -h /mnt/a
      Filesystem         Size  Used Avail Use% Mounted on
      //192.168.22.10/a  2.5G -2.3G  2.5G    - /mnt/a
      
      To fix this problem, we instead populate both statfs.f_bfree with the
      same value as statfs.f_bavail ie. CallerAvailableAllocationUnits. This
      is similar to what is done already in the code for cifs and df now
      reports the quota information for the user used to mount the share.
      
       # df --si /mnt/a
      Filesystem         Size  Used Avail Use% Mounted on
      //192.168.22.10/a  2.7G  101M  2.6G   4% /mnt/a
      Signed-off-by: NSachin Prabhu <sprabhu@redhat.com>
      Signed-off-by: NPierguido Lambri <plambri@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Cc: <stable@vger.kernel.org>
      42bec214
  11. 01 8月, 2017 1 次提交
    • J
      fs: convert a pile of fsync routines to errseq_t based reporting · 3b49c9a1
      Jeff Layton 提交于
      This patch converts most of the in-kernel filesystems that do writeback
      out of the pagecache to report errors using the errseq_t-based
      infrastructure that was recently added. This allows them to report
      errors once for each open file description.
      
      Most filesystems have a fairly straightforward fsync operation. They
      call filemap_write_and_wait_range to write back all of the data and
      wait on it, and then (sometimes) sync out the metadata.
      
      For those filesystems this is a straightforward conversion from calling
      filemap_write_and_wait_range in their fsync operation to calling
      file_write_and_wait_range.
      Acked-by: NJan Kara <jack@suse.cz>
      Acked-by: NDave Kleikamp <dave.kleikamp@oracle.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      3b49c9a1
  12. 16 7月, 2017 1 次提交
    • B
      fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks · 9d5b86ac
      Benjamin Coddington 提交于
      Since commit c69899a1 "NFSv4: Update of VFS byte range lock must be
      atomic with the stateid update", NFSv4 has been inserting locks in rpciod
      worker context.  The result is that the file_lock's fl_nspid is the
      kworker's pid instead of the original userspace pid.
      
      The fl_nspid is only used to represent the namespaced virtual pid number
      when displaying locks or returning from F_GETLK.  There's no reason to set
      it for every inserted lock, since we can usually just look it up from
      fl_pid.  So, instead of looking up and holding struct pid for every lock,
      let's just look up the virtual pid number from fl_pid when it is needed.
      That means we can remove fl_nspid entirely.
      
      The translaton and presentation of fl_pid should handle the following four
      cases:
      
      1 - F_GETLK on a remote file with a remote lock:
          In this case, the filesystem should determine the l_pid to return here.
          Filesystems should indicate that the fl_pid represents a non-local pid
          value that should not be translated by returning an fl_pid <= 0.
      
      2 - F_GETLK on a local file with a remote lock:
          This should be the l_pid of the lock manager process, and translated.
      
      3 - F_GETLK on a remote file with a local lock, and
      4 - F_GETLK on a local file with a local lock:
          These should be the translated l_pid of the local locking process.
      
      Fuse was already doing the correct thing by translating the pid into the
      caller's namespace.  With this change we must update fuse to translate
      to init's pid namespace, so that the locks API can then translate from
      init's pid namespace into the pid namespace of the caller.
      
      With this change, the locks API will expect that if a filesystem returns
      a remote pid as opposed to a local pid for F_GETLK, that remote pid will
      be <= 0.  This signifies that the pid is remote, and the locks API will
      forego translating that pid into the pid namespace of the local calling
      process.
      
      Finally, we convert remote filesystems to present remote pids using
      negative numbers. Have lustre, 9p, ceph, cifs, and dlm negate the remote
      pid returned for F_GETLK lock requests.
      
      Since local pids will never be larger than PID_MAX_LIMIT (which is
      currently defined as <= 4 million), but pid_t is an unsigned int, we
      should have plenty of room to represent remote pids with negative
      numbers if we assume that remote pid numbers are similarly limited.
      
      If this is not the case, then we run the risk of having a remote pid
      returned for which there is also a corresponding local pid.  This is a
      problem we have now, but this patch should reduce the chances of that
      occurring, while also returning those remote pid numbers, for whatever
      that may be worth.
      Signed-off-by: NBenjamin Coddington <bcodding@redhat.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      9d5b86ac
  13. 10 7月, 2017 1 次提交
  14. 09 7月, 2017 6 次提交
  15. 06 7月, 2017 8 次提交
    • R
      CIFS: fix circular locking dependency · 966681c9
      Rabin Vincent 提交于
      When a CIFS filesystem is mounted with the forcemand option and the
      following command is run on it, lockdep warns about a circular locking
      dependency between CifsInodeInfo::lock_sem and the inode lock.
      
       while echo foo > hello; do :; done & while touch -c hello; do :; done
      
      cifs_writev() takes the locks in the wrong order, but note that we can't
      only flip the order around because it releases the inode lock before the
      call to generic_write_sync() while it holds the lock_sem across that
      call.
      
      But, AFAICS, there is no need to hold the CifsInodeInfo::lock_sem across
      the generic_write_sync() call either, so we can release both the locks
      before generic_write_sync(), and change the order.
      
       ======================================================
       WARNING: possible circular locking dependency detected
       4.12.0-rc7+ #9 Not tainted
       ------------------------------------------------------
       touch/487 is trying to acquire lock:
        (&cifsi->lock_sem){++++..}, at: cifsFileInfo_put+0x88f/0x16a0
      
       but task is already holding lock:
        (&sb->s_type->i_mutex_key#11){+.+.+.}, at: utimes_common+0x3ad/0x870
      
       which lock already depends on the new lock.
      
       the existing dependency chain (in reverse order) is:
      
       -> #1 (&sb->s_type->i_mutex_key#11){+.+.+.}:
              __lock_acquire+0x1f74/0x38f0
              lock_acquire+0x1cc/0x600
              down_write+0x74/0x110
              cifs_strict_writev+0x3cb/0x8c0
              __vfs_write+0x4c1/0x930
              vfs_write+0x14c/0x2d0
              SyS_write+0xf7/0x240
              entry_SYSCALL_64_fastpath+0x1f/0xbe
      
       -> #0 (&cifsi->lock_sem){++++..}:
              check_prevs_add+0xfa0/0x1d10
              __lock_acquire+0x1f74/0x38f0
              lock_acquire+0x1cc/0x600
              down_write+0x74/0x110
              cifsFileInfo_put+0x88f/0x16a0
              cifs_setattr+0x992/0x1680
              notify_change+0x61a/0xa80
              utimes_common+0x3d4/0x870
              do_utimes+0x1c1/0x220
              SyS_utimensat+0x84/0x1a0
              entry_SYSCALL_64_fastpath+0x1f/0xbe
      
       other info that might help us debug this:
      
        Possible unsafe locking scenario:
      
              CPU0                    CPU1
              ----                    ----
         lock(&sb->s_type->i_mutex_key#11);
                                      lock(&cifsi->lock_sem);
                                      lock(&sb->s_type->i_mutex_key#11);
         lock(&cifsi->lock_sem);
      
        *** DEADLOCK ***
      
       2 locks held by touch/487:
        #0:  (sb_writers#10){.+.+.+}, at: mnt_want_write+0x41/0xb0
        #1:  (&sb->s_type->i_mutex_key#11){+.+.+.}, at: utimes_common+0x3ad/0x870
      
       stack backtrace:
       CPU: 0 PID: 487 Comm: touch Not tainted 4.12.0-rc7+ #9
       Call Trace:
        dump_stack+0xdb/0x185
        print_circular_bug+0x45b/0x790
        __lock_acquire+0x1f74/0x38f0
        lock_acquire+0x1cc/0x600
        down_write+0x74/0x110
        cifsFileInfo_put+0x88f/0x16a0
        cifs_setattr+0x992/0x1680
        notify_change+0x61a/0xa80
        utimes_common+0x3d4/0x870
        do_utimes+0x1c1/0x220
        SyS_utimensat+0x84/0x1a0
        entry_SYSCALL_64_fastpath+0x1f/0xbe
      
      Fixes: 19dfc1f5 ("cifs: fix the race in cifs_writev()")
      Signed-off-by: NRabin Vincent <rabinv@axis.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Acked-by: NPavel Shilovsky <pshilov@microsoft.com>
      966681c9
    • C
      cifs: set oparms.create_options rather than or'ing in CREATE_OPEN_BACKUP_INTENT · 709340a0
      Colin Ian King 提交于
      Currently oparms.create_options is uninitialized and the code is logically
      or'ing in CREATE_OPEN_BACKUP_INTENT onto a garbage value of
      oparms.create_options from the stack.  Fix this by just setting the value
      rather than or'ing in the setting.
      
      Detected by CoverityScan, CID#1447220 ("Unitialized scale value")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      709340a0
    • L
      cifs: Do not modify mid entry after submitting I/O in cifs_call_async · 93d2cb6c
      Long Li 提交于
      In cifs_call_async, server may respond as soon as I/O is submitted. Because
      mid entry is freed on the return path, it should not be modified after I/O
      is submitted.
      
      cifs_save_when_sent modifies the sent timestamp in mid entry, and should not
      be called after I/O. Call it before I/O.
      Signed-off-by: NLong Li <longli@microsoft.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      93d2cb6c
    • B
      CIFS: add SFM mapping for 0x01-0x1F · 7e46f090
      Björn JACKE 提交于
      Hi,
      
      attached patch adds more missing mappings for the 0x01-0x1f range. Please
      review, if you're fine with it, considere it also for stable.
      
      Björn
      
      >From a97720c26db2ee77d4e798e3d383fcb6a348bd29 Mon Sep 17 00:00:00 2001
      From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke@samba.org>
      Date: Wed, 31 May 2017 22:48:41 +0200
      Subject: [PATCH] cifs: add SFM mapping for 0x01-0x1F
      
      0x1-0x1F has to be mapped to 0xF001-0xF01F
      Signed-off-by: NBjoern Jacke <bjacke@samba.org>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      7e46f090
    • A
      cifs: hide unused functions · 84908426
      Arnd Bergmann 提交于
      Some functions are only referenced under an #ifdef, causing a harmless
      warning:
      
      fs/cifs/smb2ops.c:1374:1: error: 'get_smb2_acl' defined but not used [-Werror=unused-function]
      
      We could mark them __maybe_unused or add another #ifdef, I picked
      the second approach here.
      
      Fixes: b3fdda4d1e1b ("cifs: Use smb 2 - 3 and cifsacl mount options getacl functions")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      84908426
    • S
      cifs: Use smb 2 - 3 and cifsacl mount options getacl functions · 2f1afe25
      Shirish Pargaonkar 提交于
      Fill in smb2/3 query acl functions in ops structures and use them.
      Signed-off-by: NShirish Pargaonkar <shirishpargaonkar@gmail.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      2f1afe25
    • S
      cifs: prototype declaration and definition for smb 2 - 3 and cifsacl mount options · 42c493c1
      Shirish Pargaonkar 提交于
      Add definition and declaration of function to get cifs acls when
      mounting with smb version 2 onwards to 3.
      
      Extend/Alter query info function to allocate and return
      security descriptors within the response.
      
      Not yet handling the error case when the size of security descriptors
      in response to query exceeds SMB2_MAX_BUFFER_SIZE.
      Signed-off-by: NShirish Pargaonkar <shirishpargaonkar@gmail.com>
      Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      42c493c1
    • A
      CIFS: add CONFIG_CIFS_DEBUG_KEYS to dump encryption keys · d38de3c6
      Aurélien Aptel 提交于
      Add new config option that dumps AES keys to the console when they are
      generated. This is obviously for debugging purposes only, and should not
      be enabled otherwise.
      Signed-off-by: NAurelien Aptel <aaptel@suse.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      d38de3c6