aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2014-12-08 15:06:52 -0800
committerMark Salyzyn <salyzyn@google.com>2015-01-13 16:18:43 -0800
commit2d416e95a31472d2654e964369f99d2fc352852f (patch)
treef242a56bdafe7102cc752d382905f82201b2e9c8
parentb8cbc429050e3f9dd93bfee8461627d37d048e18 (diff)
[PATCH 3/5] pstore: handle zero-sized prz in series
Corrects a problem wih ramoops_pstore_read failing to return the next in a prz series after first zero-sized entry, not venturing to the next non-zero entry. Signed-off-by: Mark Salyzyn <salyzyn@android.com> Change-Id: Iedce3b94c13917da33be44e1d80811757774c793
-rw-r--r--fs/pstore/ram.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index a05dc23d954c..585422d70581 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -133,6 +133,12 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max,
return prz;
}
+static bool prz_ok(struct persistent_ram_zone *prz)
+{
+ return !!prz && !!(persistent_ram_old_size(prz) +
+ persistent_ram_ecc_string(prz, NULL, 0));
+}
+
static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
int *count, struct timespec *time,
char **buf, struct pstore_info *psi)
@@ -145,13 +151,13 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
prz = ramoops_get_next_prz(cxt->przs, &cxt->dump_read_cnt,
cxt->max_dump_cnt, id, type,
PSTORE_TYPE_DMESG, 1);
- if (!prz)
+ if (!prz_ok(prz))
prz = ramoops_get_next_prz(&cxt->cprz, &cxt->console_read_cnt,
1, id, type, PSTORE_TYPE_CONSOLE, 0);
- if (!prz)
+ if (!prz_ok(prz))
prz = ramoops_get_next_prz(&cxt->fprz, &cxt->ftrace_read_cnt,
1, id, type, PSTORE_TYPE_FTRACE, 0);
- if (!prz)
+ if (!prz_ok(prz))
return 0;
/* TODO(kees): Bogus time for the moment. */