Re: [RFC PATCH 3/3] sysfs: care-free suicide for sysfs files

From: Tejun Heo
Date: Thu Mar 26 2009 - 01:24:48 EST


Hello,

Alex Chiang wrote:
> diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
> index 39320a5..993edd1 100644
> --- a/fs/sysfs/dir.c
> +++ b/fs/sysfs/dir.c
> @@ -583,6 +583,8 @@ void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt)
> sd->s_sibling = NULL;
>
> sysfs_drop_dentry(sd);
> + if (sysfs_type(sd) == SYSFS_KOBJ_ATTR)
> + sysfs_file_check_suicide(sd);
> sysfs_deactivate(sd);
> sysfs_put(sd);
> }

I think there's a hole here. sysfs_file_check_suicide() should be
done inside sysfs_deactivate() such that commiting suicide atomically
deactivates the sd. This will solve the multiple writes to suicide
node problem nicely.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/