Re: [PATCH 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-16 Thread Sasha Levin
On Fri, Nov 16, 2018 at 03:49:06PM +0800, Ming Lei wrote: On Fri, Nov 16, 2018 at 01:52:05AM -0500, Sasha Levin wrote: On Fri, Nov 16, 2018 at 11:28:25AM +0800, Ming Lei wrote: > Even though .mq_kobj, ctx->kobj and q->kobj share same lifetime > from block layer's view, actually they don't

Re: [PATCH 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-15 Thread Ming Lei
On Fri, Nov 16, 2018 at 02:11:07PM +0800, jianchao.wang wrote: > > > On 11/16/18 11:28 AM, Ming Lei wrote: > ... > > > > +struct blk_mq_kobj { > > + struct kobject kobj; > > +}; > > + > > static void blk_mq_sysfs_release(struct kobject *kobj) > > { > > + struct blk_mq_kobj *mq_kobj =

Re: [PATCH 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-15 Thread Ming Lei
On Fri, Nov 16, 2018 at 01:52:05AM -0500, Sasha Levin wrote: > On Fri, Nov 16, 2018 at 11:28:25AM +0800, Ming Lei wrote: > > Even though .mq_kobj, ctx->kobj and q->kobj share same lifetime > > from block layer's view, actually they don't because userspace may > > grab one kobject anytime via

Re: [PATCH 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-15 Thread Sasha Levin
On Fri, Nov 16, 2018 at 11:28:25AM +0800, Ming Lei wrote: Even though .mq_kobj, ctx->kobj and q->kobj share same lifetime from block layer's view, actually they don't because userspace may grab one kobject anytime via sysfs, so each kobject's lifetime has to be independent, then the

Re: [PATCH 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-15 Thread jianchao.wang
On 11/16/18 11:28 AM, Ming Lei wrote: ... > > +struct blk_mq_kobj { > + struct kobject kobj; > +}; > + > static void blk_mq_sysfs_release(struct kobject *kobj) > { > + struct blk_mq_kobj *mq_kobj = container_of(kobj, struct blk_mq_kobj, > +

[PATCH 1/2] blk-mq: not embed .mq_kobj and ctx->kobj into queue instance

2018-11-15 Thread Ming Lei
Even though .mq_kobj, ctx->kobj and q->kobj share same lifetime from block layer's view, actually they don't because userspace may grab one kobject anytime via sysfs, so each kobject's lifetime has to be independent, then the objects(mq_kobj, ctx) which hosts its own kobject have to be allocated