linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Goldwyn Rodrigues <rgoldwyn@suse.de>
To: miklos@szeredi.hu
Cc: linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-nfs@vger.kernel.org, Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: [PATCH 2/3] vfs: Add d_select_inode for overlayfs translation
Date: Tue,  1 Mar 2016 12:12:07 -0600	[thread overview]
Message-ID: <1456855928-29913-3-git-send-email-rgoldwyn@suse.de> (raw)
In-Reply-To: <1456855928-29913-1-git-send-email-rgoldwyn@suse.de>

From: Goldwyn Rodrigues <rgoldwyn@suse.com>

d_select_inode() is a helper function to translate dentry to inodes
while using in conjunction with overlayfs so dentries evaluate to
true lower inodes.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 include/linux/dcache.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 7781ce11..dbaa420 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -541,6 +541,21 @@ static inline struct inode *d_inode(const struct dentry *dentry)
 }
 
 /**
+ * d_select_inode - Get the actual inode of this dentry
+ * @dentry: The dentry to query
+ * @flags: open flags passed
+ *
+ * This is the helper to select the underlying true inode associated with
+ * a dentry to cover cases of translating overlay filesystem.
+ */
+static inline struct inode *d_select_inode(struct dentry *dentry, int flags)
+{
+	if (dentry->d_flags & DCACHE_OP_SELECT_INODE)
+		return dentry->d_op->d_select_inode(dentry, flags);
+	return dentry->d_inode;
+}
+
+/**
  * d_inode_rcu - Get the actual inode of this dentry with ACCESS_ONCE()
  * @dentry: The dentry to query
  *
-- 
2.6.2


  parent reply	other threads:[~2016-03-01 18:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 18:12 [PATCH 0/3] Fix overlayfs with NFS as lowerdir Goldwyn Rodrigues
2016-03-01 18:12 ` [PATCH 1/3] ovl: Add d_select_inode to reval dentry operations Goldwyn Rodrigues
2016-03-01 18:12 ` Goldwyn Rodrigues [this message]
2016-03-01 18:12 ` [PATCH 3/3] nfs: Store and use inode in nfs_open_context Goldwyn Rodrigues
2016-03-01 20:46   ` Trond Myklebust
2016-03-02 14:27     ` Goldwyn Rodrigues
2016-03-02 14:31       ` Trond Myklebust
2016-03-02 14:38         ` Trond Myklebust
2016-03-02 14:43           ` Miklos Szeredi
2016-03-02 15:57             ` Goldwyn Rodrigues
2016-03-03  8:16               ` Miklos Szeredi
2016-03-04 10:17                 ` Miklos Szeredi
2016-03-04 13:41                   ` Trond Myklebust
2016-03-04 14:52                     ` Goldwyn Rodrigues

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=1456855928-29913-3-git-send-email-rgoldwyn@suse.de \
    --to=rgoldwyn@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=rgoldwyn@suse.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;
as well as URLs for NNTP newsgroup(s).