diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-22 20:42:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-22 20:42:14 -0500 |
commit | be5e6616dd74e17fdd8e16ca015cfef94d49b467 (patch) | |
tree | a18826e557f0d6636f1e05a4ec30d584ed981a2b /fs/dcache.c | |
parent | 90c453ca2214394eec602d98e6cb92d151908493 (diff) | |
parent | 0a280962dc6e117e0e4baa668453f753579265d9 (diff) |
Merge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more vfs updates from Al Viro:
"Assorted stuff from this cycle. The big ones here are multilayer
overlayfs from Miklos and beginning of sorting ->d_inode accesses out
from David"
* 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (51 commits)
autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation
procfs: fix race between symlink removals and traversals
debugfs: leave freeing a symlink body until inode eviction
Documentation/filesystems/Locking: ->get_sb() is long gone
trylock_super(): replacement for grab_super_passive()
fanotify: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
Cachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry)
SELinux: Use d_is_positive() rather than testing dentry->d_inode
Smack: Use d_is_positive() rather than testing dentry->d_inode
TOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR()
Apparmor: Use d_is_positive/negative() rather than testing dentry->d_inode
Apparmor: mediated_filesystem() should use dentry->d_sb not inode->i_sb
VFS: Split DCACHE_FILE_TYPE into regular and special types
VFS: Add a fallthrough flag for marking virtual dentries
VFS: Add a whiteout dentry type
VFS: Introduce inode-getting helpers for layered/unioned fs environments
Infiniband: Fix potential NULL d_inode dereference
posix_acl: fix reference leaks in posix_acl_create
autofs4: Wrong format for printing dentry
...
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index dc400fd29f4d..c71e3732e53b 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -1659,9 +1659,25 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) | |||
1659 | } | 1659 | } |
1660 | EXPORT_SYMBOL(d_set_d_op); | 1660 | EXPORT_SYMBOL(d_set_d_op); |
1661 | 1661 | ||
1662 | |||
1663 | /* | ||
1664 | * d_set_fallthru - Mark a dentry as falling through to a lower layer | ||
1665 | * @dentry - The dentry to mark | ||
1666 | * | ||
1667 | * Mark a dentry as falling through to the lower layer (as set with | ||
1668 | * d_pin_lower()). This flag may be recorded on the medium. | ||
1669 | */ | ||
1670 | void d_set_fallthru(struct dentry *dentry) | ||
1671 | { | ||
1672 | spin_lock(&dentry->d_lock); | ||
1673 | dentry->d_flags |= DCACHE_FALLTHRU; | ||
1674 | spin_unlock(&dentry->d_lock); | ||
1675 | } | ||
1676 | EXPORT_SYMBOL(d_set_fallthru); | ||
1677 | |||
1662 | static unsigned d_flags_for_inode(struct inode *inode) | 1678 | static unsigned d_flags_for_inode(struct inode *inode) |
1663 | { | 1679 | { |
1664 | unsigned add_flags = DCACHE_FILE_TYPE; | 1680 | unsigned add_flags = DCACHE_REGULAR_TYPE; |
1665 | 1681 | ||
1666 | if (!inode) | 1682 | if (!inode) |
1667 | return DCACHE_MISS_TYPE; | 1683 | return DCACHE_MISS_TYPE; |
@@ -1674,13 +1690,21 @@ static unsigned d_flags_for_inode(struct inode *inode) | |||
1674 | else | 1690 | else |
1675 | inode->i_opflags |= IOP_LOOKUP; | 1691 | inode->i_opflags |= IOP_LOOKUP; |
1676 | } | 1692 | } |
1677 | } else if (unlikely(!(inode->i_opflags & IOP_NOFOLLOW))) { | 1693 | goto type_determined; |
1678 | if (unlikely(inode->i_op->follow_link)) | 1694 | } |
1695 | |||
1696 | if (unlikely(!(inode->i_opflags & IOP_NOFOLLOW))) { | ||
1697 | if (unlikely(inode->i_op->follow_link)) { | ||
1679 | add_flags = DCACHE_SYMLINK_TYPE; | 1698 | add_flags = DCACHE_SYMLINK_TYPE; |
1680 | else | 1699 | goto type_determined; |
1681 | inode->i_opflags |= IOP_NOFOLLOW; | 1700 | } |
1701 | inode->i_opflags |= IOP_NOFOLLOW; | ||
1682 | } | 1702 | } |
1683 | 1703 | ||
1704 | if (unlikely(!S_ISREG(inode->i_mode))) | ||
1705 | add_flags = DCACHE_SPECIAL_TYPE; | ||
1706 | |||
1707 | type_determined: | ||
1684 | if (unlikely(IS_AUTOMOUNT(inode))) | 1708 | if (unlikely(IS_AUTOMOUNT(inode))) |
1685 | add_flags |= DCACHE_NEED_AUTOMOUNT; | 1709 | add_flags |= DCACHE_NEED_AUTOMOUNT; |
1686 | return add_flags; | 1710 | return add_flags; |
@@ -1691,7 +1715,8 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode) | |||
1691 | unsigned add_flags = d_flags_for_inode(inode); | 1715 | unsigned add_flags = d_flags_for_inode(inode); |
1692 | 1716 | ||
1693 | spin_lock(&dentry->d_lock); | 1717 | spin_lock(&dentry->d_lock); |
1694 | __d_set_type(dentry, add_flags); | 1718 | dentry->d_flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU); |
1719 | dentry->d_flags |= add_flags; | ||
1695 | if (inode) | 1720 | if (inode) |
1696 | hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); | 1721 | hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); |
1697 | dentry->d_inode = inode; | 1722 | dentry->d_inode = inode; |