linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: yan <clouds.yan@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] proc : no need to initialize proc_inode->fd in proc_get_inode
Date: Tue, 4 Sep 2012 15:49:37 -0700	[thread overview]
Message-ID: <20120904154937.e39a728e.akpm@linux-foundation.org> (raw)
In-Reply-To: <1346681648-21427-3-git-send-email-clouds.yan@gmail.com>

On Mon,  3 Sep 2012 22:14:06 +0800
yan <clouds.yan@gmail.com> wrote:

> It has been initialized in proc_alloc_inode.
>
> ...

I think what you mean here is that the preceding call to iget_locked()
will call alloc_inode() which will call proc_alloc_inode() which clears
pro_inode.fd.  

And if iget_locked() instead found the inode via find_inode_fast(),
that inode will not have I_NEW set so this change has no effect.

Yes?  Please do spell things out in this level of detail so that others
can check your logic.

> --- a/fs/proc/inode.c
> +++ b/fs/proc/inode.c
> @@ -450,7 +450,6 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
>  		return NULL;
>  	if (inode->i_state & I_NEW) {
>  		inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
> -		PROC_I(inode)->fd = 0;
>  		PROC_I(inode)->pde = de;
>  
>  		if (de->mode) {

I provided this changelog:

: proc_get_inode() obtains the inode via a call to iget_locked(). 
: iget_locked() calls alloc_inode() which will call proc_alloc_inode() which
: clears proc_inode.fd, so there is no need to clear this field in
: proc_get_inode().
:
: If iget_locked() instead found the inode via find_inode_fast(), that inode
: will not have I_NEW set so this change has no effect.


  reply	other threads:[~2012-09-04 22:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03 14:14 [PATCH 0/3] Trivial code clean for procfs yan
2012-09-03 14:14 ` [PATCH 1/3] proc: return -ENOMEM when inode allocation failed yan
2012-09-04  0:38   ` Ryan Mallon
2012-09-04  3:02   ` Cong Wang
2012-09-04  9:22     ` yan yan
2012-09-04 22:41       ` Andrew Morton
2012-09-05  7:15       ` Cong Wang
2012-09-05  7:57         ` yan yan
2012-09-03 14:14 ` [PATCH 2/3] proc : no need to initialize proc_inode->fd in proc_get_inode yan
2012-09-04 22:49   ` Andrew Morton [this message]
2012-09-03 14:14 ` [PATCH 3/3] proc: use kzalloc instead of kmalloc and memset yan
2012-09-04  0:44   ` Ryan Mallon
2012-09-04  9:10     ` yan yan

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=20120904154937.e39a728e.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=clouds.yan@gmail.com \
    --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).