diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-12-16 11:02:55 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2016-12-16 11:02:55 +0100 |
commit | c412ce498396097cb96b3e24e062752312a962c9 (patch) | |
tree | 607029b78cb046e211919cfc6f7cc796a0ad44c9 /fs | |
parent | 99f5d08e3640c8319f353e6c883da150c48067f6 (diff) | |
download | op-kernel-dev-c412ce498396097cb96b3e24e062752312a962c9.zip op-kernel-dev-c412ce498396097cb96b3e24e062752312a962c9.tar.gz |
ovl: add ovl_dentry_is_whiteout()
And use it instead of ovl_dentry_is_opaque() where appropriate.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/overlayfs/dir.c | 6 | ||||
-rw-r--r-- | fs/overlayfs/overlayfs.h | 1 | ||||
-rw-r--r-- | fs/overlayfs/super.c | 5 |
3 files changed, 9 insertions, 3 deletions
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index fdc7b14..b559221 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -504,7 +504,7 @@ static int ovl_create_or_link(struct dentry *dentry, struct inode *inode, put_cred(override_creds(override_cred)); put_cred(override_cred); - if (!ovl_dentry_is_opaque(dentry)) + if (!ovl_dentry_is_whiteout(dentry)) err = ovl_create_upper(dentry, inode, stat, link, hardlink); else @@ -842,14 +842,14 @@ static int ovl_rename(struct inode *olddir, struct dentry *old, if (overwrite) { if (old_opaque) { - if (new->d_inode || !new_opaque) { + if (!ovl_dentry_is_whiteout(new)) { /* Whiteout source */ flags |= RENAME_WHITEOUT; } else { /* Switch whiteouts */ flags |= RENAME_EXCHANGE; } - } else if (is_dir && !new->d_inode && new_opaque) { + } else if (is_dir && ovl_dentry_is_whiteout(new)) { flags |= RENAME_EXCHANGE; cleanup_whiteout = true; } diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h index 95d0d86..51e7d58 100644 --- a/fs/overlayfs/overlayfs.h +++ b/fs/overlayfs/overlayfs.h @@ -161,6 +161,7 @@ struct dentry *ovl_workdir(struct dentry *dentry); int ovl_want_write(struct dentry *dentry); void ovl_drop_write(struct dentry *dentry); 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); bool ovl_is_whiteout(struct dentry *dentry); const struct cred *ovl_override_creds(struct super_block *sb); diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index e296312..aa0427d 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -209,6 +209,11 @@ bool ovl_dentry_is_opaque(struct dentry *dentry) return oe->opaque; } +bool ovl_dentry_is_whiteout(struct dentry *dentry) +{ + return !dentry->d_inode && ovl_dentry_is_opaque(dentry); +} + void ovl_dentry_set_opaque(struct dentry *dentry, bool opaque) { struct ovl_entry *oe = dentry->d_fsdata; |