diff options
author | Amir Goldstein <amir73il@gmail.com> | 2023-04-03 10:29:59 +0200 |
---|---|---|
committer | Amir Goldstein <amir73il@gmail.com> | 2023-06-19 13:01:12 +0200 |
commit | b07d5cc93e1b28df47a72c519d09d0a836043613 (patch) | |
tree | 1cf6d3fbdf83820fb97ce2a8bbb9603c2217fdee /fs/overlayfs/util.c | |
parent | ovl: fix null pointer dereference in ovl_get_acl_rcu() (diff) | |
download | linux-b07d5cc93e1b28df47a72c519d09d0a836043613.tar.xz linux-b07d5cc93e1b28df47a72c519d09d0a836043613.zip |
ovl: update of dentry revalidate flags after copy up
After copy up, we may need to update d_flags if upper dentry is on a
remote fs and lower dentries are not.
Add helpers to allow incremental update of the revalidate flags.
Fixes: bccece1ead36 ("ovl: allow remote upper")
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/util.c')
-rw-r--r-- | fs/overlayfs/util.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c index 5a6f34c7ed03..fb12e7fa8548 100644 --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -94,14 +94,30 @@ struct ovl_entry *ovl_alloc_entry(unsigned int numlower) return oe; } +#define OVL_D_REVALIDATE (DCACHE_OP_REVALIDATE | DCACHE_OP_WEAK_REVALIDATE) + bool ovl_dentry_remote(struct dentry *dentry) { - return dentry->d_flags & - (DCACHE_OP_REVALIDATE | DCACHE_OP_WEAK_REVALIDATE); + return dentry->d_flags & OVL_D_REVALIDATE; +} + +void ovl_dentry_update_reval(struct dentry *dentry, struct dentry *realdentry) +{ + if (!ovl_dentry_remote(realdentry)) + return; + + spin_lock(&dentry->d_lock); + dentry->d_flags |= realdentry->d_flags & OVL_D_REVALIDATE; + spin_unlock(&dentry->d_lock); +} + +void ovl_dentry_init_reval(struct dentry *dentry, struct dentry *upperdentry) +{ + return ovl_dentry_init_flags(dentry, upperdentry, OVL_D_REVALIDATE); } -void ovl_dentry_update_reval(struct dentry *dentry, struct dentry *upperdentry, - unsigned int mask) +void ovl_dentry_init_flags(struct dentry *dentry, struct dentry *upperdentry, + unsigned int mask) { struct ovl_entry *oe = OVL_E(dentry); unsigned int i, flags = 0; |