All of lore.kernel.org
 help / color / mirror / Atom feed
From: Madper Xie <cxie-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Seiji Aguchi <seiji.aguchi-7rDLJAbr9SE@public.gmane.org>
Cc: Madper Xie <cxie-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"tony.luck@intel.com"
	<tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"keescook@chromium.org"
	<keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	"ccross@android.com"
	<ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	"anton@enomsg.org"
	<anton-9xeibp6oKSgdnm+yROfE0A@public.gmane.org>,
	"linux-efi@vger.kernel.org"
	<linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel@vger.kernel.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"bbboson@gmail.com"
	<bbboson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 1/2] pstore: avoid incorrectly mark entry as duplicate
Date: Wed, 30 Oct 2013 22:51:07 +0800	[thread overview]
Message-ID: <87txfyhkx0.fsf@redhat.com> (raw)
In-Reply-To: <A5ED84D3BB3A384992CBB9C77DEDA4D47F9D388F-ohthHghroY0jroPwUH3sq+6wyyQG6/Uh@public.gmane.org>


seiji.aguchi-7rDLJAbr9SE@public.gmane.org writes:

>> -----Original Message-----
>> From: Madper Xie [mailto:cxie-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org]
>> Sent: Wednesday, October 30, 2013 5:45 AM
>> To: tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org; keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org; ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org; anton-9xeibp6oKSgdnm+yROfE0A@public.gmane.org; Seiji Aguchi
>> Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; bbboson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; Madper Xie
>> Subject: [PATCH 1/2] pstore: avoid incorrectly mark entry as duplicate
>> 
>> From: Madper Xie <bbboson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> 
>> 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 two more checks: timespec and count.
>> 
>> Signed-off-by: Madper Xie <cxie-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>
> Looks good to me.
> Acked-by: Seiji Aguchi <seiji.aguchi-7rDLJAbr9SE@public.gmane.org>
>
> But, this patch has to be tested by other backend drivers like erst and ramoops.
> In my understanding, erst has supported to log multiple events.
> So, I'm interested why the same error hasn't happened in the other drivers.
>
> Seiji
Thanks for your review. I'll try to test other backends. :-)
>
>> ---
>>  fs/pstore/inode.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>> 
>> diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
>> index 1282384..0ae994c 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,9 @@ 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 &&
>> +		    pos->count == count &&
>> +		    !timespec_compare(&pos->time, &time)) {
>>  			rc = -EEXIST;
>>  			break;
>>  		}
>> @@ -312,6 +315,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:
>> --
>> 1.8.4.2


-- 
Best,
Madper Xie.

WARNING: multiple messages have this Message-ID (diff)
From: Madper Xie <cxie@redhat.com>
To: Seiji Aguchi <seiji.aguchi@hds.com>
Cc: Madper Xie <cxie@redhat.com>,
	"tony.luck\@intel.com" <tony.luck@intel.com>,
	"keescook\@chromium.org" <keescook@chromium.org>,
	"ccross\@android.com" <ccross@android.com>,
	"anton\@enomsg.org" <anton@enomsg.org>,
	"linux-efi\@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"bbboson\@gmail.com" <bbboson@gmail.com>
Subject: Re: [PATCH 1/2] pstore: avoid incorrectly mark entry as duplicate
Date: Wed, 30 Oct 2013 22:51:07 +0800	[thread overview]
Message-ID: <87txfyhkx0.fsf@redhat.com> (raw)
In-Reply-To: <A5ED84D3BB3A384992CBB9C77DEDA4D47F9D388F@USINDEM103.corp.hds.com>


seiji.aguchi@hds.com writes:

