From a638e85d8053979e5f351d3bf429115ff98e4a32 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Fri, 28 Dec 2007 10:42:42 -0500 Subject: [PATCH] Unionfs: don't check parent dentries Parent dentries may not be locked and may change, so don't check them. But do check parent inodes if they are passed to the method. Also, ensure the checks are done only if no error occurred. Signed-off-by: Erez Zadok --- fs/unionfs/commonfops.c | 1 - fs/unionfs/file.c | 1 - fs/unionfs/inode.c | 21 ++++++++++----------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c index b8357a726ec..2c32ada1612 100644 --- a/fs/unionfs/commonfops.c +++ b/fs/unionfs/commonfops.c @@ -588,7 +588,6 @@ out_nofree: unionfs_copy_attr_times(dentry->d_parent->d_inode); unionfs_copy_attr_times(inode); unionfs_check_file(file); - unionfs_check_dentry(dentry->d_parent); unionfs_check_inode(inode); } unionfs_read_unlock(inode->i_sb); diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c index fd7f5a7a1b0..0ff8ee78341 100644 --- a/fs/unionfs/file.c +++ b/fs/unionfs/file.c @@ -66,7 +66,6 @@ out: /* copyup could cause parent dir times to change */ unionfs_copy_attr_times(file->f_path.dentry->d_parent->d_inode); unionfs_check_file(file); - unionfs_check_dentry(file->f_path.dentry->d_parent); } unionfs_read_unlock(file->f_path.dentry->d_sb); return err; diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c index 822a7d6a842..01dec7c8d77 100644 --- a/fs/unionfs/inode.c +++ b/fs/unionfs/inode.c @@ -151,7 +151,6 @@ out: unionfs_check_inode(parent); if (!err) { - unionfs_check_dentry(dentry->d_parent); unionfs_check_dentry(dentry); } unionfs_unlock_dentry(dentry); @@ -200,13 +199,15 @@ static struct dentry *unionfs_lookup(struct inode *parent, } unionfs_check_inode(parent); - unionfs_check_dentry(dentry); - unionfs_check_dentry(dentry->d_parent); - if (!IS_ERR(ret)) + if (!IS_ERR(ret)) { + unionfs_check_dentry(dentry); unionfs_unlock_dentry(dentry); + } - if (dentry != dentry->d_parent) + if (dentry != dentry->d_parent) { + unionfs_check_dentry(dentry->d_parent); unionfs_unlock_dentry(dentry->d_parent); + } unionfs_read_unlock(dentry->d_sb); return ret; @@ -512,8 +513,7 @@ out: unionfs_check_inode(parent); if (!err) - unionfs_check_dentry(dentry->d_parent); - unionfs_check_dentry(dentry); + unionfs_check_dentry(dentry); unionfs_unlock_dentry(dentry); unionfs_read_unlock(dentry->d_sb); return err; @@ -807,8 +807,7 @@ out: unionfs_check_inode(parent); if (!err) - unionfs_check_dentry(dentry->d_parent); - unionfs_check_dentry(dentry); + unionfs_check_dentry(dentry); unionfs_unlock_dentry(dentry); unionfs_read_unlock(dentry->d_sb); return err; @@ -1092,8 +1091,8 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia) /* if setattr succeeded, then parent dir may have changed */ unionfs_copy_attr_times(dentry->d_parent->d_inode); out: - unionfs_check_dentry(dentry); - unionfs_check_dentry(dentry->d_parent); + if (!err) + unionfs_check_dentry(dentry); unionfs_unlock_dentry(dentry); unionfs_read_unlock(dentry->d_sb); -- 2.43.0