[ Pobierz całość w formacie PDF ]
G: s:EX n:3/258028 f:yI t:EX d:EX/0 a:3 r:4
H: s:EX f:tH e:0 p:4466 [postmark] gfs2_inplace_reserve_i+0x177/0x780 [gfs2]
R: n:258028 f:05 b:22256/22256 i:16800
G: s:EX n:2/219916 f:yfI t:EX d:EX/0 a:0 r:3
I: n:75661/219916 t:8 f:0x10 d:0x00000000 s:7522/7522
G: s:SH n:5/127205 f:I t:SH d:EX/0 a:0 r:3
H: s:SH f:EH e:0 p:4466 [postmark] gfs2_inode_lookup+0x14e/0x260 [gfs2]
G: s:EX n:2/50382 f:yfI t:EX d:EX/0 a:0 r:2
G: s:SH n:5/302519 f:I t:SH d:EX/0 a:0 r:3
H: s:SH f:EH e:0 p:4466 [postmark] gfs2_inode_lookup+0x14e/0x260 [gfs2]
G: s:SH n:5/313874 f:I t:SH d:EX/0 a:0 r:3
H: s:SH f:EH e:0 p:4466 [postmark] gfs2_inode_lookup+0x14e/0x260 [gfs2]
G: s:SH n:5/271916 f:I t:SH d:EX/0 a:0 r:3
H: s:SH f:EH e:0 p:4466 [postmark] gfs2_inode_lookup+0x14e/0x260 [gfs2]
G: s:SH n:5/312732 f:I t:SH d:EX/0 a:0 r:3
H: s:SH f:EH e:0 p:4466 [postmark] gfs2_inode_lookup+0x14e/0x260 [gfs2]
The above example is a series of excerpts (from an approximately 18MB file) generated by the
command cat /sys/kernel/debug/gfs2/unity:myfs/glocks >my.lock during a run of the
postmark benchmark on a single node GFS2 file system. The glocks in the figure have been selected in
order to show some of the more interesting features of the glock dumps.
The glock states are either EX (exclusive), DF (deferred), SH (shared) or UN (unlocked). These states
correspond directly with DLM lock modes except for UN which may represent either the DLM null lock
state, or that GFS2 does not hold a DLM lock (depending on the I flag as explained above). The s: field
of the glock indicates the current state of the lock and the same field in the holder indicates the
requested mode. If the lock is granted, the holder will have the H bit set in its flags (f: field). Otherwise, it
will have the W wait bit set.
The n: field (number) indicates the number associated with each item. For glocks, that is the type number
followed by the glock number so that in the above example, the first glock is n:5/75320; that is, an iopen
glock which relates to inode 75320. In the case of inode and iopen glocks, the glock number is always
identical to the inode's disk block number.
Note
The glock numbers (n: field) in the debugfs glocks file are in hexadecimal, whereas the
tracepoints output lists them in decimal. This is for historical reasons; glock numbers were always
written in hex, but decimal was chosen for the tracepoints so that the numbers could easily be
compared with the other tracepoint output (from blktrace for example) and with output from
stat(1).
The full listing of all the flags for both the holder and the glock are set out in Table C.4, Glock flags and
Table C.5, Glock holder flags . The content of lock value blocks is not currently available via the glock
debugfs interface.
Table C.3, Glock types shows the meanings of the different glock types.
71
Red Hat Enterprise Linux 6 Global File System 2
Table C.3. Glock types
Type Lock type Use
number
1 trans Transaction lock
2 inode Inode metadata and data
3 rgrp Resource group metadata
4 meta The superblock
5 iopen Inode last closer detection
6 flock flock(2) syscall
8 quota Quota operations
9 journal Journal mutex
One of the more important glock flags is the l (locked) flag. This is the bit lock that is used to arbitrate
access to the glock state when a state change is to be performed. It is set when the state machine is
about to send a remote lock request via the DLM, and only cleared when the complete operation has
been performed. Sometimes this can mean that more than one lock request will have been sent, with
various invalidations occurring between times.
Table C.4, Glock flags shows the meanings of the different glock flags.
Table C.4 . Glock flags
Flag Name Meaning
d Pending demote A deferred (remote) demote request
D Demote A demote request (local or remote)
f Log flush The log needs to be committed before releasing this glock
F Frozen Replies from remote nodes ignored - recovery is in
progress.
i Invalidate in progress In the process of invalidating pages under this glock
I Initial Set when DLM lock is associated with this glock
l Locked The glock is in the process of changing state
p Demote in progress The glock is in the process of responding to a demote
request
r Reply pending Reply received from remote node is awaiting processing
y Dirty Data needs flushing to disk before releasing this glock
When a remote callback is received from a node that wants to get a lock in a mode that conflicts with that
being held on the local node, then one or other of the two flags D (demote) or d (demote pending) is set.
In order to prevent starvation conditions when there is contention on a particular lock, each lock is
assigned a minimum hold time. A node which has not yet had the lock for the minimum hold time is
allowed to retain that lock until the time interval has expired.
If the time interval has expired, then the D (demote) flag will be set and the state required will be
recorded. In that case the next time there are no granted locks on the holders queue, the lock will be
demoted. If the time interval has not expired, then the d (demote pending) flag is set instead. This also
schedules the state machine to clear d (demote pending) and set D (demote) when the minimum hold
time has expired.
72
GFS2 tracepoints and the debugfs glocks File
The I (initial) flag is set when the glock has been assigned a DLM lock. This happens when the glock is
first used and the I flag will then remain set until the glock is finally freed (which the DLM lock is
unlocked).
C.5. Glock Holders
Table C.5, Glock holder flags shows the meanings of the different glock holder flags.
Table C.5. Glock holder flags
Flag Name Meaning
a Async Do not wait for glock result (will poll for result later)
A Any Any compatible lock mode is acceptable
c No cache When unlocked, demote DLM lock immediately
e No expire Ignore subsequent lock cancel requests
E Exact Must have exact lock mode
F First Set when holder is the first to be granted for this lock
H Holder Indicates that requested lock is granted
p Priority Enqueue holder at the head of the queue
[ Pobierz całość w formacie PDF ]