diff options
author | Luck, Tony <tony.luck@intel.com> | 2013-12-18 18:17:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-12-20 16:12:01 -0500 |
commit | df36ac1bc2a166eef90785d584e4cfed6f52bd32 (patch) | |
tree | 024eb6ee8e997889d9cd31ed97503a158ebf898b | |
parent | eaadcfeb31e959028dfa2cc48741e126e3e15b28 (diff) |
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>
-rw-r--r-- | drivers/acpi/apei/erst.c | 1 | ||||
-rw-r--r-- | drivers/firmware/efi/efi-pstore.c | 1 | ||||
-rw-r--r-- | fs/pstore/platform.c | 7 | ||||
-rw-r--r-- | include/linux/pstore.h | 3 |
4 files changed, 10 insertions, 2 deletions
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 26311f23c824..cb1d557fc22c 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c | |||
@@ -942,6 +942,7 @@ static int erst_clearer(enum pstore_type_id type, u64 id, int count, | |||
942 | static struct pstore_info erst_info = { | 942 | static struct pstore_info erst_info = { |
943 | .owner = THIS_MODULE, | 943 | .owner = THIS_MODULE, |
944 | .name = "erst", | 944 | .name = "erst", |
945 | .flags = PSTORE_FLAGS_FRAGILE, | ||
945 | .open = erst_open_pstore, | 946 | .open = erst_open_pstore, |
946 | .close = erst_close_pstore, | 947 | .close = erst_close_pstore, |
947 | .read = erst_reader, | 948 | .read = erst_reader, |
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 743fd426f21b..4b9dc836dcf9 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c | |||
@@ -356,6 +356,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | |||
356 | static struct pstore_info efi_pstore_info = { | 356 | static struct pstore_info efi_pstore_info = { |
357 | .owner = THIS_MODULE, | 357 | .owner = THIS_MODULE, |
358 | .name = "efi", | 358 | .name = "efi", |
359 | .flags = PSTORE_FLAGS_FRAGILE, | ||
359 | .open = efi_pstore_open, | 360 | .open = efi_pstore_open, |
360 | .close = efi_pstore_close, | 361 | .close = efi_pstore_close, |
361 | .read = efi_pstore_read, | 362 | .read = efi_pstore_read, |
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index b8e93a40a5d3..78c3c2097787 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c | |||
@@ -443,8 +443,11 @@ int pstore_register(struct pstore_info *psi) | |||
443 | pstore_get_records(0); | 443 | pstore_get_records(0); |
444 | 444 | ||
445 | kmsg_dump_register(&pstore_dumper); | 445 | kmsg_dump_register(&pstore_dumper); |
446 | pstore_register_console(); | 446 | |
447 | pstore_register_ftrace(); | 447 | if ((psi->flags & PSTORE_FLAGS_FRAGILE) == 0) { |
448 | pstore_register_console(); | ||
449 | pstore_register_ftrace(); | ||
450 | } | ||
448 | 451 | ||
449 | if (pstore_update_ms >= 0) { | 452 | if (pstore_update_ms >= 0) { |
450 | pstore_timer.expires = jiffies + | 453 | pstore_timer.expires = jiffies + |
diff --git a/include/linux/pstore.h b/include/linux/pstore.h index abd437d0a8a7..ece0c6bbfcc5 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h | |||
@@ -51,6 +51,7 @@ struct pstore_info { | |||
51 | char *buf; | 51 | char *buf; |
52 | size_t bufsize; | 52 | size_t bufsize; |
53 | struct mutex read_mutex; /* serialize open/read/close */ | 53 | struct mutex read_mutex; /* serialize open/read/close */ |
54 | int flags; | ||
54 | int (*open)(struct pstore_info *psi); | 55 | int (*open)(struct pstore_info *psi); |
55 | int (*close)(struct pstore_info *psi); | 56 | int (*close)(struct pstore_info *psi); |
56 | ssize_t (*read)(u64 *id, enum pstore_type_id *type, | 57 | ssize_t (*read)(u64 *id, enum pstore_type_id *type, |
@@ -70,6 +71,8 @@ struct pstore_info { | |||
70 | void *data; | 71 | void *data; |
71 | }; | 72 | }; |
72 | 73 | ||
74 | #define PSTORE_FLAGS_FRAGILE 1 | ||
75 | |||
73 | #ifdef CONFIG_PSTORE | 76 | #ifdef CONFIG_PSTORE |
74 | extern int pstore_register(struct pstore_info *); | 77 | extern int pstore_register(struct pstore_info *); |
75 | extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason); | 78 | extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason); |