From: Amir Goldstein amir73il@gmail.com
mainline inclusion from mainline-v5.7-rc1 commit 735c907d7b7df501e951ba07134b9f6f989a94e4 category: bugfix bugzilla: NA CVE: NA
-------------------------------------------------
ovl_inode_update() is no longer called from create object code path.
Fixes: 01b39dcc9568 ("ovl: use inode_insert5() to hash a newly...") Signed-off-by: Amir Goldstein amir73il@gmail.com Signed-off-by: Miklos Szeredi mszeredi@redhat.com Signed-off-by: Zheng Liang zhengliang6@huawei.com Reviewed-by: Zhang Yi yi.zhang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- fs/overlayfs/inode.c | 8 +++++--- fs/overlayfs/util.c | 2 -- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index d1e9d926150b1..b016343a7209b 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -555,9 +555,11 @@ static void ovl_fill_inode(struct inode *inode, umode_t mode, dev_t rdev, * bits to encode layer), set the same value used for st_ino to i_ino, * so inode number exposed via /proc/locks and a like will be * consistent with d_ino and st_ino values. An i_ino value inconsistent - * with d_ino also causes nfsd readdirplus to fail. When called from - * ovl_new_inode(), ino arg is 0, so i_ino will be updated to real - * upper inode i_ino on ovl_inode_init() or ovl_inode_update(). + * with d_ino also causes nfsd readdirplus to fail. + * + * When called from ovl_create_object() => ovl_new_inode(), with + * ino = 0, i_ino will be updated to consistent value later on in + * ovl_get_inode() => ovl_fill_inode(). */ if (ovl_same_dev(inode->i_sb)) { inode->i_ino = ino; diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c index eb9411461b695..b83955f31ded0 100644 --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -419,8 +419,6 @@ void ovl_inode_update(struct inode *inode, struct dentry *upperdentry) smp_wmb(); OVL_I(inode)->__upperdentry = upperdentry; if (inode_unhashed(inode)) { - if (!inode->i_ino) - inode->i_ino = upperinode->i_ino; inode->i_private = upperinode; __insert_inode_hash(inode, (unsigned long) upperinode); }