lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 28 Oct 2020 15:45:22 -0500
From:   Tony Asleson <tasleson@...hat.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Alexander Viro <viro@...iv.linux.org.uk>,
        Linux FS Devel <linux-fsdevel@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] buffer_io_error: Use dev_err_ratelimited

On 10/26/20 5:07 PM, Andy Shevchenko wrote:
> On Mon, Oct 26, 2020 at 10:59 PM Tony Asleson <tasleson@...hat.com> wrote:
>>
>> Replace printk_ratelimited with dev_err_ratelimited which
>> adds dev_printk meta data. This is used by journald to
>> add disk ID information to the journal entry.
> 
> 
>> This re-worked change is from a different patch series
>> and utilizes the following suggestions.
>>
>> - Reduce indentation level (Andy Shevchenko)
>> - Remove unneeded () for conditional operator (Sergei Shtylyov)
> 
> This should go as a changelog after the cutter '---' line...

Thanks, I'll correct this.


>> Signed-off-by: Tony Asleson <tasleson@...hat.com>
>> ---
> 
> ...somewhere here.
> 
> ...
> 
>> -       if (!test_bit(BH_Quiet, &bh->b_state))
>> -               printk_ratelimited(KERN_ERR
>> -                       "Buffer I/O error on dev %pg, logical block %llu%s\n",
>> -                       bh->b_bdev, (unsigned long long)bh->b_blocknr, msg);
>> +       struct device *gendev;
>> +
>> +       if (test_bit(BH_Quiet, &bh->b_state))
>> +               return;
>> +
> 
>> +       gendev = bh->b_bdev->bd_disk ?
>> +               disk_to_dev(bh->b_bdev->bd_disk) : NULL;
> 
> I'm not sure it's a good idea to print '(null)'.

I've not seen any cases where we end up with null here, but I've only
tested ATA, SCSI, and NVMe subsystems.

However, I would think that if this does occur it would be more obvious
that it's an issue that needs to be corrected if the null ends up in the
logs instead of having the same output that we have today?

> Perhaps
> 
> if (bh->b_bdev->bd_disk)
>   dev_err_ratelimit(disk_to_dev(bh->b_bdev->bd_disk), ...);
> else
>   pr_err_ratelimit(...);
> 
> ?
> 
>> +       dev_err_ratelimited(gendev,
>> +               "Buffer I/O error, logical block %llu%s\n",
> 
>> +               (unsigned long long)bh->b_blocknr, msg);
> 
> It's a u64 always (via sector_t), do we really need a casting?

That's a good question, grepping around shows *many* instances of this
being done.  I do agree that this doesn't seem to be needed, but maybe
there is a reason why it's done?

-Tony

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