From: Bob Peterson Date: Thu, 21 Oct 2010 12:31:35 -0400 (EDT) Subject: [Cluster-devel] GFS2: Don't use trylocks when converting dlm locks In-Reply-To: <1287655650.2946.8.camel@dolmen> Message-ID: <832764809.53481287678695809.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ----- "Steven Whitehouse" wrote: | There is no need to use a try lock when up converting a dlm lock | because | the dlm will return -EDEADLK if the conversion would otherwise result | in | a deadlock. GFS2 can already handle the -EDEADLK return on | conversion. | | This should make GFS2 a bit more efficient when it comes to locking | during contention situations, although tests haven't shown any | measurable improvement so far. Also this is a clean up of the code. | | | Signed-off-by: Steven Whitehouse | | | diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c | index 8777885..41fea85 100644 | --- a/fs/gfs2/glock.c | +++ b/fs/gfs2/glock.c | @@ -590,10 +590,6 @@ __acquires(&gl->gl_spin) | clear_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags); | | gfs2_glock_hold(gl); | - if (target != LM_ST_UNLOCKED && (gl->gl_state == LM_ST_SHARED || | - gl->gl_state == LM_ST_DEFERRED) && | - !(lck_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) | - lck_flags |= LM_FLAG_TRY_1CB; | ret = gfs2_lm_lock(sdp, gl, target, lck_flags); | | if (!(ret & LM_OUT_ASYNC)) { This patch looks good in theory, but for some unknown reason, causes a problem. It seems to open a timing window with gfs2_rename's unlink code: GFS2: fsid=hlab_cluster:svr_home.0: fatal: filesystem consistency error GFS2: fsid=hlab_cluster:svr_home.0: RG = 1376275 GFS2: fsid=hlab_cluster:svr_home.0: function = gfs2_setbit, file = /root/bob/gfs2/rgrp.c, line = 104 GFS2: fsid=hlab_cluster:svr_home.0: about to withdraw this file system GFS2: fsid=hlab_cluster:svr_home.0: telling LM to withdraw PWLPOST.EXE[9371]: segfault at 00000000ff2c3e78 rip 00000000002a6bf3 rsp 00000000ff2c3dd8 error 6 GFS2: fsid=hlab_cluster:svr_home.0: withdrawn Call Trace: [] :gfs2:gfs2_lm_withdraw+0xd1/0xfe [] find_lock_page+0x26/0xa2 [] find_or_create_page+0x22/0x72 [] :gfs2:gfs2_pin+0xb4/0xbc [] :gfs2:gfs2_consist_rgrpd_i+0x34/0x39 [] :gfs2:rgblk_free+0x13a/0x15b [] :gfs2:gfs2_unlink_di+0x25/0x60 [] :gfs2:gfs2_change_nlink+0xf8/0x102 [] :gfs2:gfs2_rename+0x48e/0x67d [] :gfs2:gfs2_rename+0x11c/0x67d [] :gfs2:gfs2_rename+0x162/0x67d [] :gfs2:gfs2_rename+0x187/0x67d [] :gfs2:gfs2_rename+0x1ba/0x67d [] :gfs2:gfs2_glock_schedule_for_reclaim+0x5d/0x9a [] :gfs2:gfs2_glock_put+0xf9/0x111 [] :gfs2:gfs2_rindex_hold+0x32/0x12b [] d_splice_alias+0xdc/0xfb [] permission+0x81/0xc8 [] vfs_rename+0x2f4/0x471 [] sys_renameat+0x180/0x1eb [] audit_syscall_entry+0x1a4/0x1cf [] sysenter_do_call+0x1e/0x76 Instrumentation reveals: cur_state = 0, new_state = 2 block = 0x1506ea i_unlinked: 0x0 So apparently the reclaiming of unlinked dinodes has nothing to do with it. It was trying to change a block from "free" to "unlinked" which is invalid. I'm investigating the problem now. Regards, Bob Peterson Red Hat File Systems