lkml.org 
[lkml]   [2006]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 12/16] GFS2: Mounting & sysfs interface
Steven Whitehouse wrote:
> +int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
> +{
> + int error;
> +
> + sdp->sd_kobj.kset = &gfs2_kset;
> + sdp->sd_kobj.ktype = &gfs2_ktype;
> +
> + error = kobject_set_name(&sdp->sd_kobj, "%s", sdp->sd_table_name);
> + if (error)
> + goto fail;
> +
> + error = kobject_register(&sdp->sd_kobj);
> + if (error)
> + goto fail;
> +
> + error = sysfs_create_group(&sdp->sd_kobj, &lockstruct_group);
> + if (error)
> + goto fail_reg;
> +
> + error = sysfs_create_group(&sdp->sd_kobj, &counters_group);
> + if (error)
> + goto fail_lockstruct;
> +
> + error = sysfs_create_group(&sdp->sd_kobj, &args_group);
> + if (error)
> + goto fail_counters;
> +
> + error = sysfs_create_group(&sdp->sd_kobj, &tune_group);
> + if (error)
> + goto fail_args;
> +
> + return 0;

Hello,

last time I tried to use "bare" sysfs functions to create my sysfs
hierarchy I ended up with a problem that the module refcount is not
increased when those sysfs files are opened. So I could open a sysfs
file from userspace, do rmmod and enjoy oops.

Then I started using the class and class_device stuff, which have an
.owner field, and all became fine.

I'm not sure if this is a problem of sysfs, but I suspect it could take
care of module refcount better.

In your patch, I looked for THIS_MODULE pattern and did not find. I did
not try, but I suspect your code is not devoid of the problem I
described. So, this is just FYI and may be not the case.

--
Best regards, Artem B. Bityutskiy
Oktet Labs (St. Petersburg), Software Engineer.
+7 812 4286709 (office) +7 911 2449030 (mobile)
E-mail: dedekind@oktetlabs.ru, Web: www.oktetlabs.ru
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-04-25 18:55    [W:0.048 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site