From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 4/5] btrfs-progs: original check: Add dev_item check for used bytes and total bytes
Date: Mon, 8 Oct 2018 18:44:35 +0800 [thread overview]
Message-ID: <20181008104436.19267-5-wqu@suse.com> (raw)
In-Reply-To: <20181008104436.19267-1-wqu@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
check/main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/check/main.c b/check/main.c
index ff9a785ce555..12f12e18a83f 100644
--- a/check/main.c
+++ b/check/main.c
@@ -7938,6 +7938,12 @@ static int check_device_used(struct device_record *dev_rec,
struct device_extent_record *dev_extent_rec;
u64 total_byte = 0;
+ if (dev_rec->byte_used > dev_rec->total_byte) {
+ error("device %llu has incorrect used bytes %llu > total bytes %llu",
+ dev_rec->devid, dev_rec->byte_used, dev_rec->total_byte);
+ return -EUCLEAN;
+ }
+
cache = search_cache_extent2(&dext_cache->tree, dev_rec->devid, 0);
while (cache) {
dev_extent_rec = container_of(cache,
--
2.19.1
next prev parent reply other threads:[~2018-10-08 10:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-08 10:44 [PATCH v2 0/5] btrfs-progs: check: Detect invalid dev extents and device items Qu Wenruo
2018-10-08 10:44 ` [PATCH v2 1/5] btrfs-progs: lowmem check: Add check for overlapping dev extents Qu Wenruo
2018-10-08 10:44 ` [PATCH v2 2/5] btrfs-progs: original check: Add ability to detect bad " Qu Wenruo
2018-10-08 10:44 ` [PATCH v2 3/5] btrfs-progs: lowmem check: Add dev_item check for used bytes and total bytes Qu Wenruo
2018-10-08 10:44 ` Qu Wenruo [this message]
2018-10-08 10:44 ` [PATCH v2 5/5] btrfs-progs: fsck-tests: Add test image for dev extents beyond device boundary Qu Wenruo
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=20181008104436.19267-5-wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).