1. 31 5月, 2014 7 次提交
    • J
      nfsd4: remove redundant encode buffer size checking · ea8d7720
      J. Bruce Fields 提交于
      Now that all op encoders can handle running out of space, we no longer
      need to check the remaining size for every operation; only nonidempotent
      operations need that check, and that can be done by
      nfsd4_check_resp_size.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      ea8d7720
    • J
      nfsd4: nfsd4_check_resp_size needn't recalculate length · 67492c99
      J. Bruce Fields 提交于
      We're keeping the length updated as we go now, so there's no need for
      the extra calculation here.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      67492c99
    • J
      nfsd4: reserve space before inlining 0-copy pages · 4e21ac4b
      J. Bruce Fields 提交于
      Once we've included page-cache pages in the encoding it's difficult to
      remove them and restart encoding.  (xdr_truncate_encode doesn't handle
      that case.)  So, make sure we'll have adequate space to finish the
      operation first.
      
      For now COMPOUND_SLACK_SPACE checks should prevent this case happening,
      but we want to remove those checks.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      4e21ac4b
    • J
      nfsd4: teach encoders to handle reserve_space failures · d0a381dd
      J. Bruce Fields 提交于
      We've tried to prevent running out of space with COMPOUND_SLACK_SPACE
      and special checking in those operations (getattr) whose result can vary
      enormously.
      
      However:
      	- COMPOUND_SLACK_SPACE may be difficult to maintain as we add
      	  more protocol.
      	- BUG_ON or page faulting on failure seems overly fragile.
      	- Especially in the 4.1 case, we prefer not to fail compounds
      	  just because the returned result came *close* to session
      	  limits.  (Though perfect enforcement here may be difficult.)
      	- I'd prefer encoding to be uniform for all encoders instead of
      	  having special exceptions for encoders containing, for
      	  example, attributes.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      d0a381dd
    • J
      nfsd4: "backfill" using write_bytes_to_xdr_buf · 082d4bd7
      J. Bruce Fields 提交于
      Normally xdr encoding proceeds in a single pass from start of a buffer
      to end, but sometimes we have to write a few bytes to an earlier
      position.
      
      Use write_bytes_to_xdr_buf for these cases rather than saving a pointer
      to write to.  We plan to rewrite xdr_reserve_space to handle encoding
      across page boundaries using a scratch buffer, and don't want to risk
      writing to a pointer that was contained in a scratch buffer.
      
      Also it will no longer be safe to calculate lengths by subtracting two
      pointers, so use xdr_buf offsets instead.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      082d4bd7
    • J
      nfsd4: use xdr_truncate_encode · 1fcea5b2
      J. Bruce Fields 提交于
      Now that lengths are reliable, we can use xdr_truncate instead of
      open-coding it everywhere.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      1fcea5b2
    • J
      rpc: xdr_truncate_encode · 3e19ce76
      J. Bruce Fields 提交于
      This will be used in the server side in a few cases:
      	- when certain operations (read, readdir, readlink) fail after
      	  encoding a partial response.
      	- when we run out of space after encoding a partial response.
      	- in readlink, where we initially reserve PAGE_SIZE bytes for
      	  data, then truncate to the actual size.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      3e19ce76
  2. 29 5月, 2014 5 次提交
  3. 27 5月, 2014 2 次提交
  4. 23 5月, 2014 16 次提交
  5. 22 5月, 2014 2 次提交
    • J
      nfsd4: fix delegation cleanup on error · cbf7a75b
      J. Bruce Fields 提交于
      We're not cleaning up everything we need to on error.  In particular,
      we're not removing our lease.  Among other problems this can cause the
      struct nfs4_file used as fl_owner to be referenced after it has been
      destroyed.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      cbf7a75b
    • K
      NFSD: Don't clear SUID/SGID after root writing data · 368fe39b
      Kinglong Mee 提交于
      We're clearing the SUID/SGID bits on write by hand in nfsd_vfs_write,
      even though the subsequent vfs_writev() call will end up doing this for
      us (through file system write methods eventually calling
      file_remove_suid(), e.g., from __generic_file_aio_write).
      
      So, remove the redundant nfsd code.
      
      The only change in behavior is when the write is by root, in which case
      we previously cleared SUID/SGID, but will now leave it alone.  The new
      behavior is the behavior of every filesystem we've checked.
      
      It seems better to be consistent with local filesystem behavior.  And
      the security advantage seems limited as root could always restore these
      bits by hand if it wanted.
      
      SUID/SGID is not cleared after writing data with (root, local ext4),
         File: ‘test’
         Size: 0               Blocks: 0          IO Block: 4096   regular
      empty file
      Device: 803h/2051d      Inode: 1200137     Links: 1
      Access: (4777/-rwsrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
      Context: unconfined_u:object_r:admin_home_t:s0
      Access: 2014-04-18 21:36:31.016029014 +0800
      Modify: 2014-04-18 21:36:31.016029014 +0800
      Change: 2014-04-18 21:36:31.026030285 +0800
        Birth: -
         File: ‘test’
         Size: 5               Blocks: 8          IO Block: 4096   regular file
      Device: 803h/2051d      Inode: 1200137     Links: 1
      Access: (4777/-rwsrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
      Context: unconfined_u:object_r:admin_home_t:s0
      Access: 2014-04-18 21:36:31.016029014 +0800
      Modify: 2014-04-18 21:36:31.040032065 +0800
      Change: 2014-04-18 21:36:31.040032065 +0800
        Birth: -
      
      With no_root_squash, (root, remote ext4), SUID/SGID are cleared,
         File: ‘test’
         Size: 0               Blocks: 0          IO Block: 262144 regular
      empty file
      Device: 24h/36d Inode: 786439      Links: 1
      Access: (4777/-rwsrwxrwx)  Uid: ( 1000/    test)   Gid: ( 1000/    test)
      Context: system_u:object_r:nfs_t:s0
      Access: 2014-04-18 21:45:32.155805097 +0800
      Modify: 2014-04-18 21:45:32.155805097 +0800
      Change: 2014-04-18 21:45:32.168806749 +0800
        Birth: -
         File: ‘test’
         Size: 5               Blocks: 8          IO Block: 262144 regular file
      Device: 24h/36d Inode: 786439      Links: 1
      Access: (0777/-rwxrwxrwx)  Uid: ( 1000/    test)   Gid: ( 1000/    test)
      Context: system_u:object_r:nfs_t:s0
      Access: 2014-04-18 21:45:32.155805097 +0800
      Modify: 2014-04-18 21:45:32.184808783 +0800
      Change: 2014-04-18 21:45:32.184808783 +0800
        Birth: -
      Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      368fe39b
  6. 21 5月, 2014 2 次提交
  7. 16 5月, 2014 1 次提交
  8. 09 5月, 2014 5 次提交