Re: Block: Trouble with kobject initialisation for blk_cmd_filter

Previous thread: Benchmarking results: DSS elapsed time values w/ rq_affinity=0/1 - Jens' for-2.6.28 tree by Alan D. Brunelle on Friday, September 5, 2008 - 9:19 am. (5 messages)

Next thread: [PATCH 1/3] 24-bit types: typedef and macros for accessing 3-byte arrays as integers by Chris Leech on Friday, September 5, 2008 - 9:57 am. (22 messages)
From: Elias Oltmanns
Date: Friday, September 5, 2008 - 9:48 am

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(-)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 304ec73..0120c8e 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -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)
 {
diff --git a/block/blk.h b/block/blk.h
index c79f30e..9ab0d6a 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -10,6 +10,12 @@
 extern struct kmem_cache *blk_requestq_cachep;
 extern struct kobj_type ...
From: Jens Axboe
Date: Tuesday, September 9, 2008 - 3:28 am

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.

-- 
Jens Axboe

--

From: FUJITA Tomonori
Date: Tuesday, September 9, 2008 - 5:45 am

On Tue, 9 Sep 2008 12:28:45 +0200

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.
--

From: Jens Axboe
Date: Tuesday, September 9, 2008 - 6:18 am

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.

-- 
Jens Axboe

--

From: Elias Oltmanns
Date: Tuesday, September 9, 2008 - 9:57 am

Well, but why is it in struct request_queue then? Is it going to be

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
--

From: FUJITA Tomonori
Date: Tuesday, September 9, 2008 - 7:43 pm

On Tue, 09 Sep 2008 18:57:05 +0200

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.
--

From: Elias Oltmanns
Date: Monday, September 15, 2008 - 12:55 pm

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

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:

2dc75d3c3b4
bb23b431db7
a4a778971b9
4beab5c623f
14e507b852e
abf54393704
06a452e5b95
2b272d4f795
0b07de85a76

Is that what you had in mind? Will you take care of it?

Regards,

Elias
--

From: FUJITA Tomonori
Date: Monday, September 15, 2008 - 1:17 pm

On Mon, 15 Sep 2008 21:55:15 +0200

The following commit should disable the command filter feature:

commit 2dc75d3c3b49c64fd26b4832a7efb75546cb3fc5
Author: Jens Axboe <jens.axboe@oracle.com>
Date:   Thu Sep 11 14:20:23 2008 +0200

    block: disable sysfs parts of the disk command filter
--

From: Elias Oltmanns
Date: Monday, September 15, 2008 - 1:49 pm

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
--

From: FUJITA Tomonori
Date: Monday, September 15, 2008 - 2:31 pm

On Mon, 15 Sep 2008 22:49:13 +0200

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

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).
--

Previous thread: Benchmarking results: DSS elapsed time values w/ rq_affinity=0/1 - Jens' for-2.6.28 tree by Alan D. Brunelle on Friday, September 5, 2008 - 9:19 am. (5 messages)

Next thread: [PATCH 1/3] 24-bit types: typedef and macros for accessing 3-byte arrays as integers by Chris Leech on Friday, September 5, 2008 - 9:57 am. (22 messages)