Skip to content

Commit

Permalink
pstore: Don't allow high traffic options on fragile devices
Browse files Browse the repository at this point in the history
Some pstore backing devices use on board flash as persistent
storage. These have limited numbers of write cycles so it
is a poor idea to use them from high frequency operations.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Luck, Tony authored and Linus Torvalds committed Dec 20, 2013
1 parent eaadcfe commit df36ac1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/acpi/apei/erst.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ static int erst_clearer(enum pstore_type_id type, u64 id, int count,
static struct pstore_info erst_info = {
.owner = THIS_MODULE,
.name = "erst",
.flags = PSTORE_FLAGS_FRAGILE,
.open = erst_open_pstore,
.close = erst_close_pstore,
.read = erst_reader,
Expand Down
1 change: 1 addition & 0 deletions drivers/firmware/efi/efi-pstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
static struct pstore_info efi_pstore_info = {
.owner = THIS_MODULE,
.name = "efi",
.flags = PSTORE_FLAGS_FRAGILE,
.open = efi_pstore_open,
.close = efi_pstore_close,
.read = efi_pstore_read,
Expand Down
7 changes: 5 additions & 2 deletions fs/pstore/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,11 @@ int pstore_register(struct pstore_info *psi)
pstore_get_records(0);

kmsg_dump_register(&pstore_dumper);
pstore_register_console();
pstore_register_ftrace();

if ((psi->flags & PSTORE_FLAGS_FRAGILE) == 0) {
pstore_register_console();
pstore_register_ftrace();
}

if (pstore_update_ms >= 0) {
pstore_timer.expires = jiffies +
Expand Down
3 changes: 3 additions & 0 deletions include/linux/pstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct pstore_info {
char *buf;
size_t bufsize;
struct mutex read_mutex; /* serialize open/read/close */
int flags;
int (*open)(struct pstore_info *psi);
int (*close)(struct pstore_info *psi);
ssize_t (*read)(u64 *id, enum pstore_type_id *type,
Expand All @@ -70,6 +71,8 @@ struct pstore_info {
void *data;
};

#define PSTORE_FLAGS_FRAGILE 1

#ifdef CONFIG_PSTORE
extern int pstore_register(struct pstore_info *);
extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
Expand Down

0 comments on commit df36ac1

Please sign in to comment.