Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "gfs2: fix infinite loop when checking ail item count before go_inval"

The current withdraw code duplicates the journal recovery code gfs2
already has for dealing with node failures, and it does so poorly. That
code was added because when releasing a lockspace, we didn't have a way
to indicate that the lockspace needs recovery. We now do have this
feature, so the current withdraw code can be removed almost entirely.
This is one of several steps towards that.

Reverts commit 33dbd1e41a1d ("gfs2: fix infinite loop when checking ail
item count before go_inval").

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>

+4 -16
+1 -16
fs/gfs2/glock.c
··· 678 678 goto skip_inval; 679 679 } 680 680 681 - if (target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) { 682 - /* 683 - * The call to go_sync should have cleared out the ail list. 684 - * If there are still items, we have a problem. We ought to 685 - * withdraw, but we can't because the withdraw code also uses 686 - * glocks. Warn about the error, dump the glock, then fall 687 - * through and wait for logd to do the withdraw for us. 688 - */ 689 - if ((atomic_read(&gl->gl_ail_count) != 0) && 690 - (!cmpxchg(&sdp->sd_log_error, 0, -EIO))) { 691 - gfs2_glock_assert_warn(gl, 692 - !atomic_read(&gl->gl_ail_count)); 693 - gfs2_dump_glock(NULL, gl, true); 694 - gfs2_withdraw(sdp); 695 - } 681 + if (target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) 696 682 glops->go_inval(gl, target == LM_ST_DEFERRED ? 0 : DIO_METADATA); 697 - } 698 683 spin_lock(&gl->gl_lockref.lock); 699 684 700 685 skip_inval:
+3
fs/gfs2/glops.c
··· 232 232 end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1; 233 233 gfs2_rgrp_brelse(rgd); 234 234 WARN_ON_ONCE(!(flags & DIO_METADATA)); 235 + gfs2_assert_withdraw(sdp, !atomic_read(&gl->gl_ail_count)); 235 236 truncate_inode_pages_range(mapping, start, end); 236 237 } 237 238 ··· 358 357 static void inode_go_inval(struct gfs2_glock *gl, int flags) 359 358 { 360 359 struct gfs2_inode *ip = gfs2_glock2inode(gl); 360 + 361 + gfs2_assert_withdraw(gl->gl_name.ln_sbd, !atomic_read(&gl->gl_ail_count)); 361 362 362 363 if (flags & DIO_METADATA) { 363 364 struct address_space *mapping = gfs2_glock2aspace(gl);