Re: [PATCH] 2.5.46: access permission filesystem

Andrew Morton
2002-11-11T02:20:52Z

Olaf Dietsche wrote:
>
> Ben Clifford <benc@hawaga.org.uk> writes:
>
> > I still get those stack traces, though...
>
> I retested with CONFIG_PREEMPT=y and now I get those stack traces,
> too. So, it seems my code is not preempt safe.
>

It's not that your code is unsafe with preemption. It's just that
CONFIG_PREEMPT=y turns on the debugging infrastructure which allows
us to detect things like calling kmalloc(GFP_KERNEL) inside spinlock.

+static int accessfs_node_init(struct accessfs_direntry *parent, struct accessfs_entry *de, const char *name, size_t len, struct access_attr *attr, mode_t mode
+{
+ static unsigned long ino = 1;
+ de->name = kmalloc(len + 1, GFP_KERNEL);
+ ...
+
+static int accessfs_mknod(struct accessfs_direntry *dir, const char *name, struct access_attr *attr)
+{
+ ...
+ spin_lock(&accessfs_lock);
+ accessfs_node_init(dir, pe, name, strlen(name), attr, S_IFREG | attr->mo