Re: çå: Re: çå: Re: [PATCH v2] scsi: Introduce sdev_printk_ratelimited tothrottlefrequent printk
From: Petr Mladek
Date: Mon Apr 09 2018 - 04:59:52 EST
On Mon 2018-04-09 10:13:43, wen.yang99@xxxxxxxxxx wrote:
> That's a good idea, but it only solves part of the problem.
> loopping printks under spinlock, there's two path:
> one path is:
> scsi_request_fn --> loop -> blk_peek_request-> scsi_prep_fn -> scsi_prep_state_check -> sdev_printk
> another path is:
> scsi_request_fn --> loop -> sdev_printk
Is this message redundant? It seems to be printed in the same
situations as the messages in scsi_prep_state_check().
In fact, there seems to be a mismatch. scsi_request_fn() prints
about offline device also for sdev->sdev_state == SDEV_DEL.
While scsi_prep_state_check() prints about a dead device
in this case.
Would it make sense to remove the redundant dev_printk() from
scsi_request_fn()?
Then we could add a flag into struct scsi_device that
would remember if we already printed the error in
scsi_prep_state_check() for the given device. It could
be used to print the error only once.
The flag might be scsi_device_state value for which
we printed the error last time. We would need to reset
it scsi_prep_state_check() see another state.
It is a bit hairy but it really does not make much sense
to print the same error message thousand times.
Best Regards,
Petr
PS: Your mail was again strangely formatted. Please, send
mails in plain text format (no html).