Re: [RFC 2/2] sysfs_rename_dir-cleanup
From: Greg KH
Date: Tue May 11 2004 - 18:48:42 EST
On Fri, May 09, 2003 at 03:39:57PM +0530, Maneesh Soni wrote:
> diff -puN fs/sysfs/dir.c~sysfs_rename_dir-cleanup fs/sysfs/dir.c
> --- linux-2.6.6-rc3-mm2/fs/sysfs/dir.c~sysfs_rename_dir-cleanup 2004-05-05 18:22:39.000000000 +0530
> +++ linux-2.6.6-rc3-mm2-maneesh/fs/sysfs/dir.c 2004-05-05 18:33:54.000000000 +0530
> @@ -162,15 +162,16 @@ restart:
> dput(dentry);
> }
>
> -void sysfs_rename_dir(struct kobject * kobj, const char *new_name)
> +int sysfs_rename_dir(struct kobject * kobj, const char *new_name)
> {
> + int error = 0;
> struct dentry * new_dentry, * parent;
>
> if (!strcmp(kobject_name(kobj), new_name))
> - return;
> + return -EINVAL;
>
> if (!kobj->parent)
> - return;
> + return -EINVAL;
>
> down_write(&sysfs_rename_sem);
> parent = kobj->parent->dentry;
> @@ -179,13 +180,16 @@ void sysfs_rename_dir(struct kobject * k
> new_dentry = sysfs_get_dentry(parent, new_name);
> if (!IS_ERR(new_dentry)) {
> if (!new_dentry->d_inode) {
> - d_move(kobj->dentry, new_dentry);
> - kobject_set_name(kobj,new_name);
> + error = kobject_set_name(kobj,new_name);
> + if (!error)
> + d_move(kobj->dentry, new_dentry);
> }
> dput(new_dentry);
> }
> up(&parent->d_inode->i_sem);
> up_write(&sysfs_rename_sem);
> +
> + return error;
> }
>
> EXPORT_SYMBOL(sysfs_create_dir);
This second chunk fails miserably. I don't know what you diffed it
against, as it doesn't look like anything that I currently have in that
function...
Anyway, can you grab the next -mm release and rediff this patch against
the bk-driver-2.6 tree, or even against a clean 2.6.6 tree so that I can
apply it?
thanks,
greg k-h
-
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/