--- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -1224,9 +1224,9 @@ int ovl_lock_rename_workdir(struct dentr goto err; if (trap) goto err_unlock; - if (work && work->d_parent != workdir) + if (work && (work->d_parent != workdir || d_unhashed(work))) goto err_unlock; - if (upper && upper->d_parent != upperdir) + if (upper && (upper->d_parent != upperdir || d_unhashed(work))) goto err_unlock; return 0;