[RHEL7,COMMIT] rh/dcache: work around buggy iso images

Submitted by Konstantin Khorenko on Nov. 11, 2019, 3:39 p.m.

Details

Message ID 201911111539.xABFdA3O007695@finist-ce7.sw.ru
State New
Series "rh/dcache: work around buggy iso images"
Headers show

Commit Message

Konstantin Khorenko Nov. 11, 2019, 3:39 p.m.
The commit is pushed to "branch-rh7-3.10.0-1062.4.1.vz7.115.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.4.1.vz7.115.12
------>
commit a491d64db087f54e270bab3786b89cc479446877
Author: Vasily Averin <vvs@virtuozzo.com>
Date:   Mon Nov 11 18:39:10 2019 +0300

    rh/dcache: work around buggy iso images
    
    Since rebase to rhel7.6 kernel 3.10.0-759.21.3.el7 pltp-host had
    started to report about failures in isofs test.
    
    "mkisofs -f" replaces symlink to directory by 2 directories with the
    same inode number.
    
    Issue was reported to Red Hat:
    https://bugzilla.redhat.com/show_bug.cgi?id=1749390
    
    isofs returning same inode nr for 2 dirs /is/ a bug.
    Not clear whether it's in mkisofs, or in the kernel isofs driver,
    i.e. how isofs_get_ino() generates inodes.
    But, upstream silently mitigates the problem.
    
    Work around was proposed by Miklos Szeredi and was committed to
    kernel-3.10.0-1106.el7
    
    https://jira.sw.ru/browse/PSBM-95941
    
    Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 fs/dcache.c | 31 +------------------------------
 1 file changed, 1 insertion(+), 30 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/dcache.c b/fs/dcache.c
index 8b07241fae84..5c0d9747449f 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2910,36 +2910,7 @@  struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
 		return ERR_CAST(inode);
 
 	if (inode && S_ISDIR(inode->i_mode)) {
-		spin_lock(&inode->i_lock);
-		new = __d_find_any_alias(inode);
-		if (new) {
-			if (!IS_ROOT(new)) {
-				spin_unlock(&inode->i_lock);
-				dput(new);
-				iput(inode);
-				return ERR_PTR(-EIO);
-			}
-			if (d_ancestor(new, dentry)) {
-				spin_unlock(&inode->i_lock);
-				dput(new);
-				iput(inode);
-				return ERR_PTR(-EIO);
-			}
-			write_seqlock(&rename_lock);
-			__d_materialise_dentry(dentry, new);
-			write_sequnlock(&rename_lock);
-			_d_rehash(new);
-			spin_unlock(&new->d_lock);
-			spin_unlock(&inode->i_lock);
-			security_d_instantiate(new, inode);
-			iput(inode);
-		} else {
-			/* already taking inode->i_lock, so d_add() by hand */
-			__d_instantiate(dentry, inode);
-			spin_unlock(&inode->i_lock);
-			security_d_instantiate(dentry, inode);
-			d_rehash(dentry);
-		}
+		new = d_materialise_unique(dentry, inode);
 	} else {
 		d_instantiate(dentry, inode);
 		if (d_unhashed(dentry))