Re: [PATCH 09/31] IGET: Stop BFS from using iget() and read_inode() [try #3]

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

 



It is very well possible that I misunderstand the locking order here,
but FWIW:

David Howells wrote:
> diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
> index f346eb1..76798c9 100644
> --- a/fs/bfs/inode.c
> +++ b/fs/bfs/inode.c
> @@ -32,25 +32,29 @@ MODULE_LICENSE("GPL");
>  
>  void dump_imap(const char *prefix, struct super_block * s);
>  
> -static void bfs_read_inode(struct inode * inode)
> +struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
>  {
> -	unsigned long ino = inode->i_ino;
>  	struct bfs_inode * di;
>  	struct buffer_head * bh;
> +	struct inode *inode;
>  	int block, off;
>  
> +	inode = iget_locked(sb, ino);

after this

> +	if (IS_ERR(inode))
> +		return ERR_PTR(-ENOMEM);
> +	if (!(inode->i_state & I_NEW))
> +		return inode;

Don't you have to unlock_new_inode(inode) before returning?

> +
>  	if (ino < BFS_ROOT_INO || ino > BFS_SB(inode->i_sb)->si_lasti) {
>  		printf("Bad inode number %s:%08lx\n", inode->i_sb->s_id, ino);
> -		make_bad_inode(inode);
> -		return;
> +		goto error;
>  	}
>  
>  	block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1;
>  	bh = sb_bread(inode->i_sb, block);
>  	if (!bh) {
>  		printf("Unable to read inode %s:%08lx\n", inode->i_sb->s_id, ino);
> -		make_bad_inode(inode);
> -		return;
> +		goto error;
>  	}
>  
>  	off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
> @@ -85,6 +89,12 @@ static void bfs_read_inode(struct inode * inode)
>  	BFS_I(inode)->i_dsk_ino = le16_to_cpu(di->i_ino); /* can be 0 so we store a copy */
>  
>  	brelse(bh);
> +	unlock_new_inode(inode);
> +	return inode;
> +
> +error:

and also here?

> +	iget_failed(inode);
> +	return ERR_PTR(-EIO);
>  }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux