diff options
author | Amir Goldstein <amir73il@gmail.com> | 2017-12-24 18:28:04 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2018-01-24 11:26:03 +0100 |
commit | 9436a1a339fae84698aaa0b66d7a822018388348 (patch) | |
tree | 38d74ccb48e21ade05347aa0e4f2de2ad6bd17c0 /fs/overlayfs/inode.c | |
parent | f71bd9cfb692ec80236b186419bf907eb5fa348c (diff) | |
download | linux-stable-9436a1a339fae84698aaa0b66d7a822018388348.tar.gz linux-stable-9436a1a339fae84698aaa0b66d7a822018388348.tar.bz2 linux-stable-9436a1a339fae84698aaa0b66d7a822018388348.zip |
ovl: decode lower file handles of unlinked but open files
Lookup overlay inode in cache by origin inode, so we can decode a file
handle of an open file even if the index has a whiteout index entry to
mark this overlay inode was unlinked.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/inode.c')
-rw-r--r-- | fs/overlayfs/inode.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index bfd7c766b5cd..56ba015b9f5e 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -645,6 +645,22 @@ static bool ovl_verify_inode(struct inode *inode, struct dentry *lowerdentry, return true; } +struct inode *ovl_lookup_inode(struct super_block *sb, struct dentry *origin) +{ + struct inode *inode, *key = d_inode(origin); + + inode = ilookup5(sb, (unsigned long) key, ovl_inode_test, key); + if (!inode) + return NULL; + + if (!ovl_verify_inode(inode, origin, NULL)) { + iput(inode); + return ERR_PTR(-ESTALE); + } + + return inode; +} + struct inode *ovl_get_inode(struct super_block *sb, struct dentry *upperdentry, struct dentry *lowerdentry, struct dentry *index, unsigned int numlower) |