diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index e4d9d24eb73d..0bd6ae4a899f 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -938,7 +938,7 @@ static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, u64 *id, unsigned int part, size_t size, struct pstore_info *psi); static int erst_clearer(enum pstore_type_id type, u64 id, - struct pstore_info *psi); + struct timespec time, struct pstore_info *psi); static struct pstore_info erst_info = { .owner = THIS_MODULE, @@ -1102,7 +1102,7 @@ static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, } static int erst_clearer(enum pstore_type_id type, u64 id, - struct pstore_info *psi) + struct timespec time, struct pstore_info *psi) { return erst_clear(id); } diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index fbe9202c2678..3803621c0d45 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c @@ -747,24 +747,25 @@ static int efi_pstore_write(enum pstore_type_id type, }; static int efi_pstore_erase(enum pstore_type_id type, u64 id, - struct pstore_info *psi) + struct timespec time, struct pstore_info *psi) { - char stub_name[DUMP_NAME_LEN]; + char name[DUMP_NAME_LEN]; efi_char16_t efi_name[DUMP_NAME_LEN]; efi_guid_t vendor = LINUX_EFI_CRASH_GUID; struct efivars *efivars = psi->data; struct efivar_entry *entry, *found = NULL; int i; - sprintf(stub_name, "dump-type%u-%u-", type, (unsigned int)id); + sprintf(name, "dump-type%u-%u-%lu", type, (unsigned int)id, + time.tv_sec); spin_lock(&efivars->lock); for (i = 0; i < DUMP_NAME_LEN; i++) - efi_name[i] = stub_name[i]; + efi_name[i] = name[i]; /* - * Clean up any entries with the same name + * Clean up an entry with the same name */ list_for_each_entry(entry, &efivars->list, list) { @@ -775,9 +776,6 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, if (utf16_strncmp(entry->var.VariableName, efi_name, utf16_strlen(efi_name))) continue; - /* Needs to be a prefix */ - if (entry->var.VariableName[utf16_strlen(efi_name)] == 0) - continue; /* found */ found = entry; @@ -785,6 +783,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, &entry->var.VendorGuid, PSTORE_EFI_ATTRIBUTES, 0, NULL); + break; } if (found) @@ -823,7 +822,7 @@ static int efi_pstore_write(enum pstore_type_id type, } static int efi_pstore_erase(enum pstore_type_id type, u64 id, - struct pstore_info *psi) + struct timespec time, struct pstore_info *psi) { return 0; } diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index 4ab572e6d277..4300af654710 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -175,7 +175,8 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry) struct pstore_private *p = dentry->d_inode->i_private; if (p->psi->erase) - p->psi->erase(p->type, p->id, p->psi); + p->psi->erase(p->type, p->id, dentry->d_inode->i_ctime, + p->psi); return simple_unlink(dir, dentry); } diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 1a4f6da58eab..749693fcb75a 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -237,7 +237,7 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type, } static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, - struct pstore_info *psi) + struct timespec time, struct pstore_info *psi) { struct ramoops_context *cxt = psi->data; struct persistent_ram_zone *prz; diff --git a/include/linux/pstore.h b/include/linux/pstore.h index ee3034a40884..f6e93362d259 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -60,7 +60,7 @@ struct pstore_info { unsigned int part, const char *buf, size_t size, struct pstore_info *psi); int (*erase)(enum pstore_type_id type, u64 id, - struct pstore_info *psi); + struct timespec time, struct pstore_info *psi); void *data; };