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

GFS2: Instruct DLM to avoid queue convert slowdown

This patch instructs DLM to prevent an "in place" conversion, where the
lock just stays on the granted queue, and instead forces the conversion to
the back of the convert queue. This is done on upward conversions only.

This is useful in cases where, for example, a lock is frequently needed in
PR on one node, but another node needs it temporarily in EX to update it.
This may happen, for example, when the rindex is being updated by gfs2_grow.
The gfs2_grow needs to have the lock in EX, but the other nodes need to
re-read it to retrieve the updates. The glock is already granted in PR on
the non-growing nodes, so this prevents them from continually re-granting
the lock in PR, and forces the EX from gfs2_grow to go through.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

authored by

Bob Peterson and committed by
Steven Whitehouse
4c569a72 95f71472

+7 -3
+7 -3
fs/gfs2/lock_dlm.c
··· 200 200 return -1; 201 201 } 202 202 203 - static u32 make_flags(const u32 lkid, const unsigned int gfs_flags, 203 + static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags, 204 204 const int req) 205 205 { 206 206 u32 lkf = DLM_LKF_VALBLK; 207 + u32 lkid = gl->gl_lksb.sb_lkid; 207 208 208 209 if (gfs_flags & LM_FLAG_TRY) 209 210 lkf |= DLM_LKF_NOQUEUE; ··· 228 227 BUG(); 229 228 } 230 229 231 - if (lkid != 0) 230 + if (lkid != 0) { 232 231 lkf |= DLM_LKF_CONVERT; 232 + if (test_bit(GLF_BLOCKING, &gl->gl_flags)) 233 + lkf |= DLM_LKF_QUECVT; 234 + } 233 235 234 236 return lkf; 235 237 } ··· 254 250 char strname[GDLM_STRNAME_BYTES] = ""; 255 251 256 252 req = make_mode(req_state); 257 - lkf = make_flags(gl->gl_lksb.sb_lkid, flags, req); 253 + lkf = make_flags(gl, flags, req); 258 254 gfs2_glstats_inc(gl, GFS2_LKS_DCOUNT); 259 255 gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT); 260 256 if (gl->gl_lksb.sb_lkid) {