return err;
}
-static int ovl_set_opaque(struct dentry *upperdentry)
+static int ovl_set_opaque(struct dentry *dentry, struct dentry *upperdentry)
{
- return ovl_do_setxattr(upperdentry, OVL_XATTR_OPAQUE, "y", 1, 0);
+ int err;
+
+ err = ovl_do_setxattr(upperdentry, OVL_XATTR_OPAQUE, "y", 1, 0);
+ if (!err)
+ ovl_dentry_set_opaque(dentry);
+
+ return err;
}
static int ovl_dir_getattr(struct vfsmount *mnt, struct dentry *dentry,
if (err)
goto out_cleanup;
- err = ovl_set_opaque(opaquedir);
+ err = ovl_set_opaque(dentry, opaquedir);
if (err)
goto out_cleanup;
}
if (!hardlink && S_ISDIR(stat->mode)) {
- err = ovl_set_opaque(newdentry);
+ err = ovl_set_opaque(dentry, newdentry);
if (err)
goto out_cleanup;
if (WARN_ON(olddentry->d_inode == newdentry->d_inode))
goto out_dput;
+ err = 0;
if (is_dir) {
- if (ovl_type_merge_or_lower(old)) {
+ if (ovl_type_merge_or_lower(old))
err = ovl_set_redirect(old, samedir);
- if (err)
- goto out_dput;
- } else if (!old_opaque && ovl_lower_positive(new)) {
- err = ovl_set_opaque(olddentry);
- if (err)
- goto out_dput;
- ovl_dentry_set_opaque(old, true);
- }
+ else if (!old_opaque && ovl_lower_positive(new))
+ err = ovl_set_opaque(old, olddentry);
+ if (err)
+ goto out_dput;
}
if (!overwrite && new_is_dir) {
- if (ovl_type_merge_or_lower(new)) {
+ if (ovl_type_merge_or_lower(new))
err = ovl_set_redirect(new, samedir);
- if (err)
- goto out_dput;
- } else if (!new_opaque && ovl_lower_positive(old)) {
- err = ovl_set_opaque(newdentry);
- if (err)
- goto out_dput;
- ovl_dentry_set_opaque(new, true);
- }
+ else if (!new_opaque && ovl_lower_positive(old))
+ err = ovl_set_opaque(new, newdentry);
+ if (err)
+ goto out_dput;
}
err = ovl_do_rename(old_upperdir->d_inode, olddentry,
void ovl_set_dir_cache(struct dentry *dentry, struct ovl_dir_cache *cache);
bool ovl_dentry_is_opaque(struct dentry *dentry);
bool ovl_dentry_is_whiteout(struct dentry *dentry);
-void ovl_dentry_set_opaque(struct dentry *dentry, bool opaque);
+void ovl_dentry_set_opaque(struct dentry *dentry);
bool ovl_redirect_dir(struct super_block *sb);
void ovl_clear_redirect_dir(struct super_block *sb);
const char *ovl_dentry_get_redirect(struct dentry *dentry);