1. 20 7月, 2021 3 次提交
  2. 03 6月, 2021 5 次提交
  3. 25 5月, 2021 11 次提交
    • A
      fs: dlm: don't allow half transmitted messages · 706474fb
      Alexander Aring 提交于
      This patch will clean a dirty page buffer if a reconnect occurs. If a page
      buffer was half transmitted we cannot start inside the middle of a dlm
      message if a node connects again. I observed invalid length receptions
      errors and was guessing that this behaviour occurs, after this patch I
      never saw an invalid message length again. This patch might drops more
      messages for dlm version 3.1 but 3.1 can't deal with half messages as
      well, for 3.2 it might trigger more re-transmissions but will not leave dlm
      in a broken state.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      706474fb
    • A
      fs: dlm: add reliable connection if reconnect · 489d8e55
      Alexander Aring 提交于
      This patch introduce to make a tcp lowcomms connection reliable even if
      reconnects occurs. This is done by an application layer re-transmission
      handling and sequence numbers in dlm protocols. There are three new dlm
      commands:
      
      DLM_OPTS:
      
      This will encapsulate an existing dlm message (and rcom message if they
      don't have an own application side re-transmission handling). As optional
      handling additional tlv's (type length fields) can be appended. This can
      be for example a sequence number field. However because in DLM_OPTS the
      lockspace field is unused and a sequence number is a mandatory field it
      isn't made as a tlv and we put the sequence number inside the lockspace
      id. The possibility to add optional options are still there for future
      purposes.
      
      DLM_ACK:
      
      Just a dlm header to acknowledge the receive of a DLM_OPTS message to
      it's sender.
      
      DLM_FIN:
      
      This provides a 4 way handshake for connection termination inclusive
      support for half-closed connections. It's provided on application layer
      because SCTP doesn't support half-closed sockets, the shutdown() call
      can interrupted by e.g. TCP resets itself and a hard logic to implement
      it because the othercon paradigm in lowcomms. The 4-way termination
      handshake also solve problems to synchronize peer EOF arrival and that
      the cluster manager removes the peer in the node membership handling of
      DLM. In some cases messages can be still transmitted in this time and we
      need to wait for the node membership event.
      
      To provide a reliable connection the node will retransmit all
      unacknowledges message to it's peer on reconnect. The receiver will then
      filtering out the next received message and drop all messages which are
      duplicates.
      
      As RCOM_STATUS and RCOM_NAMES messages are the first messages which are
      exchanged and they have they own re-transmission handling, there exists
      logic that these messages must be first. If these messages arrives we
      store the dlm version field. This handling is on DLM 3.1 and after this
      patch 3.2 the same. A backwards compatibility handling has been added
      which seems to work on tests without tcpkill, however it's not recommended
      to use DLM 3.1 and 3.2 at the same time, because DLM 3.2 tries to fix long
      term bugs in the DLM protocol.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      489d8e55
    • A
      fs: dlm: move out some hash functionality · 37a247da
      Alexander Aring 提交于
      This patch moves out some lowcomms hash functionality into lowcomms
      header to provide them to other layers like midcomms as well.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      37a247da
    • A
      fs: dlm: add functionality to re-transmit a message · 2874d1a6
      Alexander Aring 提交于
      This patch introduces a retransmit functionality for a lowcomms message
      handle. It's just allocates a new buffer and transmit it again, no
      special handling about prioritize it because keeping bytestream in order.
      
      To avoid another connection look some refactor was done to make a new
      buffer allocation with a preexisting connection pointer.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      2874d1a6
    • A
      fs: dlm: make buffer handling per msg · 8f2dc78d
      Alexander Aring 提交于
      This patch makes the void pointer handle for lowcomms functionality per
      message and not per page allocation entry. A refcount handling for the
      handle was added to keep the message alive until the user doesn't need
      it anymore.
      
      There exists now a per message callback which will be called when
      allocating a new buffer. This callback will be guaranteed to be called
      according the order of the sending buffer, which can be used that the
      caller increments a sequence number for the dlm message handle.
      
      For transition process we cast the dlm_mhandle to dlm_msg and vice versa
      until the midcomms layer will implement a specific dlm_mhandle structure.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      8f2dc78d
    • A
      fs: dlm: fix connection tcp EOF handling · 8aa31cbf
      Alexander Aring 提交于
      This patch fixes the EOF handling for TCP that if and EOF is received we
      will close the socket next time the writequeue runs empty. This is a
      half-closed socket functionality which doesn't exists in SCTP. The
      midcomms layer will do a half closed socket functionality on DLM side to
      solve this problem for the SCTP case. However there is still the last ack
      flying around but other reset functionality will take care of it if it got
      lost.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      8aa31cbf
    • A
      fs: dlm: cancel work sync othercon · c6aa00e3
      Alexander Aring 提交于
      These rx tx flags arguments are for signaling close_connection() from
      which worker they are called. Obviously the receive worker cannot cancel
      itself and vice versa for swork. For the othercon the receive worker
      should only be used, however to avoid deadlocks we should pass the same
      flags as the original close_connection() was called.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      c6aa00e3
    • A
      fs: dlm: reconnect if socket error report occurs · ba868d9d
      Alexander Aring 提交于
      This patch will change the reconnect handling that if an error occurs
      if a socket error callback is occurred. This will also handle reconnects
      in a non blocking connecting case which is currently missing. If error
      ECONNREFUSED is reported we delay the reconnect by one second.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      ba868d9d
    • A
      fs: dlm: set is othercon flag · 7443bc96
      Alexander Aring 提交于
      There is a is othercon flag which is never used, this patch will set it
      and printout a warning if the othercon ever sends a dlm message which
      should never be the case.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      7443bc96
    • A
      fs: dlm: fix srcu read lock usage · b38bc9c2
      Alexander Aring 提交于
      This patch holds the srcu connection read lock in cases where we lookup
      the connections and accessing it. We don't hold the srcu lock in workers
      function where the scheduled worker is part of the connection itself.
      The connection should not be freed if any worker is scheduled or
      pending.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      b38bc9c2
    • A
      fs: dlm: add dlm macros for ratelimit log · 2df6b762
      Alexander Aring 提交于
      This patch add ratelimit macro to dlm subsystem and will set the
      connecting log message to ratelimit. In non blocking connecting cases it
      will print out this message a lot.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      2df6b762
  4. 30 3月, 2021 1 次提交
  5. 09 3月, 2021 9 次提交
    • A
      fs: dlm: add shutdown hook · 9d232469
      Alexander Aring 提交于
      This patch fixes issues which occurs when dlm lowcomms synchronize their
      workqueues but dlm application layer already released the lockspace. In
      such cases messages like:
      
      dlm: gfs2: release_lockspace final free
      dlm: invalid lockspace 3841231384 from 1 cmd 1 type 11
      
      are printed on the kernel log. This patch is solving this issue by
      introducing a new "shutdown" hook before calling "stop" hook when the
      lockspace is going to be released finally. This should pretend any
      dlm messages sitting in the workqueues during or after lockspace
      removal.
      
      It's necessary to call dlm_scand_stop() as I instrumented
      dlm_lowcomms_get_buffer() code to report a warning after it's called after
      dlm_midcomms_shutdown() functionality, see below:
      
      WARNING: CPU: 1 PID: 3794 at fs/dlm/midcomms.c:1003 dlm_midcomms_get_buffer+0x167/0x180
      Modules linked in: joydev iTCO_wdt intel_pmc_bxt iTCO_vendor_support drm_ttm_helper ttm pcspkr serio_raw i2c_i801 i2c_smbus drm_kms_helper virtio_scsi lpc_ich virtio_balloon virtio_console xhci_pci xhci_pci_renesas cec qemu_fw_cfg drm [last unloaded: qxl]
      CPU: 1 PID: 3794 Comm: dlm_scand Tainted: G        W         5.11.0+ #26
      Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.13.0-2.module+el8.3.0+7353+9de0a3cc 04/01/2014
      RIP: 0010:dlm_midcomms_get_buffer+0x167/0x180
      Code: 5d 41 5c 41 5d 41 5e 41 5f c3 0f 0b 45 31 e4 5b 5d 4c 89 e0 41 5c 41 5d 41 5e 41 5f c3 4c 89 e7 45 31 e4 e8 3b f1 ec ff eb 86 <0f> 0b 4c 89 e7 45 31 e4 e8 2c f1 ec ff e9 74 ff ff ff 0f 1f 80 00
      RSP: 0018:ffffa81503f8fe60 EFLAGS: 00010202
      RAX: 0000000000000008 RBX: ffff8f969827f200 RCX: 0000000000000001
      RDX: 0000000000000000 RSI: ffffffffad1e89a0 RDI: ffff8f96a5294160
      RBP: 0000000000000001 R08: 0000000000000000 R09: ffff8f96a250bc60
      R10: 00000000000045d3 R11: 0000000000000000 R12: ffff8f96a250bc60
      R13: ffffa81503f8fec8 R14: 0000000000000070 R15: 0000000000000c40
      FS:  0000000000000000(0000) GS:ffff8f96fbc00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 000055aa3351c000 CR3: 000000010bf22000 CR4: 00000000000006e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       dlm_scan_rsbs+0x420/0x670
       ? dlm_uevent+0x20/0x20
       dlm_scand+0xbf/0xe0
       kthread+0x13a/0x150
       ? __kthread_bind_mask+0x60/0x60
       ret_from_fork+0x22/0x30
      
      To synchronize all dlm scand messages we stop it right before shutdown
      hook.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      9d232469
    • A
      fs: dlm: flush swork on shutdown · eec054b5
      Alexander Aring 提交于
      This patch fixes the flushing of send work before shutdown. The function
      cancel_work_sync() is not the right workqueue functionality to use here
      as it would cancel the work if the work queues itself. In cases of
      EAGAIN in send() for dlm message we need to be sure that everything is
      send out before. The function flush_work() will ensure that every send
      work is be done inclusive in EAGAIN cases.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      eec054b5
    • A
      fs: dlm: simplify writequeue handling · f0747ebf
      Alexander Aring 提交于
      This patch cleans up the current dlm sending allocator handling by using
      some named macros, list functionality and removes some goto statements.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      f0747ebf
    • A
      fs: dlm: use GFP_ZERO for page buffer · e1a7cbce
      Alexander Aring 提交于
      This patch uses GFP_ZERO for allocate a page for the internal dlm
      sending buffer allocator instead of calling memset zero after every
      allocation. An already allocated space will never be reused again.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      e1a7cbce
    • A
      fs: dlm: change allocation limits · c45674fb
      Alexander Aring 提交于
      While running tcpkill I experienced invalid header length values while
      receiving to check that a node doesn't try to send a invalid dlm message
      we also check on applications minimum allocation limit. Also use
      DEFAULT_BUFFER_SIZE as maximum allocation limit. The define
      LOWCOMMS_MAX_TX_BUFFER_LEN is to calculate maximum buffer limits on
      application layer, future midcomms layer will subtract their needs from
      this define.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      c45674fb
    • A
      fs: dlm: add check if dlm is currently running · 51746163
      Alexander Aring 提交于
      This patch adds checks for dlm config attributes regarding to protocol
      parameters as it makes only sense to change them when dlm is not running.
      It also adds a check for valid protocol specifiers and return invalid
      argument if they are not supported.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      51746163
    • A
      fs: dlm: set subclass for othercon sock_mutex · e9a470ac
      Alexander Aring 提交于
      This patch sets the lockdep subclass for the othercon socket mutex. In
      various places the connection socket mutex is held while locking the
      othercon socket mutex. This patch will remove lockdep warnings when such
      case occurs.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      e9a470ac
    • A
      fs: dlm: set connected bit after accept · b30a624f
      Alexander Aring 提交于
      This patch sets the CF_CONNECTED bit when dlm accepts a connection from
      another node. If we don't set this bit, next time if the connection
      socket gets writable it will assume an event that the connection is
      successfully connected. However that is only the case when the
      connection did a connect.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      b30a624f
    • A
      fs: dlm: fix mark setting deadlock · e125fbeb
      Alexander Aring 提交于
      This patch fixes an deadlock issue when dlm_lowcomms_close() is called.
      When dlm_lowcomms_close() is called the clusters_root.subsys.su_mutex is
      held to remove configfs items. At this time we flushing (e.g.
      cancel_work_sync()) the workers of send and recv workqueue. Due the fact
      that we accessing configfs items (mark values), these workers will lock
      clusters_root.subsys.su_mutex as well which are already hold by
      dlm_lowcomms_close() and ends in a deadlock situation.
      
      [67170.703046] ======================================================
      [67170.703965] WARNING: possible circular locking dependency detected
      [67170.704758] 5.11.0-rc4+ #22 Tainted: G        W
      [67170.705433] ------------------------------------------------------
      [67170.706228] dlm_controld/280 is trying to acquire lock:
      [67170.706915] ffff9f2f475a6948 ((wq_completion)dlm_recv){+.+.}-{0:0}, at: __flush_work+0x203/0x4c0
      [67170.708026]
                     but task is already holding lock:
      [67170.708758] ffffffffa132f878 (&clusters_root.subsys.su_mutex){+.+.}-{3:3}, at: configfs_rmdir+0x29b/0x310
      [67170.710016]
                     which lock already depends on the new lock.
      
      The new behaviour adds the mark value to the node address configuration
      which doesn't require to held the clusters_root.subsys.su_mutex by
      accessing mark values in a separate datastructure. However the mark
      values can be set now only after a node address was set which is the
      case when the user is using dlm_controld.
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NDavid Teigland <teigland@redhat.com>
      e125fbeb
  6. 11 11月, 2020 11 次提交