Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-11 Thread Cornelia Huck
On Tue, 10 Apr 2007 15:18:15 -0700, Andrew Morton <[EMAIL PROTECTED]> wrote: > Note that I changed it to not send the KOBJ_REMOVE if we didn't send a > KOBJ_ADD. The whole part_uevent_suppress stuff is not really nice, causing the code to use a lot of kobject_{init,add} and kobject_{del,put}

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-11 Thread Andrew Morton
On Wed, 11 Apr 2007 14:45:25 +0800 WANG Cong <[EMAIL PROTECTED]> wrote: > >- > >snprintf(p->kobj.name,KOBJ_NAME_LEN,"%sp%d",disk->kobj.name,part); > >+snprintf(p->kobj.name, KOBJ_NAME_LEN, "%sp%d", > >+disk->kobj.name, part); >

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-11 Thread WANG Cong
On Tue, Apr 10, 2007 at 03:18:15PM -0700, Andrew Morton wrote: >On Tue, 10 Apr 2007 22:08:29 +0800 >WANG Cong <[EMAIL PROTECTED]> wrote: > >> Since kobject_add, sysfs_create_link and sysfs_create_file are marked as >> '__must_check', we must always check their return values. >> > >Your mail

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-11 Thread WANG Cong
On Tue, Apr 10, 2007 at 03:18:15PM -0700, Andrew Morton wrote: On Tue, 10 Apr 2007 22:08:29 +0800 WANG Cong [EMAIL PROTECTED] wrote: Since kobject_add, sysfs_create_link and sysfs_create_file are marked as '__must_check', we must always check their return values. snip Your mail client

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-11 Thread Andrew Morton
On Wed, 11 Apr 2007 14:45:25 +0800 WANG Cong [EMAIL PROTECTED] wrote: - snprintf(p-kobj.name,KOBJ_NAME_LEN,%sp%d,disk-kobj.name,part); +snprintf(p-kobj.name, KOBJ_NAME_LEN, %sp%d, +disk-kobj.name, part);

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-11 Thread Cornelia Huck
On Tue, 10 Apr 2007 15:18:15 -0700, Andrew Morton [EMAIL PROTECTED] wrote: Note that I changed it to not send the KOBJ_REMOVE if we didn't send a KOBJ_ADD. The whole part_uevent_suppress stuff is not really nice, causing the code to use a lot of kobject_{init,add} and kobject_{del,put} instead

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-10 Thread Andrew Morton
On Tue, 10 Apr 2007 22:08:29 +0800 WANG Cong <[EMAIL PROTECTED]> wrote: > Since kobject_add, sysfs_create_link and sysfs_create_file are marked as > '__must_check', we must always check their return values. > > Signed-off-by: WANG Cong <[EMAIL PROTECTED]> > Acked-by: Cornelia Huck <[EMAIL

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-10 Thread WANG Cong
On Tue, Apr 10, 2007 at 02:31:06PM +0200, Cornelia Huck wrote: >On Fri, 6 Apr 2007 10:53:43 +0800, >WANG Cong <[EMAIL PROTECTED]> wrote: > >> OK. Then I send it again. Hopefully it can be accepted this time. ;-p > >Looks sane. (Note that there is still a pathological case where >kobject_put() is

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-10 Thread Cornelia Huck
On Fri, 6 Apr 2007 10:53:43 +0800, WANG Cong <[EMAIL PROTECTED]> wrote: > OK. Then I send it again. Hopefully it can be accepted this time. ;-p Looks sane. (Note that there is still a pathological case where kobject_put() is not enough to trigger release after the failed kobject_add(). I'm

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-10 Thread Cornelia Huck
On Fri, 6 Apr 2007 10:53:43 +0800, WANG Cong [EMAIL PROTECTED] wrote: OK. Then I send it again. Hopefully it can be accepted this time. ;-p Looks sane. (Note that there is still a pathological case where kobject_put() is not enough to trigger release after the failed kobject_add(). I'm sending

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-10 Thread WANG Cong
On Tue, Apr 10, 2007 at 02:31:06PM +0200, Cornelia Huck wrote: On Fri, 6 Apr 2007 10:53:43 +0800, WANG Cong [EMAIL PROTECTED] wrote: OK. Then I send it again. Hopefully it can be accepted this time. ;-p Looks sane. (Note that there is still a pathological case where kobject_put() is not enough

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-10 Thread Andrew Morton
On Tue, 10 Apr 2007 22:08:29 +0800 WANG Cong [EMAIL PROTECTED] wrote: Since kobject_add, sysfs_create_link and sysfs_create_file are marked as '__must_check', we must always check their return values. Signed-off-by: WANG Cong [EMAIL PROTECTED] Acked-by: Cornelia Huck [EMAIL PROTECTED]

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread WANG Cong
On Thu, Apr 05, 2007 at 06:00:16PM +0200, Cornelia Huck wrote: >On Thu, 5 Apr 2007 23:27:32 +0800, >WANG Cong <[EMAIL PROTECTED]> wrote: > >> Thank you very much! I know. So I should replace all kfree with kobject_put, >> like this one: >> >> -sysfs_create_link(>kobj, _subsys.kset.kobj,

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread Cornelia Huck
On Thu, 5 Apr 2007 23:27:32 +0800, WANG Cong <[EMAIL PROTECTED]> wrote: > Thank you very much! I know. So I should replace all kfree with kobject_put, > like this one: > > - sysfs_create_link(>kobj, _subsys.kset.kobj, "subsystem"); > + if (sysfs_create_link(>kobj, _subsys.kset.kobj,

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread WANG Cong
On Thu, Apr 05, 2007 at 05:05:14PM +0200, Cornelia Huck wrote: >On Thu, 5 Apr 2007 22:44:09 +0800, >WANG Cong <[EMAIL PROTECTED]> wrote: > >> On Thu, Apr 05, 2007 at 11:11:42AM +0200, Cornelia Huck wrote: >> >On Thu, 5 Apr 2007 12:54:11 +0800, >> >WANG Cong <[EMAIL PROTECTED]> wrote: >> > >> >>

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread Cornelia Huck
On Thu, 5 Apr 2007 22:44:09 +0800, WANG Cong <[EMAIL PROTECTED]> wrote: > On Thu, Apr 05, 2007 at 11:11:42AM +0200, Cornelia Huck wrote: > >On Thu, 5 Apr 2007 12:54:11 +0800, > >WANG Cong <[EMAIL PROTECTED]> wrote: > > > >> --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig2007-03-30 >

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread WANG Cong
On Thu, Apr 05, 2007 at 11:11:42AM +0200, Cornelia Huck wrote: >On Thu, 5 Apr 2007 12:54:11 +0800, >WANG Cong <[EMAIL PROTECTED]> wrote: > >> --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig 2007-03-30 >> 21:35:45.0 +0800 >> +++ linux-2.6.21-rc5-mm3/fs/partitions/check.c

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread Cornelia Huck
On Thu, 5 Apr 2007 12:54:11 +0800, WANG Cong <[EMAIL PROTECTED]> wrote: > --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig 2007-03-30 > 21:35:45.0 +0800 > +++ linux-2.6.21-rc5-mm3/fs/partitions/check.c2007-04-02 > 21:29:02.0 +0800 > @@ -385,10 +385,18 @@ void

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread WANG Cong
On Thu, Apr 05, 2007 at 06:00:16PM +0200, Cornelia Huck wrote: On Thu, 5 Apr 2007 23:27:32 +0800, WANG Cong [EMAIL PROTECTED] wrote: Thank you very much! I know. So I should replace all kfree with kobject_put, like this one: -sysfs_create_link(p-kobj, block_subsys.kset.kobj, subsystem);

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread Cornelia Huck
On Thu, 5 Apr 2007 12:54:11 +0800, WANG Cong [EMAIL PROTECTED] wrote: --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig 2007-03-30 21:35:45.0 +0800 +++ linux-2.6.21-rc5-mm3/fs/partitions/check.c2007-04-02 21:29:02.0 +0800 @@ -385,10 +385,18 @@ void

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread WANG Cong
On Thu, Apr 05, 2007 at 11:11:42AM +0200, Cornelia Huck wrote: On Thu, 5 Apr 2007 12:54:11 +0800, WANG Cong [EMAIL PROTECTED] wrote: --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig 2007-03-30 21:35:45.0 +0800 +++ linux-2.6.21-rc5-mm3/fs/partitions/check.c 2007-04-02

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread Cornelia Huck
On Thu, 5 Apr 2007 22:44:09 +0800, WANG Cong [EMAIL PROTECTED] wrote: On Thu, Apr 05, 2007 at 11:11:42AM +0200, Cornelia Huck wrote: On Thu, 5 Apr 2007 12:54:11 +0800, WANG Cong [EMAIL PROTECTED] wrote: --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig2007-03-30

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread WANG Cong
On Thu, Apr 05, 2007 at 05:05:14PM +0200, Cornelia Huck wrote: On Thu, 5 Apr 2007 22:44:09 +0800, WANG Cong [EMAIL PROTECTED] wrote: On Thu, Apr 05, 2007 at 11:11:42AM +0200, Cornelia Huck wrote: On Thu, 5 Apr 2007 12:54:11 +0800, WANG Cong [EMAIL PROTECTED] wrote: ---

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-05 Thread Cornelia Huck
On Thu, 5 Apr 2007 23:27:32 +0800, WANG Cong [EMAIL PROTECTED] wrote: Thank you very much! I know. So I should replace all kfree with kobject_put, like this one: - sysfs_create_link(p-kobj, block_subsys.kset.kobj, subsystem); + if (sysfs_create_link(p-kobj, block_subsys.kset.kobj,

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-04 Thread WANG Cong
On Mon, Apr 02, 2007 at 01:01:28PM +0200, Cornelia Huck wrote: >On Sun, 1 Apr 2007 15:32:34 +0800, >"Cong WANG" <[EMAIL PROTECTED]> wrote: > >> --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig 2007-03-30 >> 21:35:45.0 +0800 >> +++ linux-2.6.21-rc5-mm3/fs/partitions/check.c

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-04 Thread WANG Cong
On Mon, Apr 02, 2007 at 01:01:28PM +0200, Cornelia Huck wrote: On Sun, 1 Apr 2007 15:32:34 +0800, Cong WANG [EMAIL PROTECTED] wrote: --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig 2007-03-30 21:35:45.0 +0800 +++ linux-2.6.21-rc5-mm3/fs/partitions/check.c 2007-03-30

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-02 Thread Cornelia Huck
On Sun, 1 Apr 2007 15:32:34 +0800, "Cong WANG" <[EMAIL PROTECTED]> wrote: > --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig 2007-03-30 > 21:35:45.0 +0800 > +++ linux-2.6.21-rc5-mm3/fs/partitions/check.c2007-03-30 > 21:49:53.0 +0800 > @@ -385,10 +385,16 @@ void

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-02 Thread Cornelia Huck
On Sun, 1 Apr 2007 15:32:34 +0800, Cong WANG [EMAIL PROTECTED] wrote: --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig 2007-03-30 21:35:45.0 +0800 +++ linux-2.6.21-rc5-mm3/fs/partitions/check.c2007-03-30 21:49:53.0 +0800 @@ -385,10 +385,16 @@ void

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-01 Thread Parag Warudkar
On 4/1/07, Parag Warudkar <[EMAIL PROTECTED]> wrote: >- kobject_add(>kobj); >+ if (kobject_add(>kobj)) { >+ kfree(p); >+ return; Please add a printk warning before the return statement to log a proper warning stating what happened, which file and line etc.

RE: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-01 Thread Parag Warudkar
- kobject_add(>kobj); + if (kobject_add(>kobj)) { + kfree(p); + return; Please add a printk warning before the return statement to log a proper warning stating what happened, which file and line etc. That way people can know why something did not work as

[-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-01 Thread Cong WANG
Since kobject_add, sysfs_create_link and sysfs_create_file are marked as '__must_check', we must always check their return values. Signed-off-by: Cong WANG <[EMAIL PROTECTED]> --- --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig 2007-03-30 21:35:45.0 +0800 +++

[-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-01 Thread Cong WANG
Since kobject_add, sysfs_create_link and sysfs_create_file are marked as '__must_check', we must always check their return values. Signed-off-by: Cong WANG [EMAIL PROTECTED] --- --- linux-2.6.21-rc5-mm3/fs/partitions/check.c.orig 2007-03-30 21:35:45.0 +0800 +++

RE: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-01 Thread Parag Warudkar
- kobject_add(p-kobj); + if (kobject_add(p-kobj)) { + kfree(p); + return; Please add a printk warning before the return statement to log a proper warning stating what happened, which file and line etc. That way people can know why something did not work

Re: [-mm3 PATCH] (Retry) Check the return value of kobject_add and etc.

2007-04-01 Thread Parag Warudkar
On 4/1/07, Parag Warudkar [EMAIL PROTECTED] wrote: - kobject_add(p-kobj); + if (kobject_add(p-kobj)) { + kfree(p); + return; Please add a printk warning before the return statement to log a proper warning stating what happened, which file and line etc. That