]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_buflock: record buffer initialization
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 31 May 2018 19:09:54 +0000 (14:09 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 31 May 2018 19:09:54 +0000 (14:09 -0500)
Buffers are created locked, so we have to factor that into the buffer
state machine that the script utilizes.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
tools/xfsbuflock.py

index 954f0954358297bf2578942fd2ecbc8e5ec69a61..8f38f9f0ae015b05e246243893eb978dd49b1364 100755 (executable)
@@ -91,6 +91,13 @@ class Buffer:
                if not self.locked:
                        self.lockdone(process, time)
 
+       def init(self, process, time):
+               # Buffers are initialized locked, but we could be allocating
+               # a surplus buffer while trying to grab a buffer that may or
+               # may not already exist.
+               if not self.locked:
+                       self.lockdone(process, time)
+
        def lockdone(self, process, time):
                if self.locked:
                        print('Buffer 0x%x already locked at line %d? (line %d)' % \
@@ -183,6 +190,10 @@ for line in fileinput.input():
                buf = getbuf(toks)
                if buf is not None:
                        buf.trylock(proc, time)
+       elif fn == 'xfs_buf_init':
+               buf = getbuf(toks)
+               if buf is not None:
+                       buf.init(proc, time)
        elif fn == 'xfs_buf_item_unlock':
                pass
        else: