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
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
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)
>
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
__
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
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
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;
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);
> > -
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);
> -
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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 +---
26 matches
Mail list logo