Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55acc661 authored by Miklos Szeredi's avatar Miklos Szeredi
Browse files

ovl: add flag for upper in ovl_entry



For rename, we need to ensure that an upper alias exists for hard links
before attempting the operation.  Introduce a flag in ovl_entry to track
the state of the upper alias.

Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 23f0ab13
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -472,6 +472,7 @@ static int ovl_copy_up_locked(struct ovl_copy_up_ctx *c)
	if (err)
		goto out_cleanup;

	ovl_dentry_set_upper_alias(c->dentry);
	ovl_inode_update(d_inode(c->dentry), newdentry);
out:
	dput(temp);
+1 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ static void ovl_instantiate(struct dentry *dentry, struct inode *inode,
			    struct dentry *newdentry, bool hardlink)
{
	ovl_dentry_version_inc(dentry->d_parent);
	ovl_dentry_set_upper_alias(dentry);
	if (!hardlink) {
		ovl_inode_update(inode, newdentry);
		ovl_copyattr(newdentry->d_inode, inode);
+3 −1
Original line number Diff line number Diff line
@@ -674,7 +674,9 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
	memcpy(oe->lowerstack, stack, sizeof(struct path) * ctr);
	dentry->d_fsdata = oe;

	if (index && !upperdentry)
	if (upperdentry)
		ovl_dentry_set_upper_alias(dentry);
	else if (index)
		upperdentry = dget(index);

	if (upperdentry || ctr) {
+2 −0
Original line number Diff line number Diff line
@@ -206,6 +206,8 @@ 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 ovl_dentry_has_upper_alias(struct dentry *dentry);
void ovl_dentry_set_upper_alias(struct dentry *dentry);
bool ovl_redirect_dir(struct super_block *sb);
const char *ovl_dentry_get_redirect(struct dentry *dentry);
void ovl_dentry_set_redirect(struct dentry *dentry, const char *redirect);
+4 −1
Original line number Diff line number Diff line
@@ -42,7 +42,10 @@ struct ovl_fs {
/* private information held for every overlayfs dentry */
struct ovl_entry {
	union {
		struct {
			unsigned long has_upper;
			bool opaque;
		};
		struct rcu_head rcu;
	};
	unsigned numlower;
Loading