On Thu, Nov 08, 2012 at 10:26:53AM +0000, Steven Whitehouse wrote: > Hi, > > On Wed, 2012-11-07 at 14:14 -0500, David Teigland wrote: > > When unmounting, gfs2 does a full dlm_unlock operation on every > > cached lock. This can create a very large amount of work and can > > take a long time to complete. However, the vast majority of these > > dlm unlock operations are unnecessary because after all the unlocks > > are done, gfs2 leaves the dlm lockspace, which automatically clears > > the locks of the leaving node, without unlocking each one individually. > > So, gfs2 can skip explicit dlm unlocks, and use dlm_release_lockspace to > > remove the locks implicitly. The one exception is when the lock's lvb is > > being used. In this case, dlm_unlock is called because it may update the > > lvb of the resource. > > > > I'm wondering just how much we are likely to gain from this.... we > currently use LVBs for both quota (and more recently) rgrp too. If we > were to start using the LVBs for inodes and/or iopen locks eventually > then that would seem to rather reduce the benefits of this.
Considering what you say below, after you've converted to NL, there's no more lvb to consider, so the lvb is not an issue in that case. The lvb is only written if you're unlocking from PW or EX, so there's bound to always be many unlocks that could be skipped. I'll adjust the patch to skip unlock unless there's an lvb and the mode is PW or EX. > The other question is what the cost of conversion to NL vs unlock of an > NL lock is. Even with the patch we are still iterating over each lock to > do a conversion to NL in any case where the lock is not already in NL. > So all we are saving is the final NL -> unlocked change. yeah, I'd forgotten about that. > One thought is whether it would not be better to do a direct "whatever" > -> unlocked change in the first place, rather than splitting the > operation into two parts. Converting to NL would actually be less expensive than unlock because the NL convert does not involve a reply message, but unlock does. So skipping the unlocks is a first step that gives us a big benefit very simply. To benefit even further, we could later look into skipping the "convert to NL" step also, and just abandoning the dlm locks in whatever mode they're in; but that's probably not as simple a change.