An error occurred fetching the project authors.
  1. 29 Jun, 2022 2 commits
    • Andreas Gruenbacher's avatar
      gfs2: Instantiate glocks ouside of glock state engine · 53d69132
      Andreas Gruenbacher authored
      Instantiate glocks outside of the glock state engine: there is no real
      reason for instantiating them inside the glock state engine; it only
      complicates the code.
      
      Instead, instantiate them in gfs2_glock_wait() and gfs2_glock_async_wait()
      using the new gfs2_glock_holder_ready() helper.  On top of that, the only
      other place that acquires a glock without using gfs2_glock_wait() or
      gfs2_glock_async_wait() is gfs2_upgrade_iopen_glock(), so call
      gfs2_glock_holder_ready() there as well.
      
      If a dinode has a pending truncate, the glock-specific instantiate function
      for inodes wakes up the truncate function in the quota daemon.  Waiting for
      the completion of the truncate was previously done by the glock state
      engine, but we now need to wait in inode_go_instantiate().
      
      This also means that gfs2_instantiate() will now no longer return any
      "special" error codes.
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      53d69132
    • Andreas Gruenbacher's avatar
      gfs2: Mark the remaining process-independent glock holders as GL_NOPID · ebdc416c
      Andreas Gruenbacher authored
      Add the GL_NOPID flag for the remaining glock holders which are not
      associated with the current process.
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      ebdc416c
  2. 22 Mar, 2022 1 commit
  3. 15 Feb, 2022 1 commit
    • Andreas Gruenbacher's avatar
      gfs2: gfs2_setattr_size error path fix · 7336905a
      Andreas Gruenbacher authored
      When gfs2_setattr_size() fails, it calls gfs2_rs_delete(ip, NULL) to get
      rid of any reservations the inode may have.  Instead, it should pass in
      the inode's write count as the second parameter to allow
      gfs2_rs_delete() to figure out if the inode has any writers left.
      
      In a next step, there are two instances of gfs2_rs_delete(ip, NULL) left
      where we know that there can be no other users of the inode.  Replace
      those with gfs2_rs_deltree(&ip->i_res) to avoid the unnecessary write
      count check.
      
      With that, gfs2_rs_delete() is only called with the inode's actual write
      count, so get rid of the second parameter.
      
      Fixes: a097dc7e ("GFS2: Make rgrp reservations part of the gfs2_inode structure")
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      7336905a
  4. 04 Dec, 2021 1 commit
  5. 06 Nov, 2021 1 commit
    • Bob Peterson's avatar
      gfs2: release iopen glock early in evict · 49462e2b
      Bob Peterson authored
      Before this patch, evict would clear the iopen glock's gl_object after
      releasing the inode glock.  In the meantime, another process could reuse
      the same block and thus glocks for a new inode.  It would lock the inode
      glock (exclusively), and then the iopen glock (shared).  The shared
      locking mode doesn't provide any ordering against the evict, so by the
      time the iopen glock is reused, evict may not have gotten to setting
      gl_object to NULL.
      
      Fix that by releasing the iopen glock before the inode glock in
      gfs2_evict_inode.
      
      Signed-off-by: Bob Peterson <rpeterso@redhat.com>gl_object
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      49462e2b
  6. 25 Oct, 2021 2 commits
    • Bob Peterson's avatar
      gfs2: Eliminate GIF_INVALID flag · ec1d398d
      Bob Peterson authored
      With the addition of the new GLF_INSTANTIATE_NEEDED flag, the
      GIF_INVALID flag is now redundant. This patch removes it.
      Since inode_instantiate is only called when instantiation is needed,
      the check in inode_instantiate is removed too.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      ec1d398d
    • Bob Peterson's avatar
      gfs2: fix GL_SKIP node_scope problems · f2e70d8f
      Bob Peterson authored
      Before this patch, when a glock was locked, the very first holder on the
      queue would unlock the lockref and call the go_instantiate glops function
      (if one existed), unless GL_SKIP was specified. When we introduced the new
      node-scope concept, we allowed multiple holders to lock glocks in EX mode
      and share the lock.
      
      But node-scope introduced a new problem: if the first holder has GL_SKIP
      and the next one does NOT, since it is not the first holder on the queue,
      the go_instantiate op was not called. Eventually the GL_SKIP holder may
      call the instantiate sub-function (e.g. gfs2_rgrp_bh_get) but there was
      still a window of time in which another non-GL_SKIP holder assumes the
      instantiate function had been called by the first holder. In the case of
      rgrp glocks, this led to a NULL pointer dereference on the buffer_heads.
      
      This patch tries to fix the problem by introducing two new glock flags:
      
      GLF_INSTANTIATE_NEEDED, which keeps track of when the instantiate function
      needs to be called to "fill in" or "read in" the object before it is
      referenced.
      
      GLF_INSTANTIATE_IN_PROG which is used to determine when a process is
      in the process of reading in the object. Whenever a function needs to
      reference the object, it checks the GLF_INSTANTIATE_NEEDED flag, and if
      set, it sets GLF_INSTANTIATE_IN_PROG and calls the glops "go_instantiate"
      function.
      
      As before, the gl_lockref spin_lock is unlocked during the IO operation,
      which may take a relatively long amount of time to complete. While
      unlocked, if another process determines go_instantiate is still needed,
      it sees GLF_INSTANTIATE_IN_PROG is set, and waits for the go_instantiate
      glop operation to be completed. Once GLF_INSTANTIATE_IN_PROG is cleared,
      it needs to check GLF_INSTANTIATE_NEEDED again because the other process's
      go_instantiate operation may not have been successful.
      
      Functions that previously called the instantiate sub-functions now call
      directly into gfs2_instantiate so the new bits are managed properly.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      f2e70d8f
  7. 20 Aug, 2021 3 commits
    • Bob Peterson's avatar
      gfs2: nit: gfs2_drop_inode shouldn't return bool · ba3ca2bc
      Bob Peterson authored
      Today, gfs2_drop_inode can return "false" for an int value.
      I'm sure this was just an oversight. Change to int value.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      ba3ca2bc
    • Bob Peterson's avatar
      gfs2: Don't release and reacquire local statfs bh · 70c11ba8
      Bob Peterson authored
      Before this patch, several functions in gfs2 related to the updating
      of the statfs file used a newly acquired/read buffer_head for the
      local statfs file. This is completely unnecessary, because other nodes
      should never update it. Recreating the buffer is a waste of time.
      
      This patch allows gfs2 to read in the local statefs buffer_head at
      mount time and keep it around until unmount time.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      70c11ba8
    • Bob Peterson's avatar
      gfs2: init system threads before freeze lock · a28dc123
      Bob Peterson authored
      Patch 96b1454f ("gfs2: move freeze glock outside the make_fs_rw and _ro
      functions") changed the gfs2 mount sequence so that it holds the freeze
      lock before calling gfs2_make_fs_rw. Before this patch, gfs2_make_fs_rw
      called init_threads to initialize the quotad and logd threads. That is a
      problem if the system needs to withdraw due to IO errors early in the
      mount sequence, for example, while initializing the system statfs inode:
      
      1. An IO error causes the statfs glock to not sync properly after
         recovery, and leaves items on the ail list.
      2. The leftover items on the ail list causes its do_xmote call to fail,
         which makes it want to withdraw. But since the glock code cannot
         withdraw (because the withdraw sequence uses glocks) it relies upon
         the logd daemon to initiate the withdraw.
      3. The withdraw can never be performed by the logd daemon because all
         this takes place before the logd daemon is started.
      
      This patch moves function init_threads from super.c to ops_fstype.c
      and it changes gfs2_fill_super to start its threads before holding the
      freeze lock, and if there's an error, stop its threads after releasing
      it. This allows the logd to run unblocked by the freeze lock. Thus,
      the logd daemon can perform its withdraw sequence properly.
      
      Fixes: 96b1454f ("gfs2: move freeze glock outside the make_fs_rw and _ro functions")
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      a28dc123
  8. 09 Apr, 2021 1 commit
    • Lee Jones's avatar
      gfs2: Fix a number of kernel-doc warnings · c551f66c
      Lee Jones authored
      Building the kernel with W=1 results in a number of kernel-doc warnings
      like incorrect function names and parameter descriptions.  Fix those,
      mostly by adding missing parameter descriptions, removing left-over
      descriptions, and demoting some less important kernel-doc comments into
      regular comments.
      
      Originally proposed by Lee Jones; improved and combined into a single
      patch by Andreas.
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      c551f66c
  9. 25 Mar, 2021 1 commit
    • Bob Peterson's avatar
      gfs2: report "already frozen/thawed" errors · ff132c5f
      Bob Peterson authored
      Before this patch, gfs2's freeze function failed to report an error
      when the target file system was already frozen as it should (and as
      generic vfs function freeze_super does. Similarly, gfs2's thaw function
      failed to report an error when trying to thaw a file system that is not
      frozen, as vfs function thaw_super does. The errors were checked, but
      it always returned a 0 return code.
      
      This patch adds the missing error return codes to gfs2 freeze and thaw.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      ff132c5f
  10. 15 Mar, 2021 1 commit
    • Andrew Price's avatar
      gfs2: Flag a withdraw if init_threads() fails · 62dd0f98
      Andrew Price authored
      Interrupting mount with ^C quickly enough can cause the kthread_run()
      calls in gfs2's init_threads() to fail and the error path leads to a
      deadlock on the s_umount rwsem. The abridged chain of events is:
      
        [mount path]
        get_tree_bdev()
          sget_fc()
            alloc_super()
              down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING); [acquired]
          gfs2_fill_super()
            gfs2_make_fs_rw()
              init_threads()
                kthread_run()
                  ( Interrupted )
            [Error path]
            gfs2_gl_hash_clear()
              flush_workqueue(glock_workqueue)
                wait_for_completion()
      
        [workqueue context]
        glock_work_func()
          run_queue()
            do_xmote()
              freeze_go_sync()
                freeze_super()
                  down_write(&sb->s_umount) [deadlock]
      
      In freeze_go_sync() there is a gfs2_withdrawn() check that we can use to
      make sure freeze_super() is not called in the error path, so add a
      gfs2_withdraw_delayed() call when init_threads() fails.
      
      Ref: https://bugzilla.kernel.org/show_bug.cgi?id=212231Reported-by: default avatarAlexander Aring <aahringo@redhat.com>
      Signed-off-by: default avatarAndrew Price <anprice@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      62dd0f98
  11. 07 Mar, 2021 1 commit
  12. 17 Feb, 2021 1 commit
  13. 03 Feb, 2021 1 commit
    • Andreas Gruenbacher's avatar
      gfs2: Get rid of sd_reserving_log · f3708fb5
      Andreas Gruenbacher authored
      This counter and the associated wait queue are only used so that
      gfs2_make_fs_ro can efficiently wait for all pending log space
      allocations to fail after setting the filesystem to read-only.  This
      comes at the cost of waking up that wait queue very frequently.
      
      Instead, when gfs2_log_reserve fails because the filesystem has become
      read-only, Wake up sd_log_waitq.  In gfs2_make_fs_ro, set the file
      system read-only and then wait until all the log space has been
      released.  Give up and report the problem after a while.  With that,
      sd_reserving_log and sd_reserving_log_wait can be removed.
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      f3708fb5
  14. 19 Jan, 2021 1 commit
  15. 13 Jan, 2021 1 commit
  16. 22 Dec, 2020 2 commits
    • Bob Peterson's avatar
      gfs2: move freeze glock outside the make_fs_rw and _ro functions · 96b1454f
      Bob Peterson authored
      Before this patch, sister functions gfs2_make_fs_rw and gfs2_make_fs_ro locked
      (held) the freeze glock by calling gfs2_freeze_lock and gfs2_freeze_unlock.
      The problem is, not all the callers of gfs2_make_fs_ro should be doing this.
      The three callers of gfs2_make_fs_ro are: remount (gfs2_reconfigure),
      signal_our_withdraw, and unmount (gfs2_put_super). But when unmounting the
      file system we can get into the following circular lock dependency:
      
      deactivate_super
         down_write(&s->s_umount); <-------------------------------------- s_umount
         deactivate_locked_super
            gfs2_kill_sb
               kill_block_super
                  generic_shutdown_super
                     gfs2_put_super
                        gfs2_make_fs_ro
                           gfs2_glock_nq_init sd_freeze_gl
                              freeze_go_sync
                                 if (freeze glock in SH)
                                    freeze_super (vfs)
                                       down_write(&sb->s_umount); <------- s_umount
      
      This patch moves the hold of the freeze glock outside the two sister rw/ro
      functions to their callers, but it doesn't request the glock from
      gfs2_put_super, thus eliminating the circular dependency.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      96b1454f
    • Bob Peterson's avatar
      gfs2: Add common helper for holding and releasing the freeze glock · c77b52c0
      Bob Peterson authored
      Many places in the gfs2 code queued and dequeued the freeze glock.
      Almost all of them acquire it in SHARED mode, and need to specify the
      same LM_FLAG_NOEXP and GL_EXACT flags.
      
      This patch adds common helper functions gfs2_freeze_lock and gfs2_freeze_unlock
      to make the code more readable, and to prepare for the next patch.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      c77b52c0
  17. 03 Dec, 2020 1 commit
  18. 29 Oct, 2020 1 commit
  19. 23 Oct, 2020 1 commit
  20. 20 Oct, 2020 1 commit
  21. 14 Oct, 2020 7 commits
    • Jamie Iles's avatar
      gfs2: use-after-free in sysfs deregistration · c2a04b02
      Jamie Iles authored
      syzkaller found the following splat with CONFIG_DEBUG_KOBJECT_RELEASE=y:
      
        Read of size 1 at addr ffff000028e896b8 by task kworker/1:2/228
      
        CPU: 1 PID: 228 Comm: kworker/1:2 Tainted: G S                5.9.0-rc8+ #101
        Hardware name: linux,dummy-virt (DT)
        Workqueue: events kobject_delayed_cleanup
        Call trace:
         dump_backtrace+0x0/0x4d8
         show_stack+0x34/0x48
         dump_stack+0x174/0x1f8
         print_address_description.constprop.0+0x5c/0x550
         kasan_report+0x13c/0x1c0
         __asan_report_load1_noabort+0x34/0x60
         memcmp+0xd0/0xd8
         gfs2_uevent+0xc4/0x188
         kobject_uevent_env+0x54c/0x1240
         kobject_uevent+0x2c/0x40
         __kobject_del+0x190/0x1d8
         kobject_delayed_cleanup+0x2bc/0x3b8
         process_one_work+0x96c/0x18c0
         worker_thread+0x3f0/0xc30
         kthread+0x390/0x498
         ret_from_fork+0x10/0x18
      
        Allocated by task 1110:
         kasan_save_stack+0x28/0x58
         __kasan_kmalloc.isra.0+0xc8/0xe8
         kasan_kmalloc+0x10/0x20
         kmem_cache_alloc_trace+0x1d8/0x2f0
         alloc_super+0x64/0x8c0
         sget_fc+0x110/0x620
         get_tree_bdev+0x190/0x648
         gfs2_get_tree+0x50/0x228
         vfs_get_tree+0x84/0x2e8
         path_mount+0x1134/0x1da8
         do_mount+0x124/0x138
         __arm64_sys_mount+0x164/0x238
         el0_svc_common.constprop.0+0x15c/0x598
         do_el0_svc+0x60/0x150
         el0_svc+0x34/0xb0
         el0_sync_handler+0xc8/0x5b4
         el0_sync+0x15c/0x180
      
        Freed by task 228:
         kasan_save_stack+0x28/0x58
         kasan_set_track+0x28/0x40
         kasan_set_free_info+0x24/0x48
         __kasan_slab_free+0x118/0x190
         kasan_slab_free+0x14/0x20
         slab_free_freelist_hook+0x6c/0x210
         kfree+0x13c/0x460
      
      Use the same pattern as f2fs + ext4 where the kobject destruction must
      complete before allowing the FS itself to be freed.  This means that we
      need an explicit free_sbd in the callers.
      
      Cc: Bob Peterson <rpeterso@redhat.com>
      Cc: Andreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: default avatarJamie Iles <jamie@nuviainc.com>
      [Also go to fail_free when init_names fails.]
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      c2a04b02
    • Bob Peterson's avatar
      gfs2: simplify the logic in gfs2_evict_inode · 0a0d9f55
      Bob Peterson authored
      Now that we've factored out the deleted and undeleted dinode cases
      in gfs2_evict_inode, we can greatly simplify the logic. Now the
      function is easy to read and understand.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      0a0d9f55
    • Bob Peterson's avatar
      gfs2: factor evict_linked_inode out of gfs2_evict_inode · d90be6ab
      Bob Peterson authored
      Now that we've factored out the delete-dinode case to simplify
      gfs2_evict_inode, we take it a step further and factor out the other
      case: where we don't delete the inode.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      d90be6ab
    • Bob Peterson's avatar
      gfs2: further simplify gfs2_evict_inode with new func evict_should_delete · 53dbc27e
      Bob Peterson authored
      This patch further simplifies function gfs2_evict_inode() by adding a
      new function evict_should_delete. The function may also lock the inode
      glock.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      53dbc27e
    • Bob Peterson's avatar
      gfs2: factor evict_unlinked_inode out of gfs2_evict_inode · 6e7e9a50
      Bob Peterson authored
      Function gfs2_evict_inode is way too big, complex and unreadable. This
      is a baby step toward breaking it apart to be more readable. It factors
      out the portion that deletes the online bits for a dinode that is
      unlinked and needs to be deleted. A future patch will factor out more.
      (If I factor out too much, the patch itself becomes unreadable).
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      6e7e9a50
    • Bob Peterson's avatar
      gfs2: rename variable error to ret in gfs2_evict_inode · 23d828fc
      Bob Peterson authored
      Function gfs2_evict_inode is too big and unreadable. This patch is just
      a baby step toward improving that. This first step just renames variable
      error to ret. This will help make future patches more readable.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      23d828fc
    • Andreas Gruenbacher's avatar
      gfs2: Make sure we don't miss any delayed withdraws · 5a61ae14
      Andreas Gruenbacher authored
      Commit ca399c96 changes gfs2_log_flush to not withdraw the
      filesystem while holding the log flush lock, but it fails to check if
      the filesystem needs to be withdrawn once the log flush lock has been
      released.  Likewise, commit f05b86db depends on gfs2_log_flush to
      trigger for delayed withdraws.  Add that and clean up the code flow
      somewhat.
      
      In gfs2_put_super, add a check for delayed withdraws that have been
      missed to prevent these kinds of bugs in the future.
      
      Fixes: ca399c96 ("gfs2: flesh out delayed withdraw for gfs2_log_flush")
      Fixes: f05b86db ("gfs2: Prepare to withdraw as soon as an IO error occurs in log write")
      Cc: stable@vger.kernel.org # v5.7+: 462582b9: gfs2: add some much needed cleanup for log flushes that fail
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      5a61ae14
  22. 07 Aug, 2020 1 commit
  23. 03 Jul, 2020 2 commits
    • Bob Peterson's avatar
      gfs2: The freeze glock should never be frozen · c860f8ff
      Bob Peterson authored
      Before this patch, some gfs2 code locked the freeze glock with LM_FLAG_NOEXP
      (Do not freeze) flag, and some did not. We never want to freeze the freeze
      glock, so this patch makes it consistently use LM_FLAG_NOEXP always.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      c860f8ff
    • Bob Peterson's avatar
      gfs2: When freezing gfs2, use GL_EXACT and not GL_NOCACHE · 623ba664
      Bob Peterson authored
      Before this patch, the freeze code in gfs2 specified GL_NOCACHE in
      several places. That's wrong because we always want to know the state
      of whether the file system is frozen.
      
      There was also a problem with freeze/thaw transitioning the glock from
      frozen (EX) to thawed (SH) because gfs2 will normally grant glocks in EX
      to processes that request it in SH mode, unless GL_EXACT is specified.
      Therefore, the freeze/thaw code, which tried to reacquire the glock in
      SH mode would get the glock in EX mode, and miss the transition from EX
      to SH. That made it think the thaw had completed normally, but since the
      glock was still cached in EX, other nodes could not freeze again.
      
      This patch removes the GL_NOCACHE flag to allow the freeze glock to be
      cached. It also adds the GL_EXACT flag so the glock is fully transitioned
      from EX to SH, thereby allowing future freeze operations.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      623ba664
  24. 05 Jun, 2020 5 commits
    • Andreas Gruenbacher's avatar
      gfs2: Smarter iopen glock waiting · 9e8990de
      Andreas Gruenbacher authored
      When trying to upgrade the iopen glock from a shared to an exclusive lock in
      gfs2_evict_inode, abort the wait if there is contention on the corresponding
      inode glock: in that case, the inode must still be in active use on another
      node, and we're not guaranteed to get the iopen glock anytime soon.
      
      To make this work even better, when we notice contention on the iopen glock and
      we can't evict the corresponsing inode and release the iopen glock immediately,
      poke the inode glock.  The other node(s) trying to acquire the lock can then
      abort instead of timing out.
      
      Thanks to Heinz Mauelshagen for pointing out a locking bug in a previous
      version of this patch.
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      9e8990de
    • Andreas Gruenbacher's avatar
      gfs2: Try harder to delete inodes locally · 9e73330f
      Andreas Gruenbacher authored
      When an inode's link count drops to zero and the inode is cached on
      other nodes, the current behavior of gfs2 is to immediately give up and
      to rely on the other node(s) to delete the inode if there is iopen glock
      contention.  This leads to resource group glock bouncing and the loss of
      caching.  With the previous patches in place, we can fix that by not
      giving up immediately.
      
      When the inode is still open on other nodes, those nodes won't be able
      to evict the inode and give up the iopen glock.  In that case, our lock
      conversion request will time out.  The unlink system call will block for
      the duration of the iopen lock conversion request.  We're also holding
      the inode glock in EX mode for an extended duration, so other nodes
      won't be able to make progress on the inode, either.
      
      This is worse than what we had before, but we can prevent other nodes
      from getting stuck by aborting our iopen locking request if there is
      contention on the inode glock.  This will the the subject of a future
      patch.
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      9e73330f
    • Andreas Gruenbacher's avatar
      gfs2: Give up the iopen glock on contention · 8c7b9262
      Andreas Gruenbacher authored
      When there's contention on the iopen glock, it means that the link count
      of the corresponding inode has dropped to zero on a remote node which is
      now trying to delete the inode.  In that case, try to evict the inode so
      that the iopen glock will be released, which will allow the remote node
      to do its job.
      
      When the inode is still open locally, the inode's reference count won't
      drop to zero and so we'll keep holding the inode and its iopen glock.
      The remote node will time out its request to grab the iopen glock, and
      when the inode is finally closed locally, we'll try to delete it
      ourself.
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      8c7b9262
    • Andreas Gruenbacher's avatar
      gfs2: Turn gl_delete into a delayed work · a0e3cc65
      Andreas Gruenbacher authored
      This requires flushing delayed work items in gfs2_make_fs_ro (which is called
      before unmounting a filesystem).
      
      When inodes are deleted and then recreated, pending gl_delete work items would
      have no effect because the inode generations will have changed, so we can
      cancel any pending gl_delete works before reusing iopen glocks.
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      a0e3cc65
    • Andreas Gruenbacher's avatar
      gfs2: Keep track of deleted inode generations in LVBs · f286d627
      Andreas Gruenbacher authored
      When deleting an inode, keep track of the generation of the deleted inode in
      the inode glock Lock Value Block (LVB).  When trying to delete an inode
      remotely, check the last-known inode generation against the deleted inode
      generation to skip duplicate remote deletes.  This avoids taking the resource
      group glock in order to verify the block type.
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      f286d627