1. 13 12月, 2012 4 次提交
    • A
      SUNRPC handle EKEYEXPIRED in call_refreshresult · eb96d5c9
      Andy Adamson 提交于
      Currently, when an RPCSEC_GSS context has expired or is non-existent
      and the users (Kerberos) credentials have also expired or are non-existent,
      the client receives the -EKEYEXPIRED error and tries to refresh the context
      forever.  If an application is performing I/O, or other work against the share,
      the application hangs, and the user is not prompted to refresh/establish their
      credentials. This can result in a denial of service for other users.
      
      Users are expected to manage their Kerberos credential lifetimes to mitigate
      this issue.
      
      Move the -EKEYEXPIRED handling into the RPC layer. Try tk_cred_retry number
      of times to refresh the gss_context, and then return -EACCES to the application.
      Signed-off-by: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      eb96d5c9
    • A
      SUNRPC set gss gc_expiry to full lifetime · 620038f6
      Andy Adamson 提交于
      Only use the default GSSD_MIN_TIMEOUT if the gss downcall timeout is zero.
      Store the full lifetime in gc_expiry (not 3/4 of the lifetime) as subsequent
      patches will use the gc_expiry to determine buffered WRITE behavior in the
      face of expired or soon to be expired gss credentials.
      Signed-off-by: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      620038f6
    • J
      nfs: fix page dirtying in NFS DIO read codepath · be7e9858
      Jeff Layton 提交于
      The NFS DIO code will dirty pages that catch read responses in order to
      handle the case where someone is doing DIO reads into an mmapped buffer.
      The existing code doesn't really do the right thing though since it
      doesn't take into account the case where we might be attempting to read
      past the EOF.
      
      Fix the logic in that code to only dirty pages that ended up receiving
      data from the read. Note too that it really doesn't matter if
      NFS_IOHDR_ERROR is set or not. All that matters is if the page was
      altered by the read.
      
      Cc: Fred Isaman <iisaman@netapp.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      be7e9858
    • J
      nfs: don't zero out the rest of the page if we hit the EOF on a DIO READ · 67fad106
      Jeff Layton 提交于
      Eryu provided a test program that would segfault when attempting to read
      past the EOF on file that was opened O_DIRECT. The buffer given to the
      read() call was on the stack, and when he attempted to read past it it
      would scribble over the rest of the stack page.
      
      If we hit the end of the file on a DIO READ request, then we don't want
      to zero out the rest of the buffer. These aren't pagecache pages after
      all, and there's no guarantee that the buffers that were passed in
      represent entire pages.
      
      Cc: <stable@vger.kernel.org> # v3.5+
      Cc: Fred Isaman <iisaman@netapp.com>
      Reported-by: NEryu Guan <eguan@redhat.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      67fad106
  2. 12 12月, 2012 1 次提交
  3. 11 12月, 2012 4 次提交
    • T
      NFSv4.1: Handle NFS4ERR_BADSLOT errors correctly · 85563073
      Trond Myklebust 提交于
      Most (all) NFS4ERR_BADSLOT errors are due to the client failing to
      respect the server's sr_highest_slotid limit. This mainly happens
      due to reordered RPC requests.
      The way to handle it is simply to drop the slot that we're using,
      and retry using the new highest_slotid limits.
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      85563073
    • T
      Merge branch 'bugfixes' into nfs-for-next · 7ce0171d
      Trond Myklebust 提交于
      7ce0171d
    • J
      nfs: don't extend writes to cover entire page if pagecache is invalid · 81d9bce5
      Jeff Layton 提交于
      Jian reported that the following sequence would leave "testfile" with
      corrupt data:
      
          # mount localhost:/export /mnt/nfs/ -o vers=3
          # echo abc > /mnt/nfs/testfile; echo def >> /export/testfile; echo ghi >> /mnt/nfs/testfile
          # cat -v /export/testfile
          abc
          ^@^@^@^@ghi
      
      While there's no locking involved here, the operations are serialized,
      so CTO should prevent corruption.
      
      The first write to the file is fine and writes 4 bytes. The file is then
      extended on the server. When it's reopened a GETATTR is issued and the
      size change is noticed. This causes NFS_INO_INVALID_DATA to be set on
      the file. Because the file is opened for write only,
      nfs_want_read_modify_write() returns 0 to nfs_write_begin().
      nfs_updatepage then calls nfs_write_pageuptodate() to see if it should
      extend the nfs_page to cover the whole page. NFS_INO_INVALID_DATA is
      still set on the file at that point, but that flag is ignored and
      nfs_pageuptodate erroneously extends the write to cover the whole page,
      with the write done on the server side filled in with zeroes.
      
      This patch just has that function check for NFS_INO_INVALID_DATA in
      addition to NFS_INO_REVAL_PAGECACHE. This fixes the bug, but looking
      over the code, I wonder if we might have a similar bug in
      nfs_revalidate_size(). The difference between those two flags is very
      subtle, so it seems like we ought to be checking for
      NFS_INO_INVALID_DATA in most of the places that we look for
      NFS_INO_REVAL_PAGECACHE.
      
      I believe this is regression introduced by commit 8d197a56. The code
      did check for NFS_INO_INVALID_DATA prior to that patch.
      
      Original bug report is here:
      
          https://bugzilla.redhat.com/show_bug.cgi?id=885743
      
      Cc: <stable@vger.kernel.org> # 3.5+
      Reported-by: NJian Li <jiali@redhat.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      81d9bce5
    • S
      NFSv4: Check for buffer length in __nfs4_get_acl_uncached · 7d3e91a8
      Sven Wegener 提交于
      Commit 1f1ea6c2 "NFSv4: Fix buffer overflow checking in
      __nfs4_get_acl_uncached" accidently dropped the checking for too small
      result buffer length.
      
      If someone uses getxattr on "system.nfs4_acl" on an NFSv4 mount
      supporting ACLs, the ACL has not been cached and the buffer suplied is
      too short, we still copy the complete ACL, resulting in kernel and user
      space memory corruption.
      Signed-off-by: NSven Wegener <sven.wegener@stealer.net>
      Cc: stable@kernel.org
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      7d3e91a8
  4. 06 12月, 2012 29 次提交
  5. 27 11月, 2012 2 次提交