Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: lijiang <lijiang@redhat.com>
To: Simon Horman <horms@verge.net.au>
Cc: kasong@redhat.com, piliu@redhat.com, bhsharma@redhat.com,
	kexec@lists.infradead.org, junw99@yahoo.com, bhe@redhat.com,
	dyoung@redhat.com
Subject: Re: [PATCH 2/2] Limit the size of vmcore-dmesg.txt to 2G
Date: Fri, 23 Aug 2019 13:26:30 +0800	[thread overview]
Message-ID: <f9ef57f3-6026-af2e-6a16-25d4fea3d0cb@redhat.com> (raw)
In-Reply-To: <20190822085211.j2y736chwesxga4l@verge.net.au>

在 2019年08月22日 16:52, Simon Horman 写道:
> On Thu, Aug 15, 2019 at 11:37:56AM +0800, Lianbo Jiang wrote:
>> With some corrupted vmcore files, the vmcore-dmesg.txt file may grow
>> forever till the kdump disk becomes full, and also probably causes
>> the disk error messages as follow:
>> ...
>> sd 0:0:0:0: [sda] tag#6 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
>> sd 0:0:0:0: [sda] tag#6 CDB: Read(10) 28 00 08 06 4c 98 00 00 08 00
>> blk_update_request: I/O error, dev sda, sector 134630552
>> sd 0:0:0:0: [sda] tag#7 FAILED Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
>> sd 0:0:0:0: [sda] tag#7 CDB: Read(10) 28 00 08 06 4c 98 00 00 08 00
>> blk_update_request: I/O error, dev sda, sector 134630552
>> ...
>>
>> If vmcore-dmesg.txt occupies the whole disk, the vmcore can not be
>> saved, this is also a problem.
>>
>> Lets limit the size of vmcore-dmesg.txt to avoid such problems.
>>
>> Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
> 
> Thanks, this looks good to me.
> 
> Please repost this patch with an updated version of Patch 1/2.
> 

OK, thank you, Simon. I will improve them and post again.

>> ---
>>  vmcore-dmesg/vmcore-dmesg.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
>> index ff0d540c9130..5ada3566972b 100644
>> --- a/vmcore-dmesg/vmcore-dmesg.c
>> +++ b/vmcore-dmesg/vmcore-dmesg.c
>> @@ -1,8 +1,18 @@
>>  #include <elf_info.h>
>>  
>> +/* stole this macro from kernel printk.c */
>> +#define LOG_BUF_LEN_MAX (uint32_t)(1 << 31)
>> +
>>  static void write_to_stdout(char *buf, unsigned int nr)
>>  {
>>  	ssize_t ret;
>> +	static uint32_t n_bytes = 0;
>> +
>> +	n_bytes += nr;
>> +	if (n_bytes > LOG_BUF_LEN_MAX) {
>> +		fprintf(stderr, "The vmcore-dmesg.txt over 2G in size is not supported.\n");
>> +		exit(55);
>> +	}
>>  
>>  	ret = write(STDOUT_FILENO, buf, nr);
>>  	if (ret != nr) {
>> -- 
>> 2.17.1
>>
>>
>> _______________________________________________
>> kexec mailing list
>> kexec@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/kexec
>>

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

      reply	other threads:[~2019-08-23  5:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15  3:37 [PATCH 0/2] Limit the size of vmcore-dmesg.txt to 2G Lianbo Jiang
2019-08-15  3:37 ` [PATCH 1/2] cleanup: move it back from util_lib/elf_info.c Lianbo Jiang
2019-08-22  8:51   ` Simon Horman
2019-08-23  5:24     ` lijiang
2019-08-23  7:58       ` lijiang
2019-08-15  3:37 ` [PATCH 2/2] Limit the size of vmcore-dmesg.txt to 2G Lianbo Jiang
2019-08-22  8:52   ` Simon Horman
2019-08-23  5:26     ` lijiang [this message]

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=f9ef57f3-6026-af2e-6a16-25d4fea3d0cb@redhat.com \
    --to=lijiang@redhat.com \
    --cc=bhe@redhat.com \
    --cc=bhsharma@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=horms@verge.net.au \
    --cc=junw99@yahoo.com \
    --cc=kasong@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=piliu@redhat.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