Re: [PATCH 15/15] block: Add FIXME comment to handle device_add_disk error

2016-08-17 Thread Sergey Senozhatsky
On (08/17/16 15:15), Fam Zheng wrote: [..] > ( > rc = device_add_disk(e1, e2, e3); > | > + /* FIXME: handle error. */ > device_add_disk(e1, e2, e3); or use __must_check for device_add_disk() function? /* which is _attribute__((warn_unused_result)) */ -ss

Re: [PATCH 11/15] zram: Pass attribute group to device_add_disk

2016-08-17 Thread Sergey Senozhatsky
On (08/18/16 10:59), Sergey Senozhatsky wrote: [..] > I like the previous "Error creating sysfs group for device" string better, > than "Error creating disk", because the latter one is much less informative. > > do you want to do something like below? > > int device_add_disk(struct device *parent

Re: [PATCH 11/15] zram: Pass attribute group to device_add_disk

2016-08-17 Thread Sergey Senozhatsky
Hello, On (08/17/16 15:15), Fam Zheng wrote: [..] > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c > index 20920a2..2331788 100644 > --- a/drivers/block/zram/zram_drv.c > +++ b/drivers/block/zram/zram_drv.c > @@ -1298,13 +1298,10 @@ static int zram_add(void) >

Re: [PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Ed Cashin
On 08/17/2016 05:14 AM, Fam Zheng wrote: ... Of course, the plan is to write patches on top. I'm not cleaning up anything here because I'm concerned callers may double free (and I didn't look hard into that). Aside from Huck's concerns, the changes looked OK from aoe's perspective. -- Ed __

RE: [PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration

2016-08-17 Thread Li, Liang Z
Hi Michael, Could you help to review this version when you have time? Thanks! Liang > -Original Message- > From: Li, Liang Z > Sent: Monday, August 08, 2016 2:35 PM > To: linux-ker...@vger.kernel.org > Cc: virtualization@lists.linux-foundation.org; linux...@kvack.org; virtio- > d...@lis

Re: [PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Fam Zheng
On Wed, 08/17 11:06, Cornelia Huck wrote: > On Wed, 17 Aug 2016 16:48:23 +0800 > Fam Zheng wrote: > > > On Wed, 08/17 10:49, Cornelia Huck wrote: > > > On Wed, 17 Aug 2016 15:15:06 +0800 > > > Fam Zheng wrote: > > > > > > > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct

Re: [PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Cornelia Huck
On Wed, 17 Aug 2016 16:48:23 +0800 Fam Zheng wrote: > On Wed, 08/17 10:49, Cornelia Huck wrote: > > On Wed, 17 Aug 2016 15:15:06 +0800 > > Fam Zheng wrote: > > > > > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct > > > gendisk *disk) > > > disk->flags |= GENHD_FL_UP;

Re: [PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Fam Zheng
On Wed, 08/17 10:49, Cornelia Huck wrote: > On Wed, 17 Aug 2016 15:15:06 +0800 > Fam Zheng wrote: > > > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct > > gendisk *disk) > > disk->flags |= GENHD_FL_UP; > > > > retval = blk_alloc_devt(&disk->part0, &devt); > > -

Re: [PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Cornelia Huck
On Wed, 17 Aug 2016 15:15:06 +0800 Fam Zheng wrote: > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct > gendisk *disk) > disk->flags |= GENHD_FL_UP; > > retval = blk_alloc_devt(&disk->part0, &devt); > - if (retval) { > - WARN_ON(1); > -

Re: [PATCH 08/15] nvme: Pass attribute group to device_add_disk

2016-08-17 Thread kbuild test robot
Hi Fam, [auto build test WARNING on linus/master] [also build test WARNING on v4.8-rc2 next-20160817] [cannot apply to linux/master] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Fam-Zheng/Fix

[PATCH 15/15] block: Add FIXME comment to handle device_add_disk error

2016-08-17 Thread Fam Zheng
Done with coccinelle: @@ expression e1, e2, e3; identifier rc; @@ ( rc = device_add_disk(e1, e2, e3); | + /* FIXME: handle error. */ device_add_disk(e1, e2, e3); ) Signed-off-by: Fam Zheng --- arch/m68k/emu/nfblock.c | 1 + arch/um/drivers/ubd_kern.c

[PATCH 14/15] axonram: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries conditiona

[PATCH 10/15] mtd: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries conditiona

[PATCH 11/15] zram: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries conditiona

[PATCH 13/15] aoeblk: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries conditiona

[PATCH 09/15] virtio-blk: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries conditiona

[PATCH 12/15] mtip: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries conditiona

[PATCH 06/15] genhd: Add return code to device_add_disk

2016-08-17 Thread Fam Zheng
There are a number of places in device_add_disk that can fail, and even more to come as we extend it. Switch the return type of the function, and return the error code when error happens. The WARN_ON is kept because callers are not updated to check the error yet. Signed-off-by: Fam Zheng --- b

[PATCH 08/15] nvme: Pass attribute group to device_add_disk

2016-08-17 Thread Fam Zheng
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries conditiona

[PATCH 05/15] genhd: Return error from disk_{add,alloc}_events

2016-08-17 Thread Fam Zheng
disk_alloc_events and disk_add_events can fail, return the error code so the caller can handle it. Signed-off-by: Fam Zheng --- block/genhd.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 8c7510d..4316d2d 100644

[PATCH 07/15] genhd: Add attribute group parameter to device_add_disk

2016-08-17 Thread Fam Zheng
The added parameter attr_group, if not NULL, be added to the new disk. The callers are converted with coccinelle: @@ expression e1, e2; @@ - device_add_disk(e1, e2); + device_add_disk(e1, e2, NULL); So there is not behavior change yet. Signed-off-by: Fam Zheng --- arch/m68k/emu/nfbl

[PATCH 00/15] Fix issue with KOBJ_ADD uevent versus disk attributes

2016-08-17 Thread Fam Zheng
This is an attempt to fix the issue that some disks' sysfs attributes are not ready at the time its KOBJ_ADD event is sent. The symptom is during device hotplug, udev may fail to find certain attributes, such as serial or wwn, of the disk. As a result the /dev/disk/by-id entries are not created.

[PATCH 03/15] genhd: Return error from blk_register_region

2016-08-17 Thread Fam Zheng
blk_register_region can fail (-ENOMEM), return the error to the caller. Signed-off-by: Fam Zheng --- block/genhd.c | 4 ++-- include/linux/genhd.h | 10 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 3dcecaa..8c7510d 100644

[PATCH 04/15] block: Return error from blk_integrity_add

2016-08-17 Thread Fam Zheng
The kobject_init_and_add call in blk_integrity_add can fail, return the error code in this case, so that it can be handled in the caller. Signed-off-by: Fam Zheng --- block/blk-integrity.c | 12 include/linux/genhd.h | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff

[PATCH 01/15] disk: Drop add_disk in favor of device_add_disk

2016-08-17 Thread Fam Zheng
add_disk is now a "convenience" wrapper of device_add_disk. Unwrap it so that callers can be later converted to handle error and attribute group more easily. Callers are converted with coccinelle: @@ expression x; @@ - add_disk(x) + device_add_disk(NULL, x) Removal of add_disk and upda

[PATCH 02/15] genhd: Return error from register_disk()

2016-08-17 Thread Fam Zheng
Several operations in register_disk can fail, but the caller currently cannot check for error due to missing return code. Change the function return type and return -errno if any error happens. Also add some documentation. Signed-off-by: Fam Zheng --- block/genhd.c | 27 +---