>> -----Original Message-----
>> From: Madper Xie [mailto:cxie@redhat.com]
>> Sent: Wednesday, October 30, 2013 5:45 AM
>> To: tony.luck@intel.com; keescook@chromium.org; ccross@android.com; anton@enomsg.org; Seiji Aguchi
>> Cc: linux-efi@vger.kernel.org; linux-kernel@vger.kernel.org; bbboson@gmail.com; Madper Xie
>> Subject: [PATCH 1/2] pstore: avoid incorrectly mark entry as duplicate
>> 
>> From: Madper Xie <bbboson@gmail.com>
>> 
>> 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 two more checks: timespec and count.
>> 
>> Signed-off-by: Madper Xie <cxie@redhat.com>
>
> Looks good to me.
> Acked-by: Seiji Aguchi <seiji.aguchi@hds.com>
>
> But, this patch has to be tested by other backend drivers like erst and ramoops.
> In my understanding, erst has supported to log multiple events.
> So, I'm interested why the same error hasn't happened in the other drivers.
>
> Seiji
Thanks for your review. I'll try to test other backends. :-)
>
>> ---
>>  fs/pstore/inode.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>> 
>> diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
>> index 1282384..0ae994c 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,9 @@ 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 &&
>> +		    pos->count == count &&
>> +		    !timespec_compare(&pos->time, &time)) {
>>  			rc = -EEXIST;
>>  			break;
>>  		}
>> @@ -312,6 +315,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:
>> --
>> 1.8.4.2


-- 
Best,
Madper Xie.

  parent reply	other threads:[~2013-10-30 14:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30  9:44 [PATCH 0/2] make all stored entries accessible Madper Xie
2013-10-30  9:44 ` Madper Xie
2013-10-30  9:44 ` [PATCH 1/2] pstore: avoid incorrectly mark entry as duplicate Madper Xie
2013-10-30 14:35   ` Seiji Aguchi
     [not found]     ` <A5ED84D3BB3A384992CBB9C77DEDA4D47F9D388F-ohthHghroY0jroPwUH3sq+6wyyQG6/Uh@public.gmane.org>
2013-10-30 14:51       ` Madper Xie [this message]
2013-10-30 14:51         ` Madper Xie
2013-10-30  9:44 ` [PATCH 2/2] pstore: Differentiating names by adding count and timestamp Madper Xie
     [not found]   ` <1383126294-28793-3-git-send-email-cxie-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-10-30 14:38     ` Seiji Aguchi
2013-10-30 14:38       ` Seiji Aguchi
     [not found] ` <1383126294-28793-1-git-send-email-cxie-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-10-30 21:11   ` [PATCH 0/2] make all stored entries accessible Luck, Tony
2013-10-30 21:11     ` Luck, Tony
     [not found]     ` <3908561D78D1C84285E8C5FCA982C28F31D529D7-P5GAC/sN6hlZtRGVdHMbwrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-10-30 23:27       ` Seiji Aguchi
2013-10-30 23:27         ` Seiji Aguchi
     [not found]         ` <A5ED84D3BB3A384992CBB9C77DEDA4D47F9D4476-ohthHghroY0jroPwUH3sq+6wyyQG6/Uh@public.gmane.org>
2013-10-31  0:24           ` Luck, Tony
2013-10-31  0:24             ` Luck, Tony
     [not found]             ` <3908561D78D1C84285E8C5FCA982C28F31D52E99-P5GAC/sN6hlZtRGVdHMbwrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-10-31  3:00               ` Madper Xie
2013-10-31  3:00                 ` Madper Xie
     [not found]                 ` <87d2mm6t64.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-10-31 14:35                   ` Seiji Aguchi
2013-10-31 14:35                     ` Seiji Aguchi
     [not found]                     ` <A5ED84D3BB3A384992CBB9C77DEDA4D47F9D4D01-ohthHghroY0jroPwUH3sq+6wyyQG6/Uh@public.gmane.org>
2013-10-31 20:22                       ` Luck, Tony
2013-10-31 20:22                         ` Luck, Tony
     [not found]                         ` <3908561D78D1C84285E8C5FCA982C28F31D53A1F-P5GAC/sN6hlZtRGVdHMbwrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-10-31 23:22                           ` Seiji Aguchi
2013-10-31 23:22                             ` Seiji Aguchi

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=87txfyhkx0.fsf@redhat.com \
    --to=cxie-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=anton-9xeibp6oKSgdnm+yROfE0A@public.gmane.org \
    --cc=bbboson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=seiji.aguchi-7rDLJAbr9SE@public.gmane.org \
    --cc=tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.