Skip to content
  1. Apr 09, 2018
    • David Howells's avatar
      afs: Rearrange status mapping · dd9fbcb8
      David Howells authored
      
      
      Rearrange the AFSFetchStatus to inode attribute mapping code in a number of
      ways:
      
       (1) Use an XDR structure rather than a series of incremented pointer
           accesses when decoding an AFSFetchStatus object.  This allows
           out-of-order decode.
      
       (2) Don't store the if_version value but rather just check it and abort if
           it's not something we can handle.
      
       (3) Store the owner and group in the status record as raw values rather
           than converting them to kuid/kgid.  Do that when they're mapped into
           i_uid/i_gid.
      
       (4) Validate the type and abort code up front and abort if they're wrong.
      
       (5) Split the inode attribute setting out into its own function from the
           XDR decode of an AFSFetchStatus object.  This allows it to be called
           from elsewhere too.
      
       (6) Differentiate changes to data from changes to metadata.
      
       (7) Use the split-out attribute mapping function from afs_iget().
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      dd9fbcb8
    • David Howells's avatar
      afs: Make it possible to get the data version in readpage · 0c3a5ac2
      David Howells authored
      
      
      Store the data version number indicated by an FS.FetchData op into the read
      request structure so that it's accessible by the page reader.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      0c3a5ac2
    • David Howells's avatar
      afs: Init inode before accessing cache · 5800db81
      David Howells authored
      
      
      We no longer parse symlinks when we get the inode to determine if this
      symlink is actually a mountpoint as we detect that by examining the mode
      instead (symlinks are always 0777 and mountpoints 0644).
      
      Access the cache after mapping the status so that we don't have to manually
      set the inode size now.
      
      Note that this may need adjusting if the disconnected operation is
      implemented as the file metadata may have to be obtained from the cache.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      5800db81
    • David Howells's avatar
      afs: Introduce a statistics proc file · d55b4da4
      David Howells authored
      
      
      Introduce a proc file that displays a bunch of statistics for the AFS
      filesystem in the current network namespace.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      d55b4da4
    • David Howells's avatar
      afs: Dump bad status record · 888b3384
      David Howells authored
      
      
      Dump an AFS FileStatus record that is detected as invalid.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      888b3384
    • David Howells's avatar
      afs: Implement @cell substitution handling · 37ab6368
      David Howells authored
      
      
      Implement @cell substitution handling such that if @cell is seen as a name
      in a dynamic root mount, then the name of the root cell for that network
      namespace will be substituted for @cell during lookup.
      
      The substitution of @cell for the current net namespace is set by writing
      the cell name to /proc/fs/afs/rootcell.  The value can be obtained by
      reading the file.
      
      For example:
      
      	# mount -t afs none /kafs -o dyn
      	# echo grand.central.org >/proc/fs/afs/rootcell
      	# ls /kafs/@cell
      	archive/  cvs/  doc/  local/  project/  service/  software/  user/  www/
      	# cat /proc/fs/afs/rootcell
      	grand.central.org
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      37ab6368
    • David Howells's avatar
      afs: Implement @sys substitution handling · 6f8880d8
      David Howells authored
      
      
      Implement the AFS feature by which @sys at the end of a pathname component
      may be substituted for one of a list of values, typically naming the
      operating system.  Up to 16 alternatives may be specified and these are
      tried in turn until one works.  Each network namespace has[*] a separate
      independent list.
      
      Upon creation of a new network namespace, the list of values is
      initialised[*] to a single OpenAFS-compatible string representing arch type
      plus "_linux26".  For example, on x86_64, the sysname is "amd64_linux26".
      
      [*] Or will, once network namespace support is finalised in kAFS.
      
      The list may be set by:
      
      	# for i in foo bar linux-x86_64; do echo $i; done >/proc/fs/afs/sysname
      
      for which separate writes to the same fd are amalgamated and applied on
      close.  The LF character may be used as a separator to specify multiple
      items in the same write() call.
      
      The list may be cleared by:
      
      	# echo >/proc/fs/afs/sysname
      
      and read by:
      
      	# cat /proc/fs/afs/sysname
      	foo
      	bar
      	linux-x86_64
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      6f8880d8
    • David Howells's avatar
      afs: Prospectively look up extra files when doing a single lookup · 5cf9dd55
      David Howells authored
      
      
      When afs_lookup() is called, prospectively look up the next 50 uncached
      fids also from that same directory and cache the results, rather than just
      looking up the one file requested.
      
      This allows us to use the FS.InlineBulkStatus RPC op to increase efficiency
      by fetching up to 50 file statuses at a time.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      5cf9dd55
    • David Howells's avatar
      afs: Don't over-increment the cell usage count when pinning it · 17814aef
      David Howells authored
      
      
      AFS cells that are added or set as the workstation cell through /proc are
      pinned against removal by setting the AFS_CELL_FL_NO_GC flag on them and
      taking a ref.  The ref should be only taken if the flag wasn't already set.
      
      Fix this by making it conditional.
      
      Without this an assertion failure will occur during module removal
      indicating that the refcount is too elevated.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      17814aef
    • David Howells's avatar
      afs: Fix checker warnings · fe342cf7
      David Howells authored
      
      
      Fix warnings raised by checker, including:
      
       (*) Warnings raised by unequal comparison for the purposes of sorting,
           where the endianness doesn't matter:
      
      fs/afs/addr_list.c:246:21: warning: restricted __be16 degrades to integer
      fs/afs/addr_list.c:246:30: warning: restricted __be16 degrades to integer
      fs/afs/addr_list.c:248:21: warning: restricted __be32 degrades to integer
      fs/afs/addr_list.c:248:49: warning: restricted __be32 degrades to integer
      fs/afs/addr_list.c:283:21: warning: restricted __be16 degrades to integer
      fs/afs/addr_list.c:283:30: warning: restricted __be16 degrades to integer
      
       (*) afs_set_cb_interest() is not actually used and can be removed.
      
       (*) afs_cell_gc_delay() should be provided with a sysctl.
      
       (*) afs_cell_destroy() needs to use rcu_access_pointer() to read
           cell->vl_addrs.
      
       (*) afs_init_fs_cursor() should be static.
      
       (*) struct afs_vnode::permit_cache needs to be marked __rcu.
      
       (*) afs_server_rcu() needs to use rcu_access_pointer().
      
       (*) afs_destroy_server() should use rcu_access_pointer() on
           server->addresses as the server object is no longer accessible.
      
       (*) afs_find_server() casts __be16/__be32 values to int in order to
           directly compare them for the purpose of finding a match in a list,
           but is should also annotate the cast with __force to avoid checker
           warnings.
      
       (*) afs_check_permit() accesses vnode->permit_cache outside of the RCU
           readlock, though it doesn't then access the value; the extraneous
           access is deleted.
      
      False positives:
      
       (*) Conditional locking around the code in xdr_decode_AFSFetchStatus.  This
           can be dealt with in a separate patch.
      
      fs/afs/fsclient.c:148:9: warning: context imbalance in 'xdr_decode_AFSFetchStatus' - different lock contexts for basic block
      
       (*) Incorrect handling of seq-retry lock context balance:
      
      fs/afs/inode.c:455:38: warning: context imbalance in 'afs_getattr' - different
      lock contexts for basic block
      fs/afs/server.c:52:17: warning: context imbalance in 'afs_find_server' - different lock contexts for basic block
      fs/afs/server.c:128:17: warning: context imbalance in 'afs_find_server_by_uuid' - different lock contexts for basic block
      
      Errors:
      
       (*) afs_lookup_cell_rcu() needs to break out of the seq-retry loop, not go
           round again if it successfully found the workstation cell.
      
       (*) Fix UUID decode in afs_deliver_cb_probe_uuid().
      
       (*) afs_cache_permit() has a missing rcu_read_unlock() before one of the
           jumps to the someone_else_changed_it label.  Move the unlock to after
           the label.
      
       (*) afs_vl_get_addrs_u() is using ntohl() rather than htonl() when
           encoding to XDR.
      
       (*) afs_deliver_yfsvl_get_endpoints() is using htonl() rather than ntohl()
           when decoding from XDR.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      fe342cf7
  2. Apr 08, 2018
  3. Apr 06, 2018
Loading