Re: [PATCH 3/4] switch all filesystems over to d_obtain_alias

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 11 Aug 2008, Christoph Hellwig wrote:
> Index: linux-2.6/fs/fuse/inode.c
> ===================================================================
> --- linux-2.6.orig/fs/fuse/inode.c	2008-08-11 10:35:13.000000000 -0300
> +++ linux-2.6/fs/fuse/inode.c	2008-08-11 10:35:18.000000000 -0300
> @@ -596,12 +596,8 @@ static struct dentry *fuse_get_dentry(st
>  	if (inode->i_generation != handle->generation)
>  		goto out_iput;
>  
> -	entry = d_alloc_anon(inode);
> -	err = -ENOMEM;
> -	if (!entry)
> -		goto out_iput;
> -
> -	if (get_node_id(inode) != FUSE_ROOT_ID) {
> +	entry = d_obtain_alias(inode);
> +	if (entry && !IS_ERR(entry) && get_node_id(inode) != FUSE_ROOT_ID) {

checking for entry != NULL superfluous here.

>  		entry->d_op = &fuse_dentry_operations;
>  		fuse_invalidate_entry_cache(entry);
>  	}
> @@ -696,17 +692,14 @@ static struct dentry *fuse_get_parent(st
>  	name.name = "..";
>  	err = fuse_lookup_name(child_inode->i_sb, get_node_id(child_inode),
>  			       &name, &outarg, &inode);
> -	if (err && err != -ENOENT)
> -		return ERR_PTR(err);
> -	if (err || !inode)
> -		return ERR_PTR(-ESTALE);
> -
> -	parent = d_alloc_anon(inode);
> -	if (!parent) {
> -		iput(inode);
> -		return ERR_PTR(-ENOMEM);
> +	if (err) {
> +		if (err == -ENOENT)
> +			return -ESTALE;
> +		return err;
>  	}
> -	if (get_node_id(inode) != FUSE_ROOT_ID) {
> +
> +	parent = d_obtain_alias(inode);
> +	if (parent && !IS_ERR(parent) && get_node_id(inode) != FUSE_ROOT_ID) {

This is buggy: we want to return ERR_PTR(-ESTALE) for !inode, not
NULL.  So again, either d_obtain_alias() should turn !inode into
-ENOENT, (which would gain nothing in this case) or it should simply
expect inode to be not NULL.

Doing the !inode check in d_obtain_alias() seems only to confuse
things, instead of simplifying them.

Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux