public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Michael Halcrow <mhalcrow@us.ibm.com>
Cc: David Howells <dhowells@redhat.com>,
	akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] eCryptfs: ino_t to u64 for filldir
Date: Thu, 31 Aug 2006 11:30:31 +0100	[thread overview]
Message-ID: <10689.1157020231@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <20060830211203.GA12953@us.ibm.com>

Michael Halcrow <mhalcrow@us.ibm.com> wrote:

> Note that I used to depend on iget() to wind up calling
> ecryptfs_read_inode(); it looks like iget5_locked() does not make that
> call,

Exactly so.  iget5_locked() returns with a new inode in a partially
constructed state, thus obviating the need for read_inode().  If you look at
the implementation of iget():

	static inline struct inode *iget(struct super_block *sb,
					 unsigned long ino)
	{
		struct inode *inode = iget_locked(sb, ino);

		if (inode && (inode->i_state & I_NEW)) {
			sb->s_op->read_inode(inode);
			unlock_new_inode(inode);
		}

		return inode;
	}

You can see that read_inode() is _only_ used there and can be dispensed with
if you're using iget_locked() or iget5_locked() directly.  This gives you more
control over what data you have available when initialising an inode.

> +	inode = iget5_locked(sb, lower_inode->i_ino, ecryptfs_inode_test,
> +			     ecryptfs_inode_set, lower_inode);

The second argument of iget5_locked() is a hash value.  I would use
lower_inode not lower_inode->i_ino as the former is fundamental to your search
and the latter irrelevant.

> +	inode->i_ino = lower_inode->i_ino;
> +	if (inode->i_state & I_NEW) {
> +		ecryptfs_init_inode(inode);
> +		unlock_new_inode(inode);
> +	}

Shouldn't the setting of i_ino be inside the if-statement?

You should set the lower inode pointer in ecryptfs_inode_set() so that the
ecryptfs inode is linked to the lower inode whilst inode_lock is held (see
get_new_inode()).  You could also set i_ino there too.  Consider this bit of
pseudocode:

	int ecryptfs_inode_set(struct inode *inode, void *lower_inode)
	{
		ecryptfs_set_lower_inode(inode, lower_inode);
		inode->i_ino = lower_inode->i_ino;
		return 0;
	}

David

  reply	other threads:[~2006-08-31 10:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-24 18:17 [PATCH 0/4] eCryptfs: Public key support Michael Halcrow
2006-08-24 18:18 ` [PATCH 1/4] eCryptfs: Netlink functions for public key Michael Halcrow
2006-08-25  3:54   ` Andrew Morton
2006-08-25 19:18     ` Michael Halcrow
2006-08-28 20:02       ` Andrew Morton
2006-08-24 18:19 ` [PATCH 2/4] eCryptfs: Public key header packets Michael Halcrow
2006-08-24 18:20 ` [PATCH 3/4] eCryptfs: Open-code flag manipulation Michael Halcrow
2006-08-25 21:42   ` David Howells
2006-08-24 18:20 ` [PATCH 4/4] eCryptfs: ino_t to u64 for filldir Michael Halcrow
2006-08-25 21:42   ` David Howells
2006-08-25 21:51   ` David Howells
2006-08-25 22:16     ` Michael Halcrow
2006-08-25 22:59       ` David Howells
2006-08-30 21:12         ` Michael Halcrow
2006-08-31 10:30           ` David Howells [this message]
2006-09-04 22:54             ` Michael Halcrow
2006-09-06  9:44               ` David Howells
2006-09-06 23:20                 ` Michael Halcrow
2006-09-07 10:28                   ` David Howells

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=10689.1157020231@warthog.cambridge.redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhalcrow@us.ibm.com \
    /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