1. 23 5月, 2020 1 次提交
    • D
      rxrpc: Fix a warning · 8a1d24e1
      David Howells 提交于
      Fix a warning due to an uninitialised variable.
      
      le included from ../fs/afs/fs_probe.c:11:
      ../fs/afs/fs_probe.c: In function 'afs_fileserver_probe_result':
      ../fs/afs/internal.h:1453:2: warning: 'rtt_us' may be used uninitialized in this function [-Wmaybe-uninitialized]
       1453 |  printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__)
            |  ^~~~~~
      ../fs/afs/fs_probe.c:35:15: note: 'rtt_us' was declared here
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      8a1d24e1
  2. 19 5月, 2020 1 次提交
    • D
      afs: Don't unlock fetched data pages until the op completes successfully · 9d1be4f4
      David Howells 提交于
      Don't call req->page_done() on each page as we finish filling it with
      the data coming from the network.  Whilst this might speed up the
      application a bit, it's a problem if there's a network failure and the
      operation has to be reissued.
      
      If this happens, an oops occurs because afs_readpages_page_done() clears
      the pointer to each page it unlocks and when a retry happens, the
      pointers to the pages it wants to fill are now NULL (and the pages have
      been unlocked anyway).
      
      Instead, wait till the operation completes successfully and only then
      release all the pages after clearing any terminal gap (the server can
      give us less data than we requested as we're allowed to ask for more
      than is available).
      
      KASAN produces a bug like the following, and even without KASAN, it can
      oops and panic.
      
          BUG: KASAN: wild-memory-access in _copy_to_iter+0x323/0x5f4
          Write of size 1404 at addr 0005088000000000 by task md5sum/5235
      
          CPU: 0 PID: 5235 Comm: md5sum Not tainted 5.7.0-rc3-fscache+ #250
          Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
          Call Trace:
           memcpy+0x39/0x58
           _copy_to_iter+0x323/0x5f4
           __skb_datagram_iter+0x89/0x2a6
           skb_copy_datagram_iter+0x129/0x135
           rxrpc_recvmsg_data.isra.0+0x615/0xd42
           rxrpc_kernel_recv_data+0x1e9/0x3ae
           afs_extract_data+0x139/0x33a
           yfs_deliver_fs_fetch_data64+0x47a/0x91b
           afs_deliver_to_call+0x304/0x709
           afs_wait_for_call_to_complete+0x1cc/0x4ad
           yfs_fs_fetch_data+0x279/0x288
           afs_fetch_data+0x1e1/0x38d
           afs_readpages+0x593/0x72e
           read_pages+0xf5/0x21e
           __do_page_cache_readahead+0x128/0x23f
           ondemand_readahead+0x36e/0x37f
           generic_file_buffered_read+0x234/0x680
           new_sync_read+0x109/0x17e
           vfs_read+0xe6/0x138
           ksys_read+0xd8/0x14d
           do_syscall_64+0x6e/0x8a
           entry_SYSCALL_64_after_hwframe+0x49/0xb3
      
      Fixes: 196ee9cd ("afs: Make afs_fs_fetch_data() take a list of pages")
      Fixes: 30062bd1 ("afs: Implement YFS support in the fs client")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Reviewed-by: NMatthew Wilcox (Oracle) <willy@infradead.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9d1be4f4
  3. 11 5月, 2020 1 次提交
    • D
      rxrpc: Fix the excessive initial retransmission timeout · c410bf01
      David Howells 提交于
      rxrpc currently uses a fixed 4s retransmission timeout until the RTT is
      sufficiently sampled.  This can cause problems with some fileservers with
      calls to the cache manager in the afs filesystem being dropped from the
      fileserver because a packet goes missing and the retransmission timeout is
      greater than the call expiry timeout.
      
      Fix this by:
      
       (1) Copying the RTT/RTO calculation code from Linux's TCP implementation
           and altering it to fit rxrpc.
      
       (2) Altering the various users of the RTT to make use of the new SRTT
           value.
      
       (3) Replacing the use of rxrpc_resend_timeout to use the calculated RTO
           value instead (which is needed in jiffies), along with a backoff.
      
      Notes:
      
       (1) rxrpc provides RTT samples by matching the serial numbers on outgoing
           DATA packets that have the RXRPC_REQUEST_ACK set and PING ACK packets
           against the reference serial number in incoming REQUESTED ACK and
           PING-RESPONSE ACK packets.
      
       (2) Each packet that is transmitted on an rxrpc connection gets a new
           per-connection serial number, even for retransmissions, so an ACK can
           be cross-referenced to a specific trigger packet.  This allows RTT
           information to be drawn from retransmitted DATA packets also.
      
       (3) rxrpc maintains the RTT/RTO state on the rxrpc_peer record rather than
           on an rxrpc_call because many RPC calls won't live long enough to
           generate more than one sample.
      
       (4) The calculated SRTT value is in units of 8ths of a microsecond rather
           than nanoseconds.
      
      The (S)RTT and RTO values are displayed in /proc/net/rxrpc/peers.
      
      Fixes: 17926a79 ([AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both"")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      c410bf01
  4. 24 4月, 2020 3 次提交
    • D
      afs: Make record checking use TASK_UNINTERRUPTIBLE when appropriate · c4bfda16
      David Howells 提交于
      When an operation is meant to be done uninterruptibly (such as
      FS.StoreData), we should not be allowing volume and server record checking
      to be interrupted.
      
      Fixes: d2ddc776 ("afs: Overhaul volume and server record caching and fileserver rotation")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      c4bfda16
    • D
      afs: Fix to actually set AFS_SERVER_FL_HAVE_EPOCH · 69cf3978
      David Howells 提交于
      AFS keeps track of the epoch value from the rxrpc protocol to note (a) when
      a fileserver appears to have restarted and (b) when different endpoints of
      a fileserver do not appear to be associated with the same fileserver
      (ie. all probes back from a fileserver from all of its interfaces should
      carry the same epoch).
      
      However, the AFS_SERVER_FL_HAVE_EPOCH flag that indicates that we've
      received the server's epoch is never set, though it is used.
      
      Fix this to set the flag when we first receive an epoch value from a probe
      sent to the filesystem client from the fileserver.
      
      Fixes: 3bf0fb6f ("afs: Probe multiple fileservers simultaneously")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      69cf3978
    • D
      afs: Remove some unused bits · be59167c
      David Howells 提交于
      Remove three bits:
      
       (1) afs_server::no_epoch is neither set nor used.
      
       (2) afs_server::have_result is set and a wakeup is applied to it, but
           nothing looks at it or waits on it.
      
       (3) afs_vl_dump_edestaddrreq() prints afs_addr_list::probed, but nothing
           sets it for VL servers.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      be59167c
  5. 13 4月, 2020 6 次提交
    • D
      afs: Fix afs_d_validate() to set the right directory version · 40fc8102
      David Howells 提交于
      If a dentry's version is somewhere between invalid_before and the current
      directory version, we should be setting it forward to the current version,
      not backwards to the invalid_before version.  Note that we're only doing
      this at all because dentry::d_fsdata isn't large enough on a 32-bit system.
      
      Fix this by using a separate variable for invalid_before so that we don't
      accidentally clobber the current dir version.
      
      Fixes: a4ff7401 ("afs: Keep track of invalid-before version for dentry coherency")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      40fc8102
    • D
      afs: Fix race between post-modification dir edit and readdir/d_revalidate · 2105c282
      David Howells 提交于
      AFS directories are retained locally as a structured file, with lookup
      being effected by a local search of the file contents.  When a modification
      (such as mkdir) happens, the dir file content is modified locally rather
      than redownloading the directory.
      
      The directory contents are accessed in a number of ways, with a number of
      different locks schemes:
      
       (1) Download of contents - dvnode->validate_lock/write in afs_read_dir().
      
       (2) Lookup and readdir - dvnode->validate_lock/read in afs_dir_iterate(),
           downgrading from (1) if necessary.
      
       (3) d_revalidate of child dentry - dvnode->validate_lock/read in
           afs_do_lookup_one() downgrading from (1) if necessary.
      
       (4) Edit of dir after modification - page locks on individual dir pages.
      
      Unfortunately, because (4) uses different locking scheme to (1) - (3),
      nothing protects against the page being scanned whilst the edit is
      underway.  Even download is not safe as it doesn't lock the pages - relying
      instead on the validate_lock to serialise as a whole (the theory being that
      directory contents are treated as a block and always downloaded as a
      block).
      
      Fix this by write-locking dvnode->validate_lock around the edits.  Care
      must be taken in the rename case as there may be two different dirs - but
      they need not be locked at the same time.  In any case, once the lock is
      taken, the directory version must be rechecked, and the edit skipped if a
      later version has been downloaded by revalidation (there can't have been
      any local changes because the VFS holds the inode lock, but there can have
      been remote changes).
      
      Fixes: 63a4681f ("afs: Locally edit directory data for mkdir/create/unlink/...")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      2105c282
    • D
      afs: Fix length of dump of bad YFSFetchStatus record · 3efe55b0
      David Howells 提交于
      Fix the length of the dump of a bad YFSFetchStatus record.  The function
      was copied from the AFS version, but the YFS variant contains bigger fields
      and extra information, so expand the dump to match.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      3efe55b0
    • D
      afs: Fix rename operation status delivery · b98f0ec9
      David Howells 提交于
      The afs_deliver_fs_rename() and yfs_deliver_fs_rename() functions both only
      decode the second file status returned unless the parent directories are
      different - unfortunately, this means that the xdr pointer isn't advanced
      and the volsync record will be read incorrectly in such an instance.
      
      Fix this by always decoding the second status into the second
      status/callback block which wasn't being used if the dirs were the same.
      
      The afs_update_dentry_version() calls that update the directory data
      version numbers on the dentries can then unconditionally use the second
      status record as this will always reflect the state of the destination dir
      (the two records will be identical if the destination dir is the same as
      the source dir)
      
      Fixes: 260a9803 ("[AFS]: Add "directory write" support.")
      Fixes: 30062bd1 ("afs: Implement YFS support in the fs client")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      b98f0ec9
    • D
      afs: Fix decoding of inline abort codes from version 1 status records · 3e0d9892
      David Howells 提交于
      If we're decoding an AFSFetchStatus record and we see that the version is 1
      and the abort code is set and we're expecting inline errors, then we store
      the abort code and ignore the remaining status record (which is correct),
      but we don't set the flag to say we got a valid abort code.
      
      This can affect operation of YFS.RemoveFile2 when removing a file and the
      operation of {,Y}FS.InlineBulkStatus when prospectively constructing or
      updating of a set of inodes during a lookup.
      
      Fix this to indicate the reception of a valid abort code.
      
      Fixes: a38a7558 ("afs: Fix unlink to handle YFS.RemoveFile2 better")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      3e0d9892
    • D
      afs: Fix missing XDR advance in xdr_decode_{AFS,YFS}FSFetchStatus() · c72057b5
      David Howells 提交于
      If we receive a status record that has VNOVNODE set in the abort field,
      xdr_decode_AFSFetchStatus() and xdr_decode_YFSFetchStatus() don't advance
      the XDR pointer, thereby corrupting anything subsequent decodes from the
      same block of data.
      
      This has the potential to affect AFS.InlineBulkStatus and
      YFS.InlineBulkStatus operation, but probably doesn't since the status
      records are extracted as individual blocks of data and the buffer pointer
      is reset between blocks.
      
      It does affect YFS.RemoveFile2 operation, corrupting the volsync record -
      though that is not currently used.
      
      Other operations abort the entire operation rather than returning an error
      inline, in which case there is no decoding to be done.
      
      Fix this by unconditionally advancing the xdr pointer.
      
      Fixes: 684b0f68 ("afs: Fix AFSFetchStatus decoder to provide OpenAFS compatibility")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      c72057b5
  6. 27 3月, 2020 1 次提交
  7. 14 3月, 2020 5 次提交
    • D
      afs: Fix client call Rx-phase signal handling · 7d7587db
      David Howells 提交于
      Fix the handling of signals in client rxrpc calls made by the afs
      filesystem.  Ignore signals completely, leaving call abandonment or
      connection loss to be detected by timeouts inside AF_RXRPC.
      
      Allowing a filesystem call to be interrupted after the entire request has
      been transmitted and an abort sent means that the server may or may not
      have done the action - and we don't know.  It may even be worse than that
      for older servers.
      
      Fixes: bc5e3a54 ("rxrpc: Use MSG_WAITALL to tell sendmsg() to temporarily ignore signals")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      7d7587db
    • D
      afs: Fix handling of an abort from a service handler · dde9f095
      David Howells 提交于
      When an AFS service handler function aborts a call, AF_RXRPC marks the call
      as complete - which means that it's not going to get any more packets from
      the receiver.  This is a problem because reception of the final ACK is what
      triggers afs_deliver_to_call() to drop the final ref on the afs_call
      object.
      
      Instead, aborted AFS service calls may then just sit around waiting for
      ever or until they're displaced by a new call on the same connection
      channel or a connection-level abort.
      
      Fix this by calling afs_set_call_complete() to finalise the afs_call struct
      representing the call.
      
      However, we then need to drop the ref that stops the call from being
      deallocated.  We can do this in afs_set_call_complete(), as the work queue
      is holding a separate ref of its own, but then we shouldn't do it in
      afs_process_async_call() and afs_delete_async_call().
      
      call->drop_ref is set to indicate that a ref needs dropping for a call and
      this is dealt with when we transition a call to AFS_CALL_COMPLETE.
      
      But then we also need to get rid of the ref that pins an asynchronous
      client call.  We can do this by the same mechanism, setting call->drop_ref
      for an async client call too.
      
      We can also get rid of call->incoming since nothing ever sets it and only
      one thing ever checks it (futilely).
      
      
      A trace of the rxrpc_call and afs_call struct ref counting looks like:
      
                <idle>-0     [001] ..s5   164.764892: rxrpc_call: c=00000002 SEE u=3 sp=rxrpc_new_incoming_call+0x473/0xb34 a=00000000442095b5
                <idle>-0     [001] .Ns5   164.766001: rxrpc_call: c=00000002 QUE u=4 sp=rxrpc_propose_ACK+0xbe/0x551 a=00000000442095b5
                <idle>-0     [001] .Ns4   164.766005: rxrpc_call: c=00000002 PUT u=3 sp=rxrpc_new_incoming_call+0xa3f/0xb34 a=00000000442095b5
                <idle>-0     [001] .Ns7   164.766433: afs_call: c=00000002 WAKE  u=2 o=11 sp=rxrpc_notify_socket+0x196/0x33c
           kworker/1:2-1810  [001] ...1   164.768409: rxrpc_call: c=00000002 SEE u=3 sp=rxrpc_process_call+0x25/0x7ae a=00000000442095b5
           kworker/1:2-1810  [001] ...1   164.769439: rxrpc_tx_packet: c=00000002 e9f1a7a8:95786a88:00000008:09c5 00000001 00000000 02 22 ACK CallAck
           kworker/1:2-1810  [001] ...1   164.769459: rxrpc_call: c=00000002 PUT u=2 sp=rxrpc_process_call+0x74f/0x7ae a=00000000442095b5
           kworker/1:2-1810  [001] ...1   164.770794: afs_call: c=00000002 QUEUE u=3 o=12 sp=afs_deliver_to_call+0x449/0x72c
           kworker/1:2-1810  [001] ...1   164.770829: afs_call: c=00000002 PUT   u=2 o=12 sp=afs_process_async_call+0xdb/0x11e
           kworker/1:2-1810  [001] ...2   164.771084: rxrpc_abort: c=00000002 95786a88:00000008 s=0 a=1 e=1 K-1
           kworker/1:2-1810  [001] ...1   164.771461: rxrpc_tx_packet: c=00000002 e9f1a7a8:95786a88:00000008:09c5 00000002 00000000 04 00 ABORT CallAbort
           kworker/1:2-1810  [001] ...1   164.771466: afs_call: c=00000002 PUT   u=1 o=12 sp=SRXAFSCB_ProbeUuid+0xc1/0x106
      
      The abort generated in SRXAFSCB_ProbeUuid(), labelled "K-1", indicates that
      the local filesystem/cache manager didn't recognise the UUID as its own.
      
      Fixes: 2067b2b3 ("afs: Fix the CB.ProbeUuid service handler to reply correctly")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      dde9f095
    • D
      afs: Fix some tracing details · 4636cf18
      David Howells 提交于
      Fix a couple of tracelines to indicate the usage count after the atomic op,
      not the usage count before it to be consistent with other afs and rxrpc
      trace lines.
      
      Change the wording of the afs_call_trace_work trace ID label from "WORK" to
      "QUEUE" to reflect the fact that it's queueing work, not doing work.
      
      Fixes: 341f741f ("afs: Refcount the afs_call struct")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      4636cf18
    • D
      rxrpc: Fix call interruptibility handling · e138aa7d
      David Howells 提交于
      Fix the interruptibility of kernel-initiated client calls so that they're
      either only interruptible when they're waiting for a call slot to come
      available or they're not interruptible at all.  Either way, they're not
      interruptible during transmission.
      
      This should help prevent StoreData calls from being interrupted when
      writeback is in progress.  It doesn't, however, handle interruption during
      the receive phase.
      
      Userspace-initiated calls are still interruptable.  After the signal has
      been handled, sendmsg() will return the amount of data copied out of the
      buffer and userspace can perform another sendmsg() call to continue
      transmission.
      
      Fixes: bc5e3a54 ("rxrpc: Use MSG_WAITALL to tell sendmsg() to temporarily ignore signals")
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      e138aa7d
    • J
      afs: Use kfree_rcu() instead of casting kfree() to rcu_callback_t · ddd2b85f
      Jann Horn 提交于
      afs_put_addrlist() casts kfree() to rcu_callback_t. Apart from being wrong
      in theory, this might also blow up when people start enforcing function
      types via compiler instrumentation, and it means the rcu_head has to be
      first in struct afs_addr_list.
      
      Use kfree_rcu() instead, it's simpler and more correct.
      Signed-off-by: NJann Horn <jannh@google.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ddd2b85f
  8. 08 2月, 2020 2 次提交
  9. 07 2月, 2020 2 次提交
  10. 27 1月, 2020 1 次提交
    • D
      afs: Fix characters allowed into cell names · a45ea48e
      David Howells 提交于
      The afs filesystem needs to prohibit certain characters from cell names,
      such as '/', as these are used to form filenames in procfs, leading to
      the following warning being generated:
      
      	WARNING: CPU: 0 PID: 3489 at fs/proc/generic.c:178
      
      Fix afs_alloc_cell() to disallow nonprintable characters, '/', '@' and
      names that begin with a dot.
      
      Remove the check for "@cell" as that is then redundant.
      
      This can be tested by running:
      
      	echo add foo/.bar 1.2.3.4 >/proc/fs/afs/cells
      
      Note that we will also need to deal with:
      
       - Names ending in ".invalid" shouldn't be passed to the DNS.
      
       - Names that contain non-valid domainname chars shouldn't be passed to
         the DNS.
      
       - DNS replies that say "your-dns-needs-immediate-attention.<gTLD>" and
         replies containing A records that say 127.0.53.53 should be
         considered invalid.
         [https://www.icann.org/en/system/files/files/name-collision-mitigation-01aug14-en.pdf]
      
      but these need to be dealt with by the kafs-client DNS program rather
      than the kernel.
      
      Reported-by: syzbot+b904ba7c947a37b4b291@syzkaller.appspotmail.com
      Cc: stable@kernel.org
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a45ea48e
  11. 15 1月, 2020 2 次提交
  12. 12 12月, 2019 4 次提交
    • D
      afs: Show volume name in /proc/net/afs/<cell>/volumes · 50559800
      David Howells 提交于
      Show the name of each volume in /proc/net/afs/<cell>/volumes to make it
      easier to work out the name corresponding to a volume ID.  This makes it
      easier to work out which mounts in /proc/mounts correspond to which volume
      ID.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Reviewed-by: NMarc Dionne <marc.dionne@auristor.com>
      50559800
    • D
      afs: Fix missing cell comparison in afs_test_super() · 106bc798
      David Howells 提交于
      Fix missing cell comparison in afs_test_super().  Without this, any pair
      volumes that have the same volume ID will share a superblock, no matter the
      cell, unless they're in different network namespaces.
      
      Normally, most users will only deal with a single cell and so they won't
      see this.  Even if they do look into a second cell, they won't see a
      problem unless they happen to hit a volume with the same ID as one they've
      already got mounted.
      
      Before the patch:
      
          # ls /afs/grand.central.org/archive
          linuxdev/  mailman/  moin/  mysql/  pipermail/  stage/  twiki/
          # ls /afs/kth.se/
          linuxdev/  mailman/  moin/  mysql/  pipermail/  stage/  twiki/
          # cat /proc/mounts | grep afs
          none /afs afs rw,relatime,dyn,autocell 0 0
          #grand.central.org:root.cell /afs/grand.central.org afs ro,relatime 0 0
          #grand.central.org:root.archive /afs/grand.central.org/archive afs ro,relatime 0 0
          #grand.central.org:root.archive /afs/kth.se afs ro,relatime 0 0
      
      After the patch:
      
          # ls /afs/grand.central.org/archive
          linuxdev/  mailman/  moin/  mysql/  pipermail/  stage/  twiki/
          # ls /afs/kth.se/
          admin/        common/  install/  OldFiles/  service/  system/
          bakrestores/  home/    misc/     pkg/       src/      wsadmin/
          # cat /proc/mounts | grep afs
          none /afs afs rw,relatime,dyn,autocell 0 0
          #grand.central.org:root.cell /afs/grand.central.org afs ro,relatime 0 0
          #grand.central.org:root.archive /afs/grand.central.org/archive afs ro,relatime 0 0
          #kth.se:root.cell /afs/kth.se afs ro,relatime 0 0
      
      Fixes: ^1da177e4 ("Linux-2.6.12-rc2")
      Reported-by: NCarsten Jacobi <jacobi@de.ibm.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Reviewed-by: NMarc Dionne <marc.dionne@auristor.com>
      Tested-by: NJonathan Billings <jsbillings@jsbillings.org>
      cc: Todd DeSantis <atd@us.ibm.com>
      106bc798
    • D
      afs: Fix creation calls in the dynamic root to fail with EOPNOTSUPP · 1da4bd9f
      David Howells 提交于
      Fix the lookup method on the dynamic root directory such that creation
      calls, such as mkdir, open(O_CREAT), symlink, etc. fail with EOPNOTSUPP
      rather than failing with some odd error (such as EEXIST).
      
      lookup() itself tries to create automount directories when it is invoked.
      These are cached locally in RAM and not committed to storage.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Reviewed-by: NMarc Dionne <marc.dionne@auristor.com>
      Tested-by: NJonathan Billings <jsbillings@jsbillings.org>
      1da4bd9f
    • D
      afs: Fix mountpoint parsing · 158d5833
      David Howells 提交于
      Each AFS mountpoint has strings that define the target to be mounted.  This
      is required to end in a dot that is supposed to be stripped off.  The
      string can include suffixes of ".readonly" or ".backup" - which are
      supposed to come before the terminal dot.  To add to the confusion, the "fs
      lsmount" afs utility does not show the terminal dot when displaying the
      string.
      
      The kernel mount source string parser, however, assumes that the terminal
      dot marks the suffix and that the suffix is always "" and is thus ignored.
      In most cases, there is no suffix and this is not a problem - but if there
      is a suffix, it is lost and this affects the ability to mount the correct
      volume.
      
      The command line mount command, on the other hand, is expected not to
      include a terminal dot - so the problem doesn't arise there.
      
      Fix this by making sure that the dot exists and then stripping it when
      passing the string to the mount configuration.
      
      Fixes: bec5eb61 ("AFS: Implement an autocell mount capability [ver #2]")
      Reported-by: NJonathan Billings <jsbillings@jsbillings.org>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Reviewed-by: NMarc Dionne <marc.dionne@auristor.com>
      Tested-by: NJonathan Billings <jsbillings@jsbillings.org>
      158d5833
  13. 10 12月, 2019 1 次提交
  14. 09 12月, 2019 1 次提交
    • M
      afs: Fix afs_find_server lookups for ipv4 peers · 9bd0160d
      Marc Dionne 提交于
      afs_find_server tries to find a server that has an address that
      matches the transport address of an rxrpc peer.  The code assumes
      that the transport address is always ipv6, with ipv4 represented
      as ipv4 mapped addresses, but that's not the case.  If the transport
      family is AF_INET, srx->transport.sin6.sin6_addr.s6_addr32[] will
      be beyond the actual ipv4 address and will always be 0, and all
      ipv4 addresses will be seen as matching.
      
      As a result, the first ipv4 address seen on any server will be
      considered a match, and the server returned may be the wrong one.
      
      One of the consequences is that callbacks received over ipv4 will
      only be correctly applied for the server that happens to have the
      first ipv4 address on the fs_addresses4 list.  Callbacks over ipv4
      from all other servers are dropped, causing the client to serve stale
      data.
      
      This is fixed by looking at the transport family, and comparing ipv4
      addresses based on a sockaddr_in structure rather than a sockaddr_in6.
      
      Fixes: d2ddc776 ("afs: Overhaul volume and server record caching and fileserver rotation")
      Signed-off-by: NMarc Dionne <marc.dionne@auristor.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      9bd0160d
  15. 23 11月, 2019 2 次提交
  16. 22 11月, 2019 2 次提交
  17. 21 11月, 2019 5 次提交