diff mbox

[3/4] xfs_buflock: record buffer initialization

Message ID 152579745264.10641.2185681161388795019.stgit@magnolia (mailing list archive)
State Accepted
Headers show

Commit Message

Darrick J. Wong May 8, 2018, 4:37 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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>
---
 tools/xfsbuflock.py |   11 +++++++++++
 1 file changed, 11 insertions(+)



--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tools/xfsbuflock.py b/tools/xfsbuflock.py
index 954f0954..8f38f9f0 100755
--- a/tools/xfsbuflock.py
+++ b/tools/xfsbuflock.py
@@ -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: