Skip to content

Commit df36ac1

Browse files
aegltorvalds
authored andcommitted
pstore: Don't allow high traffic options on fragile devices
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>
1 parent eaadcfe commit df36ac1

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

drivers/acpi/apei/erst.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ static int erst_clearer(enum pstore_type_id type, u64 id, int count,
942942
static struct pstore_info erst_info = {
943943
.owner = THIS_MODULE,
944944
.name = "erst",
945+
.flags = PSTORE_FLAGS_FRAGILE,
945946
.open = erst_open_pstore,
946947
.close = erst_close_pstore,
947948
.read = erst_reader,

drivers/firmware/efi/efi-pstore.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
356356
static struct pstore_info efi_pstore_info = {
357357
.owner = THIS_MODULE,
358358
.name = "efi",
359+
.flags = PSTORE_FLAGS_FRAGILE,
359360
.open = efi_pstore_open,
360361
.close = efi_pstore_close,
361362
.read = efi_pstore_read,

fs/pstore/platform.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,11 @@ int pstore_register(struct pstore_info *psi)
443443
pstore_get_records(0);
444444

445445
kmsg_dump_register(&pstore_dumper);
446-
pstore_register_console();
447-
pstore_register_ftrace();
446+
447+
if ((psi->flags & PSTORE_FLAGS_FRAGILE) == 0) {
448+
pstore_register_console();
449+
pstore_register_ftrace();
450+
}
448451

449452
if (pstore_update_ms >= 0) {
450453
pstore_timer.expires = jiffies +

include/linux/pstore.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct pstore_info {
5151
char *buf;
5252
size_t bufsize;
5353
struct mutex read_mutex; /* serialize open/read/close */
54+
int flags;
5455
int (*open)(struct pstore_info *psi);
5556
int (*close)(struct pstore_info *psi);
5657
ssize_t (*read)(u64 *id, enum pstore_type_id *type,
@@ -70,6 +71,8 @@ struct pstore_info {
7071
void *data;
7172
};
7273

74+
#define PSTORE_FLAGS_FRAGILE 1
75+
7376
#ifdef CONFIG_PSTORE
7477
extern int pstore_register(struct pstore_info *);
7578
extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);

0 commit comments

Comments
 (0)