1. 04 Aug, 2022 5 commits
    • NeilBrown's avatar
      NFSD: reduce locking in nfsd_lookup() · 19d008b4
      NeilBrown authored
      nfsd_lookup() takes an exclusive lock on the parent inode, but no
      callers want the lock and it may not be needed at all if the
      result is in the dcache.
      
      Change nfsd_lookup_dentry() to not take the lock, and call
      lookup_one_len_locked() which takes lock only if needed.
      
      nfsd4_open() currently expects the lock to still be held, but that isn't
      necessary as nfsd_validate_delegated_dentry() provides required
      guarantees without the lock.
      
      NOTE: NFSv4 requires directory changeinfo for OPEN even when a create
        wasn't requested and no change happened.  Now that nfsd_lookup()
        doesn't use fh_lock(), we need to explicitly fill the attributes
        when no create happens.  A new fh_fill_both_attrs() is provided
        for that task.
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      19d008b4
    • NeilBrown's avatar
      NFSD: only call fh_unlock() once in nfsd_link() · e18bcb33
      NeilBrown authored
      On non-error paths, nfsd_link() calls fh_unlock() twice.  This is safe
      because fh_unlock() records that the unlock has been done and doesn't
      repeat it.
      However it makes the code a little confusing and interferes with changes
      that are planned for directory locking.
      
      So rearrange the code to ensure fh_unlock() is called exactly once if
      fh_lock() was called.
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      e18bcb33
    • NeilBrown's avatar
      NFSD: always drop directory lock in nfsd_unlink() · b677c0c6
      NeilBrown authored
      Some error paths in nfsd_unlink() allow it to exit without unlocking the
      directory.  This is not a problem in practice as the directory will be
      locked with an fh_put(), but it is untidy and potentially confusing.
      
      This allows us to remove all the fh_unlock() calls that are immediately
      after nfsd_unlink() calls.
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      b677c0c6
    • NeilBrown's avatar
      NFSD: change nfsd_create()/nfsd_symlink() to unlock directory before returning. · 927bfc56
      NeilBrown authored
      nfsd_create() usually returns with the directory still locked.
      nfsd_symlink() usually returns with it unlocked.  This is clumsy.
      
      Until recently nfsd_create() needed to keep the directory locked until
      ACLs and security label had been set.  These are now set inside
      nfsd_create() (in nfsd_setattr()) so this need is gone.
      
      So change nfsd_create() and nfsd_symlink() to always unlock, and remove
      any fh_unlock() calls that follow calls to these functions.
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      927bfc56
    • NeilBrown's avatar
      NFSD: add posix ACLs to struct nfsd_attrs · c0cbe707
      NeilBrown authored
      pacl and dpacl pointers are added to struct nfsd_attrs, which requires
      that we have an nfsd_attrs_free() function to free them.
      Those nfsv4 functions that can set ACLs now set up these pointers
      based on the passed in NFSv4 ACL.
      
      nfsd_setattr() sets the acls as appropriate.
      
      Errors are handled as with security labels.
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      c0cbe707
  2. 30 Jul, 2022 35 commits