[Devel,rh7,3/4] vfs: add vfs_select_inode() helper

Submitted by Maxim Patlasov on July 27, 2016, 1:07 a.m.

Details

Message ID 20160727010717.13798.31182.stgit@maxim-thinkpad
State New
Series "overlayfs: missing detection of hardlinks in vfs_rename() on overlayfs"
Headers show

Commit Message

Maxim Patlasov July 27, 2016, 1:07 a.m.
The patch backports upstream commit 54d5ca871e72f2bb172ec9323497f01cd5091ec7:

>    vfs: add vfs_select_inode() helper
>
>    Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

The part about vfs_open is omitted because we don't use
d_op->d_select_inode() there. Our version of vfs_select_inode()
doesn't have "open_flags" arg because our d_select_inode()
doesn't have it.

https://jira.sw.ru/browse/PSBM-47981

Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
---
 include/linux/dcache.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

Patch hide | download patch | download mbox

diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 267dbc6..897814a 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -529,4 +529,14 @@  static inline struct dentry *d_backing_dentry(struct dentry *upper)
 	return upper;
 }
 
+static inline struct inode *vfs_select_inode(struct dentry *dentry)
+{
+	struct inode *inode = d_inode(dentry);
+
+	if (inode && unlikely(dentry->d_flags & DCACHE_OP_SELECT_INODE))
+		inode = dentry->d_op->d_select_inode(dentry);
+
+	return inode;
+}
+
 #endif	/* __LINUX_DCACHE_H */