All of lore.kernel.org
 help / color / mirror / Atom feed
* [added to the 3.18 stable tree] VFS: Introduce inode-getting helpers for layered/unioned fs environments
@ 2015-07-31  2:10 Sasha Levin
  2015-07-31  2:10 ` [added to the 3.18 stable tree] fs: Add helper functions for permanently empty directories Sasha Levin
                   ` (42 more replies)
  0 siblings, 43 replies; 46+ messages in thread
From: Sasha Levin @ 2015-07-31  2:10 UTC (permalink / raw)
  To: stable, stable-commits; +Cc: David Howells, Al Viro, Sasha Levin

From: David Howells <dhowells@redhat.com>

This patch has been added to the 3.18 stable tree. If you have any
objections, please let us know.

===============

[ Upstream commit 155e35d4daa804582f75acaa2c74ec797a89c615 ]

Introduce some function for getting the inode (and also the dentry) in an
environment where layered/unioned filesystems are in operation.

The problem is that we have places where we need *both* the union dentry and
the lower source or workspace inode or dentry available, but we can only have
a handle on one of them.  Therefore we need to derive the handle to the other
from that.

The idea is to introduce an extra field in struct dentry that allows the union
dentry to refer to and pin the lower dentry.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 include/linux/dcache.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 1c2f1b8..e0ca761 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -468,4 +468,61 @@ static inline unsigned long vfs_pressure_ratio(unsigned long val)
 {
 	return mult_frac(val, sysctl_vfs_cache_pressure, 100);
 }
+
+/**
+ * d_inode - Get the actual inode of this dentry
+ * @dentry: The dentry to query
+ *
+ * This is the helper normal filesystems should use to get at their own inodes
+ * in their own dentries and ignore the layering superimposed upon them.
+ */
+static inline struct inode *d_inode(const struct dentry *dentry)
+{
+	return dentry->d_inode;
+}
+
+/**
+ * d_inode_rcu - Get the actual inode of this dentry with ACCESS_ONCE()
+ * @dentry: The dentry to query
+ *
+ * This is the helper normal filesystems should use to get at their own inodes
+ * in their own dentries and ignore the layering superimposed upon them.
+ */
+static inline struct inode *d_inode_rcu(const struct dentry *dentry)
+{
+	return ACCESS_ONCE(dentry->d_inode);
+}
+
+/**
+ * d_backing_inode - Get upper or lower inode we should be using
+ * @upper: The upper layer
+ *
+ * This is the helper that should be used to get at the inode that will be used
+ * if this dentry were to be opened as a file.  The inode may be on the upper
+ * dentry or it may be on a lower dentry pinned by the upper.
+ *
+ * Normal filesystems should not use this to access their own inodes.
+ */
+static inline struct inode *d_backing_inode(const struct dentry *upper)
+{
+	struct inode *inode = upper->d_inode;
+
+	return inode;
+}
+
+/**
+ * d_backing_dentry - Get upper or lower dentry we should be using
+ * @upper: The upper layer
+ *
+ * This is the helper that should be used to get the dentry of the inode that
+ * will be used if this dentry were opened as a file.  It may be the upper
+ * dentry or it may be a lower dentry pinned by the upper.
+ *
+ * Normal filesystems should not use this to access their own dentries.
+ */
+static inline struct dentry *d_backing_dentry(struct dentry *upper)
+{
+	return upper;
+}
+
 #endif	/* __LINUX_DCACHE_H */
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2015-07-31  7:06 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-31  2:10 [added to the 3.18 stable tree] VFS: Introduce inode-getting helpers for layered/unioned fs environments Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] fs: Add helper functions for permanently empty directories Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] sysctl: Allow creating permanently empty directories that serve as mountpoints Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] proc: Allow creating permanently empty directories that serve as mount points Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] kernfs: Add support for always empty directories Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] sysfs: Add support for permanently empty directories to serve as mount points Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] mnt: Update fs_fully_visible to test for permanently empty directories Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] sysfs: Create mountpoints with sysfs_create_mount_point Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] ACPI / init: Switch over platform to the ACPI mode later Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] iio: accel: kxcjk-1013: add the "KXCJ9000" ACPI id Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] spi: pl022: Specify 'num-cs' property as required in devicetree binding Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] iio: twl4030-madc: Pass the IRQF_ONESHOT flag Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] ALSA: usb-audio: Add support for Akai MPC Element USB MIDI controller Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] ALSA: usb-audio: Fix audio output on Roland SC-D70 sound module Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] ALSA: usb-audio: Add MIDI support for Steinberg MI2/MI4 Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] dm btree remove: fix bug in redistribute3 Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] kbuild: Allow arch Makefiles to override {cpp,ld,c}flags Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] ARC: Override toplevel default -O2 with -O3 Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] crypto: omap-des - Fix unmapping of dma channels Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] USB: option: add 2020:4000 ID Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] USB: cp210x: add ID for Aruba Networks controllers Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] dm btree: silence lockdep lock inversion in dm_btree_del() Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] usb: musb: host: rely on port_mode to call musb_start() Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] usb: f_mass_storage: limit number of reported LUNs Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] s390/sclp: clear upper register halves in _sclp_print_early Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] drm: add a check for x/y in drm_mode_setcrtc Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] bio integrity: do not assume bio_integrity_pool exists if bioset exists Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] ARM: dts: mx23: fix iio-hwmon support Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] tracing: Have branch tracer use recursive field of task struct Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] drivers: net: cpsw: fix crash while accessing second slave ethernet interface Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] USB: serial: Destroy serial_minors IDR on module exit Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] Btrfs: fix memory leak in the extent_same ioctl Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] can: rcar_can: fix IRQ check Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] ARC: make sure instruction_pointer() returns unsigned value Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] can: c_can: Fix default pinmux glitch at init Sasha Levin
2015-07-31  6:30   ` Heiko Carstens
2015-07-31  7:06   ` Marc Kleine-Budde
2015-07-31  2:10 ` [added to the 3.18 stable tree] Btrfs: fix file corruption after cloning inline extents Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] staging: vt6656: check ieee80211_bss_conf bssid not NULL Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] st: null pointer dereference panic caused by use after kref_put by st_open Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] drm/radeon: add a dpm quirk for Sapphire Radeon R9 270X 2GB GDDR5 Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] drm/radeon: Don't flush the GART TLB if rdev->gart.ptr == NULL Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] drm/radeon: fix user ptr race condition Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] genirq: Prevent resend to interrupts marked IRQ_NESTED_THREAD Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] ARM: 8404/1: dma-mapping: fix off-by-one error in bitmap size check Sasha Levin
2015-07-31  2:10 ` [added to the 3.18 stable tree] Revert "can: fix loss of CAN frames in raw_rcv" Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.