linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	esandeen@redhat.com, aviro@redhat.com, haveblue@us.ibm.com
Subject: Re: [PATCH 3/3] have pipefs ensure i_ino uniqueness by calling iunique and hashing the inode
Date: Wed, 10 Jan 2007 21:24:48 +0000	[thread overview]
Message-ID: <20070110212448.GA4656@infradead.org> (raw)
In-Reply-To: <200701082047.l08KlHwK001925@dantu.rdu.redhat.com>

On Mon, Jan 08, 2007 at 03:47:17PM -0500, Jeff Layton wrote:
> This converts pipefs to use the new scheme. Here we're calling iunique to get
> a unique i_ino value for the new inode, and then hashing it afterward. We
> call iunique with a max_reserved value of 1 to avoid collision with the root
> inode.  Since the inode is now hashed, we need to take care that we end up in
> generic_delete_inode rather than generic_forget_inode or we'll create a nasty
> leak, so we clear_nlink when we destroy the pipe info.
> 
> I'm not certain that this is the right place to add the clear_nlink, though
> it does seem to work. I'm open to suggestions on a better place to put
> this, or of a better way to make sure that we end up with i_nlink == 0 at
> iput time.

You should Cc Dave Hansen as he's did the nlink helpers and works on
the per-mount readonly code that requires them.

> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> 
> diff --git a/fs/pipe.c b/fs/pipe.c
> index 68090e8..1d44ff0 100644
> --- a/fs/pipe.c
> +++ b/fs/pipe.c
> @@ -825,6 +825,7 @@ void free_pipe_info(struct inode *inode)
>  {
>  	__free_pipe_info(inode->i_pipe);
>  	inode->i_pipe = NULL;
> +	clear_nlink(inode);
>  }
>  
>  static struct vfsmount *pipe_mnt __read_mostly;
> @@ -871,6 +872,8 @@ static struct inode * get_pipe_inode(void)
>  	inode->i_uid = current->fsuid;
>  	inode->i_gid = current->fsgid;
>  	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
> +	inode->i_ino = iunique(pipe_mnt->mnt_sb, 1);
> +	insert_inode_hash(inode);
>  
>  	return inode;
>  
> -
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
---end quoted text---

  reply	other threads:[~2007-01-10 21:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-08 20:47 [PATCH 3/3] have pipefs ensure i_ino uniqueness by calling iunique and hashing the inode Jeff Layton
2007-01-10 21:24 ` Christoph Hellwig [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-01-16 18:57 Jeff Layton
2006-12-29 19:11 Jeff Layton
2007-01-26 12:51 ` Kirill Korotaev
2007-01-26 14:42   ` Jeff Layton
2007-01-26 15:12     ` Eric Dumazet
2007-01-30 15:04       ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070110212448.GA4656@infradead.org \
    --to=hch@infradead.org \
    --cc=aviro@redhat.com \
    --cc=esandeen@redhat.com \
    --cc=haveblue@us.ibm.com \
    --cc=jlayton@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).