ovl: fetch inode once in ovl_dentry_revalidate_common()
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 2 Oct 2023 02:36:43 +0000 (03:36 +0100)
committerAmir Goldstein <amir73il@gmail.com>
Mon, 2 Oct 2023 14:44:19 +0000 (17:44 +0300)
d_inode_rcu() is right - we might be in rcu pathwalk;
however, OVL_E() hides plain d_inode() on the same dentry...

Fixes: a6ff2bc0be17 ("ovl: use OVL_E() and OVL_E_FLAGS() accessors")
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
fs/overlayfs/super.c

index f09184b865ec35062bceea88b308622d9f607095..905d3aaf4e5563eb9bc378ca9be7cc2e62042a4b 100644 (file)
@@ -104,8 +104,8 @@ static int ovl_revalidate_real(struct dentry *d, unsigned int flags, bool weak)
 static int ovl_dentry_revalidate_common(struct dentry *dentry,
                                        unsigned int flags, bool weak)
 {
-       struct ovl_entry *oe = OVL_E(dentry);
-       struct ovl_path *lowerstack = ovl_lowerstack(oe);
+       struct ovl_entry *oe;
+       struct ovl_path *lowerstack;
        struct inode *inode = d_inode_rcu(dentry);
        struct dentry *upper;
        unsigned int i;
@@ -115,6 +115,8 @@ static int ovl_dentry_revalidate_common(struct dentry *dentry,
        if (!inode)
                return -ECHILD;
 
+       oe = OVL_I_E(inode);
+       lowerstack = ovl_lowerstack(oe);
        upper = ovl_i_dentry_upper(inode);
        if (upper)
                ret = ovl_revalidate_real(upper, flags, weak);