From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Cc: jack@suse.cz
Subject: [PATCH 1/3] xfs: ensure buffer types are set correctly
Date: Wed, 21 Jan 2015 11:39:38 +1100 [thread overview]
Message-ID: <1421800780-26008-2-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1421800780-26008-1-git-send-email-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
Jan Kara reported that log recovery was finding buffers with invalid
types in them. This should not happen, and indicates a bug in the
logging of buffers. To catch this, add asserts to the buffer
formatting code to ensure that the buffer type is in range when the
transaction is committed.
We don't set a type on buffers being marked stale - they are not
going to get replayed, the format item exists only for recovery to
be able to prevent replay of the buffer, so the type does not
matter. Hence that needs special casing here.
Reported-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_buf_item.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 925ead2..507d96a 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -319,6 +319,10 @@ xfs_buf_item_format(
ASSERT(atomic_read(&bip->bli_refcount) > 0);
ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
(bip->bli_flags & XFS_BLI_STALE));
+ ASSERT((bip->bli_flags & XFS_BLI_STALE) ||
+ (xfs_blft_from_flags(&bip->__bli_format) > XFS_BLFT_UNKNOWN_BUF
+ && xfs_blft_from_flags(&bip->__bli_format) < XFS_BLFT_MAX_BUF));
+
/*
* If it is an inode buffer, transfer the in-memory state to the
--
2.0.0
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-01-21 0:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-21 0:39 [PATCH 0/3] xfs: buffer types need to be set Dave Chinner
2015-01-21 0:39 ` Dave Chinner [this message]
2015-01-21 22:05 ` [PATCH 1/3] xfs: ensure buffer types are set correctly Brian Foster
2015-01-21 0:39 ` [PATCH 2/3] xfs: inode unlink does not set AGI buffer type Dave Chinner
2015-01-21 22:05 ` Brian Foster
2015-01-21 0:39 ` [PATCH 3/3] xfs: set buf types when converting extent formats Dave Chinner
2015-01-21 22:06 ` Brian Foster
2015-01-21 2:34 ` [PATCH 4/3] xfs: set superblock buffer type correctly Dave Chinner
2015-01-21 22:06 ` Brian Foster
2015-01-21 16:07 ` [PATCH 0/3] xfs: buffer types need to be set Jan Kara
2015-01-21 17:11 ` Jan Kara
2015-01-21 21:12 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1421800780-26008-2-git-send-email-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=jack@suse.cz \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox