ovl: Initialize ovl_inode->redirect in ovl_get_inode()
ovl_inode->redirect is an inode property and should be initialized in ovl_get_inode() only when we are adding a new inode to cache. If inode is already in cache, it is already initialized and we should not be touching ovl_inode->redirect field. As of now this is not a problem as redirects are used only for directories which don't share inode. But soon I want to use redirects for regular files also and there it can become an issue. Hence, move ->redirect initialization in ovl_get_inode(). Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:

committed by
Miklos Szeredi

parent
0c31d675aa
commit
9cec54c83a
@@ -1009,19 +1009,13 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
|
||||
.lowerpath = stack,
|
||||
.index = index,
|
||||
.numlower = ctr,
|
||||
.redirect = upperredirect,
|
||||
};
|
||||
|
||||
inode = ovl_get_inode(dentry->d_sb, &oip);
|
||||
err = PTR_ERR(inode);
|
||||
if (IS_ERR(inode))
|
||||
goto out_free_oe;
|
||||
|
||||
/*
|
||||
* NB: handle redirected hard links when non-dir redirects
|
||||
* become possible
|
||||
*/
|
||||
WARN_ON(OVL_I(inode)->redirect);
|
||||
OVL_I(inode)->redirect = upperredirect;
|
||||
}
|
||||
|
||||
revert_creds(old_cred);
|
||||
|
Reference in New Issue
Block a user