Block: Trouble with kobject initialisation for blk_cmd_filter
Subsystems (2)
Hi all,
current usage of the kobject in struct blk_cmd_filter is flawed. Doing
# modprobe -r sd-mod && modprobe sd-mod while, for instance, a usb-stick is plugged in currently results in nasty warnings and a dump_stack(). Since blk_cmd_filter is embedded in struct request_queue, I don't see the need for a kobject anyway. What about the much simpler option of a struct attribute_group in this particular case?
This would imply that the cmd_filter subdirectory would appear under sda/queue/ rather than sda/ (which is probably the right place) but, alas, we have to keep compatibility in mind. So I've made some changes to sysfs along the way in order to provide a legacy symlink. I'd have to seperate these two changes for submission but I wanted to know your opinion about it all first.
Thinking about it now makes me wonder whether this is too much for a rc patch and whether we should just allocate the struct blk_cmd_filter dynamically and have done with it. Anyway, tell me what you think.
Regards,
Elias
---
Applies to 2.6.27-rc5-git7.
block/blk-sysfs.c | 6 -- block/blk.h | 6 ++ block/cmd-filter.c | 113 +++++++++++++++---------------------------------- fs/sysfs/symlink.c | 48 ++++++++++++++++---- include/linux/blkdev.h | 1 include/linux/sysfs.h | 2 6 files changed, 81 insertions(+), 95 deletions(-)
block/blk-sysfs.c +0 -6
@@ -9,12 +9,6 @@#include "blk.h" -struct queue_sysfs_entry { -struct attribute attr; -ssize_t (*show)(struct request_queue *,char *); -ssize_t (*store)(struct request_queue *,const char *,size_t ); -}; -static ssize_t queue_var_show (unsigned int var,char *page) {
block/blk.h +6 -0
@@ -10,6 +10,12 @@extern struct kmem_cache *blk_requestq_cachep;extern struct kobj_type blk_queue_ktype; +struct queue_sysfs_entry { +struct attribute attr; +ssize_t (*show)(struct request_queue *,char *); +ssize_t (*store)(struct request_queue *,const char *,size_t ); +}; +void init_request_from_bio (struct request *req,struct bio *bio);void blk_rq_bio_prep (struct request_queue *q,struct request *rq,struct bio *bio);
block/cmd-filter.c +35 -78
177 lines not on this page · raw message
fs/sysfs/symlink.c +38 -10
84 lines not on this page · raw message
include/linux/blkdev.h +0 -1
@@ -286,7 +286,6 @@ struct blk_queue_tag {struct blk_cmd_filter {unsigned long read_ok[BLK_SCSI_CMD_PER_LONG ];unsigned long write_ok[BLK_SCSI_CMD_PER_LONG ]; -struct kobject kobj; };struct request_queue
include/linux/sysfs.h +2 -0
@@ -116,6 +116,8 @@ int sysfs_add_file_to_group(struct kobject *kobj, const struct attribute *attr, const char *group);void sysfs_remove_file_from_group (struct kobject *kobj,const struct attribute *attr,const char *group); +int sysfs_create_link_to_group (struct kobject *kobj,struct kobject *target, +const char *grpname,const char *linkname);void sysfs_notify (struct kobject *kobj,char *dir,char *attr);
Quoted 17 lines · Elias Oltmanns
Hi all,
current usage of the kobject in struct
blk_cmd_filteris flawed. Doing# modprobe -r sd-mod && modprobe sd-mod while, for instance, a usb-stick is plugged in currently results in nasty warnings and a dump_stack(). Since blk_cmd_filter is embedded in struct request_queue, I don't see the need for a kobject anyway. What about the much simpler option of a struct attribute_group in this particular case?This would imply that the
cmd_filtersubdirectory would appear under sda/queue/ rather than sda/ (which is probably the right place) but, alas, we have to keep compatibility in mind. So I've made some changes to sysfs along the way in order to provide a legacy symlink. I'd have to seperate these two changes for submission but I wanted to know your opinion about it all first.
Quoted 3 lines
Thinking about it now makes me wonder whether this is too much for a rc patch and whether we should just allocate the struct
blk_cmd_filterdynamically and have done with it. Anyway, tell me what you think.
I think this patch is a step in the right direction, lets get rid of that pesky kobject just for the cmdfilter. Can you resend the patch _without_ the sysfs changes and link support? We haven't released a kernel with cmd filter support yet, so we can change the location still and not have to worry about compatability.
Signature · 1 line
Jens Axboe
Quoted 22 lines · On Tue, 9 Sep 2008 12:28:45 +0200 Jens Axboe <[email protected]> wrote:
Quoted 17 lines · Elias Oltmanns
Hi all,
current usage of the kobject in struct
blk_cmd_filteris flawed. Doing# modprobe -r sd-mod && modprobe sd-mod while, for instance, a usb-stick is plugged in currently results in nasty warnings and a dump_stack(). Since blk_cmd_filter is embedded in struct request_queue, I don't see the need for a kobject anyway. What about the much simpler option of a struct attribute_group in this particular case?This would imply that the
cmd_filtersubdirectory would appear under sda/queue/ rather than sda/ (which is probably the right place) but, alas, we have to keep compatibility in mind. So I've made some changes to sysfs along the way in order to provide a legacy symlink. I'd have to seperate these two changes for submission but I wanted to know your opinion about it all first.Quoted 3 lines
Thinking about it now makes me wonder whether this is too much for a rc patch and whether we should just allocate the struct
blk_cmd_filterdynamically and have done with it. Anyway, tell me what you think.
Quoted 5 lines
I think this patch is a step in the right direction, lets get rid of that pesky kobject just for the cmdfilter. Can you resend the patch _without_ the sysfs changes and link support? We haven't released a kernel with cmd filter support yet, so we can change the location still and not have to worry about compatability.
The sysfs changes looks too much for 2.6.27-rcX but without the sysfs changes, we have the cmdfilter under /sys/block/sda/queue/, right? We don't need to worry about compatibility, but /sys/block/sda is more appropriate? (though I don't think that the cmd filter is a good idea so I don't care much).
Jens, would it be better to just disable the cmdfilter stuff for 2.6.27? It's too late for another try to fix this broken stuff, I guess.
Quoted 31 lines · FUJITA Tomonori
Quoted 22 lines · On Tue, 9 Sep 2008 12:28:45 +0200 Jens Axboe <[email protected]> wrote:
Quoted 17 lines · Elias Oltmanns
Hi all,
current usage of the kobject in struct
blk_cmd_filteris flawed. Doing# modprobe -r sd-mod && modprobe sd-mod while, for instance, a usb-stick is plugged in currently results in nasty warnings and a dump_stack(). Since blk_cmd_filter is embedded in struct request_queue, I don't see the need for a kobject anyway. What about the much simpler option of a struct attribute_group in this particular case?This would imply that the
cmd_filtersubdirectory would appear under sda/queue/ rather than sda/ (which is probably the right place) but, alas, we have to keep compatibility in mind. So I've made some changes to sysfs along the way in order to provide a legacy symlink. I'd have to seperate these two changes for submission but I wanted to know your opinion about it all first.Quoted 3 lines
Thinking about it now makes me wonder whether this is too much for a rc patch and whether we should just allocate the struct
blk_cmd_filterdynamically and have done with it. Anyway, tell me what you think.Quoted 5 lines
I think this patch is a step in the right direction, lets get rid of that pesky kobject just for the cmdfilter. Can you resend the patch _without_ the sysfs changes and link support? We haven't released a kernel with cmd filter support yet, so we can change the location still and not have to worry about compatability.
Quoted 5 lines
The sysfs changes looks too much for 2.6.27-rcX but without the sysfs changes, we have the cmdfilter under
/sys/block/sda/queue/, right? We don't need to worry about compatibility, but/sys/block/sdais more appropriate? (though I don't think that the cmd filter is a good idea so I don't care much).
I agree, under sda/ makes a lot more sense than under sda/queue/
Quoted 3 lines
Jens, would it be better to just disable the cmdfilter stuff for 2.6.27? It's too late for another try to fix this broken stuff, I guess.
Yeah, it's certainly starting to look like it... The amount of changes to unbreak it are too large to submit now, so lets postpone it until 2.6.28.
Signature · 1 line
Jens Axboe
Quoted 1 line · Jens Axboe
On Tue, Sep 09 2008, FUJITA Tomonori wrote:
[...]
Quoted 7 lines
Quoted 5 lines
The sysfs changes looks too much for 2.6.27-rcX but without the sysfs changes, we have the cmdfilter under
/sys/block/sda/queue/, right? We don't need to worry about compatibility, but/sys/block/sdais more appropriate? (though I don't think that the cmd filter is a good idea so I don't care much).I agree, under sda/ makes a lot more sense than under sda/queue/
Well, but why is it in struct request_queue then? Is it going to be moved back to the gendisk eventually?
Quoted 8 lines
Quoted 4 lines
Jens, would it be better to just disable the cmdfilter stuff for 2.6.27? It's too late for another try to fix this broken stuff, I guess.
Yeah, it's certainly starting to look like it... The amount of changes to unbreak it are too large to submit now, so lets postpone it until 2.6.28.
I won't bother with the patch against 2.6.27-rc then. What about 2.6.28 though? Not that I really care whether the cmd_filter appears under sda/ or sda/queue/, I just wanted to point out that the sysfs code can be simplified considerably. The things I do care about, of course, are the two problems that have been fixed by my patch: There are no spurious warnings and stack dumps due to kobject reinitialisation and the cmd_filter sysfs interface inherits proper locking. Please take this into consideration if you decide not to reuse the queue layer sysfs interface. Otherwise, just let me know if you want me to port the patch (just the cmd_filter part or the sysfs stuff as well) to next-200809..
Regards,
Elias
Quoted 9 lines · On Tue, 09 Sep 2008 18:57:05 +0200 Elias Oltmanns <[email protected]> wrote:
Quoted 1 line · Jens Axboe
On Tue, Sep 09 2008, FUJITA Tomonori wrote:
[...]
Quoted 6 lines
Quoted 5 lines
The sysfs changes looks too much for 2.6.27-rcX but without the sysfs changes, we have the cmdfilter under
/sys/block/sda/queue/, right? We don't need to worry about compatibility, but/sys/block/sdais more appropriate? (though I don't think that the cmd filter is a good idea so I don't care much).
Quoted 4 lines
Quoted 1 line
I agree, under sda/ makes a lot more sense than under sda/queue/
Well, but why is it in struct
request_queuethen? Is it going to be moved back to the gendisk eventually?
I don't think that we can. It broke many things so I moved it to request_queue.
http://marc.info/?l=linux-scsi&m=121706317031777&w=2
Well, it turned out that it doesn't work too... Sorry about that.
Quoted 33 lines · Jens Axboe
Quoted 32 lines · FUJITA Tomonori
On Tue, 9 Sep 2008 12:28:45 +0200
Quoted 27 lines · Jens Axboe
Quoted 17 lines · Elias Oltmanns
Hi all,
current usage of the kobject in struct
blk_cmd_filteris flawed. Doing# modprobe -r sd-mod && modprobe sd-mod while, for instance, a usb-stick is plugged in currently results in nasty warnings and a dump_stack(). Since blk_cmd_filter is embedded in struct request_queue, I don't see the need for a kobject anyway. What about the much simpler option of a struct attribute_group in this particular case?This would imply that the
cmd_filtersubdirectory would appear under sda/queue/ rather than sda/ (which is probably the right place) but, alas, we have to keep compatibility in mind. So I've made some changes to sysfs along the way in order to provide a legacy symlink. I'd have to seperate these two changes for submission but I wanted to know your opinion about it all first.Quoted 3 lines
Thinking about it now makes me wonder whether this is too much for a rc patch and whether we should just allocate the struct
blk_cmd_filterdynamically and have done with it. Anyway, tell me what you think.I think this patch is a step in the right direction, lets get rid of that pesky kobject just for the cmdfilter. Can you resend the patch _without_ the sysfs changes and link support? We haven't released a kernel with cmd filter support yet, so we can change the location still and not have to worry about compatability.
Quoted 5 lines
Quoted 5 lines
The sysfs changes looks too much for 2.6.27-rcX but without the sysfs changes, we have the cmdfilter under
/sys/block/sda/queue/, right? We don't need to worry about compatibility, but/sys/block/sdais more appropriate? (though I don't think that the cmd filter is a good idea so I don't care much).
What exactly does that mean? Is there any point in fixing this particular bug for 2.6.28 or will the whole cmd-filter infrastructure have to be modified in a more general way in order to address other shortcomings?
Quoted 10 lines
I agree, under sda/ makes a lot more sense than under sda/queue/
Quoted 3 lines
Jens, would it be better to just disable the cmdfilter stuff for 2.6.27? It's too late for another try to fix this broken stuff, I guess.
Yeah, it's certainly starting to look like it... The amount of changes to unbreak it are too large to submit now, so lets postpone it until 2.6.28.
As far as I can make out, nothing has happened yet at this front. I've just verified that reverting the following commits (in that order) seems to be working nicely for me:
2dc75d3c3b4bb23b431db7a4a778971b94beab5c623f14e507b852eabf5439370406a452e5b952b272d4f7950b07de85a76
Is that what you had in mind? Will you take care of it?
Regards,
Elias
Quoted 22 lines · On Mon, 15 Sep 2008 21:55:15 +0200 Elias Oltmanns <[email protected]> wrote:
Quoted 7 lines
Quoted 3 lines
Jens, would it be better to just disable the cmdfilter stuff for 2.6.27? It's too late for another try to fix this broken stuff, I guess.
Yeah, it's certainly starting to look like it... The amount of changes to unbreak it are too large to submit now, so lets postpone it until 2.6.28.
As far as I can make out, nothing has happened yet at this front. I've just verified that reverting the following commits (in that order) seems to be working nicely for me:
2dc75d3c3b4bb23b431db7a4a778971b94beab5c623f14e507b852eabf5439370406a452e5b952b272d4f7950b07de85a76
Quoted 1 line
Is that what you had in mind? Will you take care of it?
The following commit should disable the command filter feature:
commit 2dc75d3c3b49c64fd26b4832a7efb75546cb3fc5
Author: Jens Axboe <[email protected]> Date: Thu Sep 11 14:20:23 2008 +0200
block: disable sysfs parts of the disk command filter
Quoted 27 lines · FUJITA Tomonori
Quoted 22 lines · On Mon, 15 Sep 2008 21:55:15 +0200 Elias Oltmanns <[email protected]> wrote:
Quoted 7 lines
Quoted 3 lines
Jens, would it be better to just disable the cmdfilter stuff for 2.6.27? It's too late for another try to fix this broken stuff, I guess.
Yeah, it's certainly starting to look like it... The amount of changes to unbreak it are too large to submit now, so lets postpone it until 2.6.28.
As far as I can make out, nothing has happened yet at this front. I've just verified that reverting the following commits (in that order) seems to be working nicely for me:
2dc75d3c3b4bb23b431db7a4a778971b94beab5c623f14e507b852eabf5439370406a452e5b952b272d4f7950b07de85a76Quoted 1 line
Is that what you had in mind? Will you take care of it?
Quoted 7 lines
The following commit should disable the command filter feature:
commit
2dc75d3c3b49c64fd26b4832a7efb75546cb3fc5Author: Jens Axboe <[email protected]> Date: Thu Sep 11 14:20:23 2008 +0200block: disable sysfs parts of the disk command filter
Right, so it really is only the sysfs interface of the command filter that causes problems, is it? Does that also mean that you are not unhappy with the command filter in linux-next either except for the sysfs interfae? I didn't realise that, sorry for the noise.
Regards,
Elias
Quoted 30 lines · On Mon, 15 Sep 2008 22:49:13 +0200 Elias Oltmanns <[email protected]> wrote:
Quoted 29 lines · FUJITA Tomonori
Quoted 22 lines · On Mon, 15 Sep 2008 21:55:15 +0200 Elias Oltmanns <[email protected]> wrote:
Quoted 7 lines
Quoted 3 lines
Jens, would it be better to just disable the cmdfilter stuff for 2.6.27? It's too late for another try to fix this broken stuff, I guess.
Yeah, it's certainly starting to look like it... The amount of changes to unbreak it are too large to submit now, so lets postpone it until 2.6.28.
As far as I can make out, nothing has happened yet at this front. I've just verified that reverting the following commits (in that order) seems to be working nicely for me:
2dc75d3c3b4bb23b431db7a4a778971b94beab5c623f14e507b852eabf5439370406a452e5b952b272d4f7950b07de85a76Quoted 1 line
Is that what you had in mind? Will you take care of it?
The following commit should disable the command filter feature:
Quoted 8 lines
Quoted 5 lines
commit
2dc75d3c3b49c64fd26b4832a7efb75546cb3fc5Author: Jens Axboe <[email protected]> Date: Thu Sep 11 14:20:23 2008 +0200block: disable sysfs parts of the disk command filter
Right, so it really is only the sysfs interface of the command filter that causes problems, is it?
Yeah, the way to use kobject for the sysfs interface caused the problems. In addition, the commit log, 'block: disable sysfs parts of the disk command filter' states that it disables only the sysfs interface but the commit changes all the users not to use the command filter (that is, nobody uses the command filter now). We should not see any problems due to the command filter.
Quoted 3 lines
Does that also mean that you are not
unhappy with the command filter in linux-next either except for the sysfs interfae? I didn't realise that, sorry for the noise.
I guess that it would be better to rethink about how to implement the sysfs interface because the current command filter is different from the initial implementation. We could do better (simpler).