1. 25 10月, 2021 8 次提交
  2. 21 10月, 2021 2 次提交
    • B
      gfs2: Introduce flag for glock holder auto-demotion · dc732906
      Bob Peterson 提交于
      This patch introduces a new HIF_MAY_DEMOTE flag and infrastructure that
      will allow glocks to be demoted automatically on locking conflicts.
      When a locking request comes in that isn't compatible with the locking
      state of an active holder and that holder has the HIF_MAY_DEMOTE flag
      set, the holder will be demoted before the incoming locking request is
      granted.
      
      Note that this mechanism demotes active holders (with the HIF_HOLDER
      flag set), while before we were only demoting glocks without any active
      holders.  This allows processes to keep hold of locks that may form a
      cyclic locking dependency; the core glock logic will then break those
      dependencies in case a conflicting locking request occurs.  We'll use
      this to avoid giving up the inode glock proactively before faulting in
      pages.
      
      Processes that allow a glock holder to be taken away indicate this by
      calling gfs2_holder_allow_demote(), which sets the HIF_MAY_DEMOTE flag.
      Later, they call gfs2_holder_disallow_demote() to clear the flag again,
      and then they check if their holder is still queued: if it is, they are
      still holding the glock; if it isn't, they can re-acquire the glock (or
      abort).
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      dc732906
    • A
      gfs2: Clean up function may_grant · 61444649
      Andreas Gruenbacher 提交于
      Pass the first current glock holder into function may_grant and
      deobfuscate the logic there.
      
      While at it, switch from BUG_ON to GLOCK_BUG_ON in may_grant.  To make
      that build cleanly, de-constify the may_grant arguments.
      
      We're now using function find_first_holder in do_promote, so move the
      function's definition above do_promote.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      61444649
  3. 20 8月, 2021 2 次提交
  4. 28 6月, 2021 1 次提交
  5. 31 5月, 2021 1 次提交
  6. 20 5月, 2021 2 次提交
    • B
      gfs2: fix a deadlock on withdraw-during-mount · 865cc3e9
      Bob Peterson 提交于
      Before this patch, gfs2 would deadlock because of the following
      sequence during mount:
      
      mount
         gfs2_fill_super
            gfs2_make_fs_rw <--- Detects IO error with glock
               kthread_stop(sdp->sd_quotad_process);
                  <--- Blocked waiting for quotad to finish
      
      logd
         Detects IO error and the need to withdraw
         calls gfs2_withdraw
            gfs2_make_fs_ro
               kthread_stop(sdp->sd_quotad_process);
                  <--- Blocked waiting for quotad to finish
      
      gfs2_quotad
         gfs2_statfs_sync
            gfs2_glock_wait <---- Blocked waiting for statfs glock to be granted
      
      glock_work_func
         do_xmote <---Detects IO error, can't release glock: blocked on withdraw
            glops->go_inval
            glock_blocked_by_withdraw
               requeue glock work & exit <--- work requeued, blocked by withdraw
      
      This patch makes a special exception for the statfs system inode glock,
      which allows the statfs glock UNLOCK to proceed normally. That allows the
      quotad daemon to exit during the withdraw, which allows the logd daemon
      to exit during the withdraw, which allows the mount to exit.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      865cc3e9
    • B
      gfs2: fix scheduling while atomic bug in glocks · 20265d9a
      Bob Peterson 提交于
      Before this patch, in the unlikely event that gfs2_glock_dq encountered
      a withdraw, it would do a wait_on_bit to wait for its journal to be
      recovered, but it never released the glock's spin_lock, which caused a
      scheduling-while-atomic error.
      
      This patch unlocks the lockref spin_lock before waiting for recovery.
      
      Fixes: 601ef0d5 ("gfs2: Force withdraw to replay journals and wait for it to finish")
      Cc: stable@vger.kernel.org # v5.7+
      Reported-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      20265d9a
  7. 06 5月, 2021 1 次提交
  8. 10 4月, 2021 1 次提交
  9. 09 4月, 2021 1 次提交
  10. 04 4月, 2021 1 次提交
  11. 18 2月, 2021 1 次提交
    • B
      gfs2: Allow node-wide exclusive glock sharing · 06e908cd
      Bob Peterson 提交于
      Introduce a new LM_FLAG_NODE_SCOPE glock holder flag: when taking a
      glock in LM_ST_EXCLUSIVE (EX) mode and with the LM_FLAG_NODE_SCOPE flag
      set, the exclusive lock is shared among all local processes who are
      holding the glock in EX mode and have the LM_FLAG_NODE_SCOPE flag set.
      From the point of view of other nodes, the lock is still held
      exclusively.
      
      A future patch will start using this flag to improve performance with
      rgrp sharing.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      06e908cd
  12. 01 12月, 2020 1 次提交
  13. 25 11月, 2020 1 次提交
    • A
      gfs2: set lockdep subclass for iopen glocks · 515b269d
      Alexander Aring 提交于
      This patch introduce a new globs attribute to define the subclass of the
      glock lockref spinlock. This avoid the following lockdep warning, which
      occurs when we lock an inode lock while an iopen lock is held:
      
      ============================================
      WARNING: possible recursive locking detected
      5.10.0-rc3+ #4990 Not tainted
      --------------------------------------------
      kworker/0:1/12 is trying to acquire lock:
      ffff9067d45672d8 (&gl->gl_lockref.lock){+.+.}-{3:3}, at: lockref_get+0x9/0x20
      
      but task is already holding lock:
      ffff9067da308588 (&gl->gl_lockref.lock){+.+.}-{3:3}, at: delete_work_func+0x164/0x260
      
      other info that might help us debug this:
       Possible unsafe locking scenario:
      
             CPU0
             ----
        lock(&gl->gl_lockref.lock);
        lock(&gl->gl_lockref.lock);
      
       *** DEADLOCK ***
      
       May be due to missing lock nesting notation
      
      3 locks held by kworker/0:1/12:
       #0: ffff9067c1bfdd38 ((wq_completion)delete_workqueue){+.+.}-{0:0}, at: process_one_work+0x1b7/0x540
       #1: ffffac594006be70 ((work_completion)(&(&gl->gl_delete)->work)){+.+.}-{0:0}, at: process_one_work+0x1b7/0x540
       #2: ffff9067da308588 (&gl->gl_lockref.lock){+.+.}-{3:3}, at: delete_work_func+0x164/0x260
      
      stack backtrace:
      CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.10.0-rc3+ #4990
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014
      Workqueue: delete_workqueue delete_work_func
      Call Trace:
       dump_stack+0x8b/0xb0
       __lock_acquire.cold+0x19e/0x2e3
       lock_acquire+0x150/0x410
       ? lockref_get+0x9/0x20
       _raw_spin_lock+0x27/0x40
       ? lockref_get+0x9/0x20
       lockref_get+0x9/0x20
       delete_work_func+0x188/0x260
       process_one_work+0x237/0x540
       worker_thread+0x4d/0x3b0
       ? process_one_work+0x540/0x540
       kthread+0x127/0x140
       ? __kthread_bind_mask+0x60/0x60
       ret_from_fork+0x22/0x30
      Suggested-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: NAlexander Aring <aahringo@redhat.com>
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      515b269d
  14. 03 11月, 2020 1 次提交
  15. 21 10月, 2020 2 次提交
  16. 15 10月, 2020 3 次提交
  17. 03 8月, 2020 2 次提交
  18. 30 6月, 2020 1 次提交
    • A
      gfs2: Don't sleep during glock hash walk · 34244d71
      Andreas Gruenbacher 提交于
      In flush_delete_work, instead of flushing each individual pending
      delayed work item, cancel and re-queue them for immediate execution.
      The waiting isn't needed here because we're already waiting for all
      queued work items to complete in gfs2_flush_delete_work.  This makes the
      code more efficient, but more importantly, it avoids sleeping during a
      rhashtable walk, inside rcu_read_lock().
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      34244d71
  19. 06 6月, 2020 8 次提交