Re: [PATCH v3 01/46] scsi: core: Register sysfs attributes earlier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 11, 2021 at 03:09:44PM +0200, Benjamin Block wrote:
> > diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> > index 86793259e541..05b4d69d53d4 100644
> > --- a/drivers/scsi/scsi_sysfs.c
> > +++ b/drivers/scsi/scsi_sysfs.c
> > @@ -1609,8 +1591,10 @@ static struct device_type scsi_dev_type = {
> >  
> >  void scsi_sysfs_device_initialize(struct scsi_device *sdev)
> >  {
> > +	int i, j = 0;
> >  	unsigned long flags;
> >  	struct Scsi_Host *shost = sdev->host;
> > +	struct scsi_host_template *hostt = shost->hostt;
> >  	struct scsi_target  *starget = sdev->sdev_target;
> >  
> >  	device_initialize(&sdev->sdev_gendev);
> > @@ -1618,6 +1602,23 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)
> >  	sdev->sdev_gendev.type = &scsi_dev_type;
> >  	dev_set_name(&sdev->sdev_gendev, "%d:%d:%d:%llu",
> >  		     sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
> > +	sdev->gendev_attr_groups[j++] = &scsi_sdev_attr_group;
> > +	if (hostt->sdev_attrs) {
> > +		sdev->lld_attr_group = (struct attribute_group){
> > +			.attrs = scsi_convert_dev_attrs(&sdev->sdev_gendev,
> > +							hostt->sdev_attrs)
> 
> Hmm, not sure, can this fail in practice? I mean the allocation in
> `scsi_convert_dev_attrs()`. Maybe we should warn at least once if this
> fails? It might render some userspace applications unusable (even some
> plumbing called with udev and such), with no clear signal from the
> kernel why the attributes are missing.
> 
> Previously we would return an error to the caller in
> `scsi_sysfs_add_sdev()` when some addition failed. But I'm not certain
> whether this new allocation falls under the "too small to fail" rule of
> thumb.

Ah.. nevermind you remove that part again in a later patch. Reading the
series I didn't realize. So probably just ignore the comment.

-- 
Best Regards, Benjamin Block  / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH    /    https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen         /        Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux