From: Madper Xie <cxie@redhat.com>
To: Richard Weinberger <richard.weinberger@gmail.com>
Cc: "Madper Xie" <cxie@redhat.com>,
"Luck, Tony" <tony.luck@intel.com>,
"Anton Vorontsov" <anton@enomsg.org>,
"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Seiji Aguchi" <seiji.aguchi@hds.com>,
"Lenny Szubowicz" <lszubowi@redhat.com>,
"成骏 谢" <bbboson@gmail.com>
Subject: Re: [PATCH] pstore: avoid incorrectly mark entry as duplicate
Date: Thu, 24 Oct 2013 00:11:22 +0800 [thread overview]
Message-ID: <87ob6g55n9.fsf@redhat.com> (raw)
In-Reply-To: <CAFLxGvxT1S3km=LordqFGbAb_pWc0cf3oE2ciS9uY4BBJJ231A@mail.gmail.com>
richard.weinberger@gmail.com writes:
> On Wed, Oct 23, 2013 at 4:55 PM, Madper Xie <cxie@redhat.com> wrote:
>> pstore try to find duplicate entries by check both ID, type and psi.
>> They are not really enough for efi backend. dumped vars always have
>> the same type, psi and ID. like follows:
>> dump-type0-9-1-1382511508-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
>> dump-type0-9-1-1382515661-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
>>
>> The "duplicate" entries won't appear in pstorefs. And a complain will be
>> print -- pstore: failed to load 76 record(s) from 'efi'
>> So I add one more check: timespec.
>>
>> Signed-off-by: Madper Xie <cxie@redhat.com>
>> ---
>> fs/pstore/inode.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
>> index 1282384..f70f1e5 100644
>> --- a/fs/pstore/inode.c
>> +++ b/fs/pstore/inode.c
>> @@ -47,6 +47,7 @@ static LIST_HEAD(allpstore);
>> struct pstore_private {
>> struct list_head list;
>> struct pstore_info *psi;
>> + struct timespec time;
>> enum pstore_type_id type;
>> u64 id;
>> int count;
>> @@ -290,7 +291,8 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
>> list_for_each_entry(pos, &allpstore, list) {
>> if (pos->type == type &&
>> pos->id == id &&
>> - pos->psi == psi) {
>> + pos->psi == psi &&
>> + !timespec_compare(&pos->time, &time)) {
>> rc = -EEXIST;
>> break;
>> }
>> @@ -312,6 +314,7 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
>> private->id = id;
>> private->count = count;
>> private->psi = psi;
>> + memcpy(&private->time, &time, sizeof(struct timespec));
>>
>> switch (type) {
>> case PSTORE_TYPE_DMESG:
>
>
> As discussed on IRC, why don't you compare the variable names?
Howdy Richard,
Let's analyze the name of "duplicate" entries:
>> dump-type0-9-1-1382511508-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
>> dump-type0-9-1-1382515661-C-cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0
The have the same name except timestamp. In this case, there is no
difference between compare names and compare timestamps.
( Yeah, I'm pretty sure the guid will be the same one --
LINUX_EFI_CRASH_GUID )
But efi is only one backend. For other backends, we don't sure if they
will add timestamp to name. So...
--
Best,
Madper Xie.
next prev parent reply other threads:[~2013-10-23 16:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 14:55 Madper Xie
2013-10-23 15:58 ` Richard Weinberger
2013-10-23 16:11 ` Madper Xie [this message]
2013-10-23 21:57 ` Tony Luck
2013-10-24 0:21 ` Madper Xie
2013-10-28 13:36 ` Madper Xie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ob6g55n9.fsf@redhat.com \
--to=cxie@redhat.com \
--cc=anton@enomsg.org \
--cc=bbboson@gmail.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lszubowi@redhat.com \
--cc=richard.weinberger@gmail.com \
--cc=seiji.aguchi@hds.com \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome