diff mbox

sysfs: handle duplicate removal attempts in sysfs_remove_group()

Message ID 20131125101154.GS2281@intel.com
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Mika Westerberg Nov. 25, 2013, 10:11 a.m. UTC
On Sun, Nov 24, 2013 at 02:09:09AM +0100, Rafael J. Wysocki wrote:
> On Sunday, November 24, 2013 12:36:03 AM Rafael J. Wysocki wrote:
> > On Saturday, November 23, 2013 03:07:01 PM Greg Kroah-Hartman wrote:
> > > On Sun, Nov 24, 2013 at 12:12:59AM +0100, Rafael J. Wysocki wrote:
> > > > On Saturday, November 23, 2013 02:53:58 PM Greg Kroah-Hartman wrote:
> 
> [...]
> 
> > > > > 
> > > > > I can revert Mika's patch, as it would be good to catch these kinds of
> > > > > errors.
> > > > 
> > > > Then we'll need to untangle the SATA/SCSI mess triggered by Bjorn in
> > > > https://bugzilla.kernel.org/show_bug.cgi?id=65281. ;-)
> > > 
> > > I have no objection to fixing that, the scsi sysfs handling is "odd" to
> > > say the least...
> > > 
> > > If someone can unwind it, that would be great to see happen...
> > 
> > Well, if I'm bored to death during the xmas holidays, I may look into that.
> 
> In fact, I'm not exactly sure why ata_port_detach() calls ata_tport_delete()
> before scsi_remove_host()?  Is there any particular reason?  Because that
> doesn't seem to be exactly right ...

I tried so that I have your 'PCI: Move device_del() from pci_stop_dev() to
pci_destroy_dev()' applied and then I did following change as you
suggested.


After both patches are applied the warnings are gone :) However, looks like
both are needed since if I only apply one or another, I still get warnings.
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Rafael J. Wysocki Nov. 25, 2013, 10:41 a.m. UTC | #1
On Monday, November 25, 2013 12:11:54 PM Mika Westerberg wrote:
> On Sun, Nov 24, 2013 at 02:09:09AM +0100, Rafael J. Wysocki wrote:
> > On Sunday, November 24, 2013 12:36:03 AM Rafael J. Wysocki wrote:
> > > On Saturday, November 23, 2013 03:07:01 PM Greg Kroah-Hartman wrote:
> > > > On Sun, Nov 24, 2013 at 12:12:59AM +0100, Rafael J. Wysocki wrote:
> > > > > On Saturday, November 23, 2013 02:53:58 PM Greg Kroah-Hartman wrote:
> > 
> > [...]
> > 
> > > > > > 
> > > > > > I can revert Mika's patch, as it would be good to catch these kinds of
> > > > > > errors.
> > > > > 
> > > > > Then we'll need to untangle the SATA/SCSI mess triggered by Bjorn in
> > > > > https://bugzilla.kernel.org/show_bug.cgi?id=65281. ;-)
> > > > 
> > > > I have no objection to fixing that, the scsi sysfs handling is "odd" to
> > > > say the least...
> > > > 
> > > > If someone can unwind it, that would be great to see happen...
> > > 
> > > Well, if I'm bored to death during the xmas holidays, I may look into that.
> > 
> > In fact, I'm not exactly sure why ata_port_detach() calls ata_tport_delete()
> > before scsi_remove_host()?  Is there any particular reason?  Because that
> > doesn't seem to be exactly right ...
> 
> I tried so that I have your 'PCI: Move device_del() from pci_stop_dev() to
> pci_destroy_dev()' applied and then I did following change as you
> suggested.
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 81a94a3919db..07a03f93d640 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -6304,10 +6304,10 @@ static void ata_port_detach(struct ata_port *ap)
>  		for (i = 0; i < SATA_PMP_MAX_PORTS; i++)
>  			ata_tlink_delete(&ap->pmp_link[i]);
>  	}
> -	ata_tport_delete(ap);
> -
>  	/* remove the associated SCSI host */
>  	scsi_remove_host(ap->scsi_host);
> +
> +	ata_tport_delete(ap);
>  }
>  
>  /**
> 
> After both patches are applied the warnings are gone :) However, looks like
> both are needed since if I only apply one or another, I still get warnings.

Yes, they are both needed. :-)

OK, I'll submit the above upstream if you don't mind.

Cheers, R.

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gwendal Grignou Nov. 25, 2013, 11:51 p.m. UTC | #2
Rafael,

As you pointed out, ata_tport_delete() should be after
scsi_remove_host(), consistent with ata_tport_add() currently before
ata_scsi_add_host().
Thanks for fixing it,

Gwendal.

On Mon, Nov 25, 2013 at 2:41 AM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> On Monday, November 25, 2013 12:11:54 PM Mika Westerberg wrote:
> > On Sun, Nov 24, 2013 at 02:09:09AM +0100, Rafael J. Wysocki wrote:
> > > On Sunday, November 24, 2013 12:36:03 AM Rafael J. Wysocki wrote:
> > > > On Saturday, November 23, 2013 03:07:01 PM Greg Kroah-Hartman wrote:
> > > > > On Sun, Nov 24, 2013 at 12:12:59AM +0100, Rafael J. Wysocki wrote:
> > > > > > On Saturday, November 23, 2013 02:53:58 PM Greg Kroah-Hartman wrote:
> > >
> > > [...]
> > >
> > > > > > >
> > > > > > > I can revert Mika's patch, as it would be good to catch these kinds of
> > > > > > > errors.
> > > > > >
> > > > > > Then we'll need to untangle the SATA/SCSI mess triggered by Bjorn in
> > > > > > https://bugzilla.kernel.org/show_bug.cgi?id=65281. ;-)
> > > > >
> > > > > I have no objection to fixing that, the scsi sysfs handling is "odd" to
> > > > > say the least...
> > > > >
> > > > > If someone can unwind it, that would be great to see happen...
> > > >
> > > > Well, if I'm bored to death during the xmas holidays, I may look into that.
> > >
> > > In fact, I'm not exactly sure why ata_port_detach() calls ata_tport_delete()
> > > before scsi_remove_host()?  Is there any particular reason?  Because that
> > > doesn't seem to be exactly right ...
> >
> > I tried so that I have your 'PCI: Move device_del() from pci_stop_dev() to
> > pci_destroy_dev()' applied and then I did following change as you
> > suggested.
> >
> > diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> > index 81a94a3919db..07a03f93d640 100644
> > --- a/drivers/ata/libata-core.c
> > +++ b/drivers/ata/libata-core.c
> > @@ -6304,10 +6304,10 @@ static void ata_port_detach(struct ata_port *ap)
> >               for (i = 0; i < SATA_PMP_MAX_PORTS; i++)
> >                       ata_tlink_delete(&ap->pmp_link[i]);
> >       }
> > -     ata_tport_delete(ap);
> > -
> >       /* remove the associated SCSI host */
> >       scsi_remove_host(ap->scsi_host);
> > +
> > +     ata_tport_delete(ap);
> >  }
> >
> >  /**
> >
> > After both patches are applied the warnings are gone :) However, looks like
> > both are needed since if I only apply one or another, I still get warnings.
>
> Yes, they are both needed. :-)
>
> OK, I'll submit the above upstream if you don't mind.
>
> Cheers, R.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ide" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 81a94a3919db..07a03f93d640 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6304,10 +6304,10 @@  static void ata_port_detach(struct ata_port *ap)
 		for (i = 0; i < SATA_PMP_MAX_PORTS; i++)
 			ata_tlink_delete(&ap->pmp_link[i]);
 	}
-	ata_tport_delete(ap);
-
 	/* remove the associated SCSI host */
 	scsi_remove_host(ap->scsi_host);
+
+	ata_tport_delete(ap);
 }
 
 /**