1. 01 Dec, 2021 1 commit
    • Rick Macklem's avatar
      nfsd: Sanity check the ACL attribute · fd020f19
      Rick Macklem authored
      When an ACL is presented to the NFSv4 server in
      Setattr or Verify, parsing of the ACL assumed a
      sane acecnt and sane sizes for the "who" strings.
      This patch adds sanity checks for these.
      The patch also fixes handling of an error
      return from nfsrv_dissectacl() for one broken
      Reported by:	rtm@lcs.mit.edu
      Tested by:	rtm@lcs.mit.edu
      PR:	260111
      MFC after:	2 weeks
  2. 12 May, 2020 1 commit
  3. 08 May, 2020 1 commit
  4. 12 Mar, 2019 4 commits
  5. 12 Jun, 2018 1 commit
    • Rick Macklem's avatar
      Merge the pNFS server code from projects/pnfs-planb-server into head. · 90d2dfab
      Rick Macklem authored
      This code merge adds a pNFS service to the NFSv4.1 server. Although it is
      a large commit it should not affect behaviour for a non-pNFS NFS server.
      Some documentation on how this works can be found at:
      and will hopefully be turned into a proper document soon.
      This is a merge of the kernel code. Userland and man page changes will
      come soon, once the dust settles on this merge.
      It has passed a "make universe", so I hope it will not cause build problems.
      It also adds NFSv4.1 server support for the "current stateid".
      Here is a brief overview of the pNFS service:
      A pNFS service separates the Read/Write oeprations from all the other NFSv4.1
      Metadata operations. It is hoped that this separation allows a pNFS service
      to be configured that exceeds the limits of a single NFS server for either
      storage capacity and/or I/O bandwidth.
      It is possible to configure mirroring within the data servers (DSs) so that
      the data storage file for an MDS file will be mirrored on two or more of
      the DSs.
      When this is used, failure of a DS will not stop the pNFS service and a
      failed DS can be recovered once repaired while the pNFS service continues
      to operate.  Although two way mirroring would be the norm, it is possible
      to set a mirroring level of up to four or the number of DSs, whichever is
      The Metadata server will always be a single point of failure,
      just as a single NFS server is.
      A Plan B pNFS service consists of a single MetaData Server (MDS) and K
      Data Servers (DS), all of which are recent FreeBSD systems.
      Clients will mount the MDS as they would a single NFS server.
      When files are created, the MDS creates a file tree identical to what a
      single NFS server creates, except that all the regular (VREG) files will
      be empty. As such, if you look at the exported tree on the MDS directly
      on the MDS server (not via an NFS mount), the files will all be of size 0.
      Each of these files will also have two extended attributes in the system
      attribute name space:
      pnfsd.dsfile - This extended attrbute stores the information that
          the MDS needs to find the data storage file(s) on DS(s) for this file.
      pnfsd.dsattr - This extended attribute stores the Size, AccessTime, ModifyTime
          and Change attributes for the file, so that the MDS doesn't need to
          acquire the attributes from the DS for every Getattr operation.
      For each regular (VREG) file, the MDS creates a data storage file on one
      (or more if mirroring is enabled) of the DSs in one of the "dsNN"
      subdirectories.  The name of this file is the file handle
      of the file on the MDS in hexadecimal so that the name is unique.
      The DSs use subdirectories named "ds0" to "dsN" so that no one directory
      gets too large. The value of "N" is set via the sysctl vfs.nfsd.dsdirsize
      on the MDS, with the default being 20.
      For production servers that will store a lot of files, this value should
      probably be much larger.
      It can be increased when the "nfsd" daemon is not running on the MDS,
      once the "dsK" directories are created.
      For pNFS aware NFSv4.1 clients, the FreeBSD server will return two pieces
      of information to the client that allows it to do I/O directly to the DS.
      DeviceInfo - This is relatively static information that defines what a DS
                   is. The critical bits of information returned by the FreeBSD
                   server is the IP address of the DS and, for the Flexible
                   File layout, that NFSv4.1 is to be used and that it is
                   "tightly coupled".
                   There is a "deviceid" which identifies the DeviceInfo.
      Layout     - This is per file and can be recalled by the server when it
                   is no longer valid. For the FreeBSD server, there is support
                   for two types of layout, call File and Flexible File layout.
                   Both allow the client to do I/O on the DS via NFSv4.1 I/O
                   operations. The Flexible File layout is a more recent variant
                   that allows specification of mirrors, where the client is
                   expected to do writes to all mirrors to maintain them in a
                   consistent state. The Flexible File layout also allows the
                   client to report I/O errors for a DS back to the MDS.
                   The Flexible File layout supports two variants referred to as
                   "tightly coupled" vs "loosely coupled". The FreeBSD server always
                   uses the "tightly coupled" variant where the client uses the
                   same credentials to do I/O on the DS as it would on the MDS.
                   For the "loosely coupled" variant, the layout specifies a
                   synthetic user/group that the client uses to do I/O on the DS.
                   The FreeBSD server does not do striping and always returns
                   layouts for the entire file. The critical information in a layout
                   is Read vs Read/Writea and DeviceID(s) that identify which
                   DS(s) the data is stored on.
      At this time, the MDS generates File Layout layouts to NFSv4.1 clients
      that know how to do pNFS for the non-mirrored DS case unless the sysctl
      vfs.nfsd.default_flexfile is set non-zero, in which case Flexible File
      layouts are generated.
      The mirrored DS configuration always generates Flexible File layouts.
      For NFS clients that do not support NFSv4.1 pNFS, all I/O operations
      are done against the MDS which acts as a proxy for the appropriate DS(s).
      When the MDS receives an I/O RPC, it will do the RPC on the DS as a proxy.
      If the DS is on the same machine, the MDS/DS will do the RPC on the DS as
      a proxy and so on, until the machine runs out of some resource, such as
      session slots or mbufs.
      As such, DSs must be separate systems from the MDS.
      Tested by:	james.rose@framestore.com
      Relnotes:	yes
  6. 27 Nov, 2017 1 commit
    • Pedro F. Giffuni's avatar
      sys/fs: further adoption of SPDX licensing ID tags. · d63027b6
      Pedro F. Giffuni authored
      Mainly focus on files that use BSD 2-Clause license, however the tool I
      was using misidentified many licenses so this was mostly a manual - error
      prone - task.
      The Software Package Data Exchange (SPDX) group provides a specification
      to make it easier for automated tools to detect and summarize well known
      opensource licenses. We are gradually adopting the specification, noting
      that the tags are considered only advisory and do not, in any way,
      superceed or replace the license texts.
  7. 10 Apr, 2016 1 commit
  8. 28 Aug, 2015 1 commit
  9. 20 Sep, 2012 1 commit
    • Rick Macklem's avatar
      Modify the NFSv4 client so that it can handle owner · c52005a3
      Rick Macklem authored
      and owner_group strings that consist entirely of
      digits, interpreting them as the uid/gid number.
      This change was needed since new (>= 3.3) Linux
      servers reply with these strings by default.
      This change is mandated by the rfc3530bis draft.
      Reported on freebsd-stable@ under the Subject
      heading "Problem with Linux >= 3.3 as NFSv4 server"
      by Norbert Aschendorff on Aug. 20, 2012.
      Tested by:	norbert.aschendorff at yahoo.de
      Reviewed by:	jhb
      MFC after:	2 weeks
  10. 17 May, 2012 1 commit
    • Rick Macklem's avatar
      A problem with the NFSv4 server was reported by Andrew Leonard · f4b9a05a
      Rick Macklem authored
      to freebsd-fs@, where the setfacl of an NFSv4 acl would fail.
      This was caused by the VOP_ACLCHECK() call for ZFS replying
      EOPNOTSUPP. After discussion with rwatson@, it was determined
      that a call to VOP_ACLCHECK() before doing VOP_SETACL() is not
      required. This patch fixes the problem by deleting the
      VOP_ACLCHECK() call.
      Tested by:	Andrew Leonard (previous version)
      MFC after:	1 week
  11. 16 Jul, 2011 1 commit
    • Zack Kirsch's avatar
      Add DEXITCODE plumbing to NFS. · a9285ae5
      Zack Kirsch authored
      Isilon has the concept of an in-memory exit-code ring that saves the last exit
      code of a function and allows for stack tracing. This is very helpful when
      debugging tough issues.
      This patch is essentially a no-op for BSD at this point, until we upstream
      the dexitcode logic itself. The patch adds DEXITCODE calls to every NFS
      function that returns an errno error code. A number of code paths were also
      reorganized to have single exit paths, to reduce code duplication.
      Submitted by:   David Kwan <dkwan@isilon.com>
      Reviewed by:    rmacklem
      Approved by:    zml (mentor)
      MFC after:      2 weeks
  12. 14 Apr, 2011 1 commit
  13. 19 Oct, 2010 1 commit
  14. 27 Mar, 2010 1 commit
  15. 08 Jan, 2010 1 commit
    • Rick Macklem's avatar
      MFC: r200999 · d3db09cb
      Rick Macklem authored
      Modify the experimental server so that it uses VOP_ACCESSX().
      This is necessary in order to enable NFSv4 ACL support. The
      argument to nfsvno_accchk() was changed to an accmode_t and
      the function nfsrv_aclaccess() was no longer needed and,
      therefore, deleted.
      Reviewed by:	trasz
  16. 25 Dec, 2009 1 commit
  17. 03 Dec, 2009 1 commit
  18. 30 Sep, 2009 1 commit
  19. 05 Jun, 2009 1 commit
  20. 26 May, 2009 2 commits
  21. 04 May, 2009 1 commit
    • Rick Macklem's avatar
      Add the experimental nfs subtree to the kernel, that includes · 9ec7b004
      Rick Macklem authored
      	support for NFSv4 as well as NFSv2 and 3.
      	It lives in 3 subdirs under sys/fs:
      	nfs - functions that are common to the client and server
      	nfsclient - a mutation of sys/nfsclient that call generic functions
      	to do RPCs and handle state. As such, it retains the
      	buffer cache handling characteristics and vnode semantics that
      	are found in sys/nfsclient, for the most part.
      	nfsserver - the server. It includes a DRC designed specifically for
      	NFSv4, that is used instead of the generic DRC in sys/rpc.
      	The build glue will be checked in later, so at this point, it
      	consists of 3 new subdirs that should not affect kernel building.
      Approved by:	kib (mentor)