public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: John Garry <john.garry@huawei.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Ming Lei <ming.lei@redhat.com>, Hannes Reinecke <hare@suse.de>,
	Mike Christie <michael.christie@oracle.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>
Subject: Re: [PATCH v3 2/3] scsi: core: Introduce a new list for SCSI proc directory entries
Date: Tue, 13 Sep 2022 11:38:31 -0700	[thread overview]
Message-ID: <bf551369-5a0c-cbe9-7175-525bfb3c4e47@acm.org> (raw)
In-Reply-To: <4dc1a0ba-75f3-d7f6-16c3-daddfaa05cf4@huawei.com>

On 9/13/22 07:26, John Garry wrote:
> On 09/09/2022 00:35, Bart Van Assche wrote:
>> +struct scsi_proc_entry {
>> +    struct list_head    entry;
>> +    const struct scsi_host_template *sht;
>> +    struct proc_dir_entry    *proc_dir;
>> +    unsigned char        present;
> 
> is there really a hard limit of 255 hosts?

Apparently that limit exists today. I can use a wider data type for the 
'present' member if you want.

>> +static struct scsi_proc_entry *
>> +__scsi_lookup_proc_entry(const struct scsi_host_template *sht)
>> +{
>> +    struct scsi_proc_entry *e;
>> +
>> +    lockdep_assert_held(&global_host_template_mutex);
> 
> I'm not sure we really need this - maybe a comment would be better. I 
> don't care too much either way.

lockdep_assert_held() statements get verified at runtime if lockdep is 
enabled but comments not. This is why I prefer lockdep_assert_held() 
over a comment.

>> +    if (e->present++) {
>> +        e = NULL;
>> +        goto unlock;
>> +    }
>> +    e->proc_dir = proc_mkdir(sht->proc_name, proc_scsi);
>> +    if (!e->proc_dir) {
>> +        printk(KERN_ERR "%s: proc_mkdir failed for %s\n", __func__,
>> +               sht->proc_name);
>> +        goto unlock;
> 
> hmmm... in this case we don't add e to the list. As unlikely as it 
> seems, if a subsequent attempt to create the proc dir passes for another 
> host with the same sht, then e->present would be incorrect, right?

Right, this needs to be fixed.

Thanks,

Bart.

  reply	other threads:[~2022-09-13 18:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08 23:35 [PATCH v3 0/3] Prepare for constifying SCSI host templates Bart Van Assche
2022-09-08 23:35 ` [PATCH v3 1/3] scsi: esas2r: Introduce scsi_template_proc_dir() Bart Van Assche
2022-09-13 14:05   ` John Garry
2022-09-13 19:51     ` Bart Van Assche
2022-09-08 23:35 ` [PATCH v3 2/3] scsi: core: Introduce a new list for SCSI proc directory entries Bart Van Assche
2022-09-12 16:01   ` Mike Christie
2022-09-13 14:26   ` John Garry
2022-09-13 18:38     ` Bart Van Assche [this message]
2022-09-08 23:36 ` [PATCH v3 3/3] scsi: core: Rework the code for dropping the LLD module reference Bart Van Assche

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=bf551369-5a0c-cbe9-7175-525bfb3c4e47@acm.org \
    --to=bvanassche@acm.org \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=john.garry@huawei.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=ming.lei@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