On Wed, 2006-03-08 at 18:32 -0800, chandra seetharaman wrote:
> > 
> > A solution would probably involve making rcfs or configfs hold
> > refcounts for every object that's accessible through the filesystem,
> > and not drop them until the object is no longer accessible.
> 
> hmm.. My understanding was that configfs holds a reference to the item
> for each invocation (under the item) and the release function of the
> group (which leads to removal of class) is called only when the last
> reference is dropped (not when a rmdir is invoked). Will look at it
> closely.
> 

I was right in my understanding that configfs protects the item. But the
usage in rcfs is slightly wrong :)...

Try the attached patch and let me know how it goes.

Ideally, we do not need taskclass_release_group(), but there seems to
some problem, so i added it. i need to locate it (as of now it looks
like it is in configfs, but it might very well be my usage).

 fs/rcfs/rcfs.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

Index: linux-2.6.15/fs/rcfs/rcfs.c
===================================================================
--- linux-2.6.15.orig/fs/rcfs/rcfs.c
+++ linux-2.6.15/fs/rcfs/rcfs.c
@@ -34,8 +34,10 @@ static struct config_group *taskclass_ma
                        const char *);
 static void taskclass_release_group(struct config_group *,
                        struct config_item *);
+static void taskclass_release_item(struct config_item *);
 
 static struct configfs_item_operations taskclass_item_ops = {
+       .release                = taskclass_release_item,
        .show_attribute         = rcfs_attr_show,
        .store_attribute        = rcfs_attr_store,
 };
@@ -200,21 +202,25 @@ noclass:
 }
 
 static void
-taskclass_release_group(struct config_group *group, struct config_item *item)
+taskclass_release_item(struct config_item *item)
 {
-       /* Parameter "item" is the victim and "group" is its parent */
        struct rcfs_class *class = rcfs_class_item(item);
-       struct rcfs_class *parent = rcfs_class_group(group);
 
-       BUG_ON(!parent || !class->core);
+       BUG_ON(!class->core);
 
        ckrm_free_class(class->core);
        kfree(class->name);
        kfree(class);
-       config_item_put(item);
        return;
 }
 
+static void
+taskclass_release_group(struct config_group *group, struct config_item *item)
+{
+       config_item_put(item);
+       config_item_put(&group->cg_item);
+}
+
 static int
 rcfs_init_attr_arrays(void)
 {




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
ckrm-tech mailing list
https://lists.sourceforge.net/lists/listinfo/ckrm-tech

Reply via email to