ovl: do not pass overlay dentry to ovl_get_inode()
This is needed for using ovl_get_inode() for decoding file handles for NFS export. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
91ffe7beb3
commit
0aceb53e73
|
@ -643,14 +643,14 @@ static bool ovl_verify_inode(struct inode *inode, struct dentry *lowerdentry,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry,
|
struct inode *ovl_get_inode(struct super_block *sb, struct dentry *upperdentry,
|
||||||
struct dentry *index)
|
struct dentry *lowerdentry, struct dentry *index,
|
||||||
|
unsigned int numlower)
|
||||||
{
|
{
|
||||||
struct dentry *lowerdentry = ovl_dentry_lower(dentry);
|
|
||||||
struct inode *realinode = upperdentry ? d_inode(upperdentry) : NULL;
|
struct inode *realinode = upperdentry ? d_inode(upperdentry) : NULL;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
/* Already indexed or could be indexed on copy up? */
|
/* Already indexed or could be indexed on copy up? */
|
||||||
bool indexed = (index || (ovl_indexdir(dentry->d_sb) && !upperdentry));
|
bool indexed = (index || (ovl_indexdir(sb) && !upperdentry));
|
||||||
struct dentry *origin = indexed ? lowerdentry : NULL;
|
struct dentry *origin = indexed ? lowerdentry : NULL;
|
||||||
bool is_dir;
|
bool is_dir;
|
||||||
|
|
||||||
|
@ -675,7 +675,7 @@ struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry,
|
||||||
struct inode *key = d_inode(origin ?: upperdentry);
|
struct inode *key = d_inode(origin ?: upperdentry);
|
||||||
unsigned int nlink = is_dir ? 1 : realinode->i_nlink;
|
unsigned int nlink = is_dir ? 1 : realinode->i_nlink;
|
||||||
|
|
||||||
inode = iget5_locked(dentry->d_sb, (unsigned long) key,
|
inode = iget5_locked(sb, (unsigned long) key,
|
||||||
ovl_inode_test, ovl_inode_set, key);
|
ovl_inode_test, ovl_inode_set, key);
|
||||||
if (!inode)
|
if (!inode)
|
||||||
goto out_nomem;
|
goto out_nomem;
|
||||||
|
@ -699,7 +699,7 @@ struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry,
|
||||||
nlink = ovl_get_nlink(lowerdentry, upperdentry, nlink);
|
nlink = ovl_get_nlink(lowerdentry, upperdentry, nlink);
|
||||||
set_nlink(inode, nlink);
|
set_nlink(inode, nlink);
|
||||||
} else {
|
} else {
|
||||||
inode = new_inode(dentry->d_sb);
|
inode = new_inode(sb);
|
||||||
if (!inode)
|
if (!inode)
|
||||||
goto out_nomem;
|
goto out_nomem;
|
||||||
}
|
}
|
||||||
|
@ -711,9 +711,7 @@ struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry,
|
||||||
|
|
||||||
/* Check for non-merge dir that may have whiteouts */
|
/* Check for non-merge dir that may have whiteouts */
|
||||||
if (is_dir) {
|
if (is_dir) {
|
||||||
struct ovl_entry *oe = dentry->d_fsdata;
|
if (((upperdentry && lowerdentry) || numlower > 1) ||
|
||||||
|
|
||||||
if (((upperdentry && lowerdentry) || oe->numlower > 1) ||
|
|
||||||
ovl_check_origin_xattr(upperdentry ?: lowerdentry)) {
|
ovl_check_origin_xattr(upperdentry ?: lowerdentry)) {
|
||||||
ovl_set_flag(OVL_WHITEOUTS, inode);
|
ovl_set_flag(OVL_WHITEOUTS, inode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -967,7 +967,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
|
||||||
upperdentry = dget(index);
|
upperdentry = dget(index);
|
||||||
|
|
||||||
if (upperdentry || ctr) {
|
if (upperdentry || ctr) {
|
||||||
inode = ovl_get_inode(dentry, upperdentry, index);
|
inode = ovl_get_inode(dentry->d_sb, upperdentry, origin, index,
|
||||||
|
ctr);
|
||||||
err = PTR_ERR(inode);
|
err = PTR_ERR(inode);
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
goto out_free_oe;
|
goto out_free_oe;
|
||||||
|
|
|
@ -307,8 +307,9 @@ int ovl_update_time(struct inode *inode, struct timespec *ts, int flags);
|
||||||
bool ovl_is_private_xattr(const char *name);
|
bool ovl_is_private_xattr(const char *name);
|
||||||
|
|
||||||
struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, dev_t rdev);
|
struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, dev_t rdev);
|
||||||
struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry,
|
struct inode *ovl_get_inode(struct super_block *sb, struct dentry *upperdentry,
|
||||||
struct dentry *index);
|
struct dentry *lowerdentry, struct dentry *index,
|
||||||
|
unsigned int numlower);
|
||||||
static inline void ovl_copyattr(struct inode *from, struct inode *to)
|
static inline void ovl_copyattr(struct inode *from, struct inode *to)
|
||||||
{
|
{
|
||||||
to->i_uid = from->i_uid;
|
to->i_uid = from->i_uid;
|
||||||
|
|
Loading…
Reference in New Issue