aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2017-05-05 10:43:02 -0400
committerBob Peterson <rpeterso@redhat.com>2017-05-05 15:19:28 -0400
commited17545d01e4a40086f1622c88ce64cc0241cfc2 (patch)
treee3617232b60c723a084e087cb9d431a7247f48be
parentd552a2b9b33eafdb5eb16c643e745deb564dda7f (diff)
GFS2: Allow glocks to be unlocked after withdraw
This bug fixes a regression introduced by patch 0d1c7ae9d8. The intent of the patch was to stop promoting glocks after a file system is withdrawn due to a variety of errors, because doing so results in a BUG(). (You should be able to unmount after a withdraw rather than having the kernel panic.) Unfortunately, it also stopped demotions, so glocks could not be unlocked after withdraw, which means the unmount would hang. This patch allows function do_xmote to demote locks to an unlocked state after a withdraw, but not promote them. Signed-off-by: Bob Peterson <rpeterso@redhat.com>
-rw-r--r--fs/gfs2/glock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 9e81219692c4..959a19ced4d5 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -449,7 +449,8 @@ __acquires(&gl->gl_lockref.lock)
449 unsigned int lck_flags = (unsigned int)(gh ? gh->gh_flags : 0); 449 unsigned int lck_flags = (unsigned int)(gh ? gh->gh_flags : 0);
450 int ret; 450 int ret;
451 451
452 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) 452 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) &&
453 target != LM_ST_UNLOCKED)
453 return; 454 return;
454 lck_flags &= (LM_FLAG_TRY | LM_FLAG_TRY_1CB | LM_FLAG_NOEXP | 455 lck_flags &= (LM_FLAG_TRY | LM_FLAG_TRY_1CB | LM_FLAG_NOEXP |
455 LM_FLAG_PRIORITY); 456 LM_FLAG_PRIORITY);
@@ -486,7 +487,8 @@ __acquires(&gl->gl_lockref.lock)
486 } 487 }
487 else if (ret) { 488 else if (ret) {
488 pr_err("lm_lock ret %d\n", ret); 489 pr_err("lm_lock ret %d\n", ret);
489 GLOCK_BUG_ON(gl, 1); 490 GLOCK_BUG_ON(gl, !test_bit(SDF_SHUTDOWN,
491 &sdp->sd_flags));
490 } 492 }
491 } else { /* lock_nolock */ 493 } else { /* lock_nolock */
492 finish_xmote(gl, target); 494 finish_xmote(gl, target);