SCCS-vsn: sys/ufs/ffs/ffs_vnops.c 7.56
SCCS-vsn: sys/ufs/ffs/ufs_vnops.c 7.56
SCCS-vsn: sys/ufs/lfs/lfs_vnops.c 7.56
SCCS-vsn: sys/ufs/ufs/ufs_vnops.c 7.56
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ffs_vnops.c 7.55 (Berkeley) %G%
+ * @(#)ffs_vnops.c 7.56 (Berkeley) %G%
error = direnter(ip, ndp);
if (ndp->ni_dvp != vp)
IUNLOCK(ip);
error = direnter(ip, ndp);
if (ndp->ni_dvp != vp)
IUNLOCK(ip);
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
if (error = iupdat(dp, &time, &time, 1))
goto bad;
}
if (error = iupdat(dp, &time, &time, 1))
goto bad;
}
- if (error = direnter(ip, tndp))
- goto out;
+ if (error = direnter(ip, tndp)) {
+ if (doingdirectory && newparent) {
+ dp->i_nlink--;
+ dp->i_flag |= ICHG;
+ (void) iupdat(dp, &time, &time, 1);
+ }
+ goto bad;
+ }
} else {
if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev)
panic("rename: EXDEV");
} else {
if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev)
panic("rename: EXDEV");
*/
dp->i_nlink++;
dp->i_flag |= ICHG;
*/
dp->i_nlink++;
dp->i_flag |= ICHG;
- error = iupdat(dp, &time, &time, 1);
+ if (error = iupdat(dp, &time, &time, 1))
+ goto bad;
/*
* Initialize directory with "."
/*
* Initialize directory with "."
* install the entry for it in
* the parent directory.
*/
* install the entry for it in
* the parent directory.
*/
- error = direnter(ip, ndp);
- dp = NULL;
- if (error) {
+ if (error = direnter(ip, ndp)) {
ndp->ni_nameiop &= ~(MODMASK | OPMASK);
ndp->ni_nameiop &= ~(MODMASK | OPMASK);
- ndp->ni_nameiop |= LOOKUP | NOCACHE;
+ ndp->ni_nameiop |= LOOKUP | LOCKLEAF | NOCACHE;
error = namei(ndp);
if (!error) {
error = namei(ndp);
if (!error) {
dp = VTOI(ndp->ni_vp);
dp->i_nlink--;
dp->i_flag |= ICHG;
dp = VTOI(ndp->ni_vp);
dp->i_nlink--;
dp->i_flag |= ICHG;
iput(ip);
} else
ndp->ni_vp = ITOV(ip);
iput(ip);
} else
ndp->ni_vp = ITOV(ip);
*/
if (error = iupdat(ip, &time, &time, 1))
goto bad;
*/
if (error = iupdat(ip, &time, &time, 1))
goto bad;
- if (error = direnter(ip, ndp)) {
- pdir = NULL;
+ if (error = direnter(ip, ndp))
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
*/
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
*/
- if (pdir)
- iput(pdir);
ip->i_nlink = 0;
ip->i_flag |= ICHG;
iput(ip);
ip->i_nlink = 0;
ip->i_flag |= ICHG;
iput(ip);
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_vnops.c 7.55 (Berkeley) %G%
+ * @(#)ufs_vnops.c 7.56 (Berkeley) %G%
error = direnter(ip, ndp);
if (ndp->ni_dvp != vp)
IUNLOCK(ip);
error = direnter(ip, ndp);
if (ndp->ni_dvp != vp)
IUNLOCK(ip);
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
if (error = iupdat(dp, &time, &time, 1))
goto bad;
}
if (error = iupdat(dp, &time, &time, 1))
goto bad;
}
- if (error = direnter(ip, tndp))
- goto out;
+ if (error = direnter(ip, tndp)) {
+ if (doingdirectory && newparent) {
+ dp->i_nlink--;
+ dp->i_flag |= ICHG;
+ (void) iupdat(dp, &time, &time, 1);
+ }
+ goto bad;
+ }
} else {
if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev)
panic("rename: EXDEV");
} else {
if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev)
panic("rename: EXDEV");
*/
dp->i_nlink++;
dp->i_flag |= ICHG;
*/
dp->i_nlink++;
dp->i_flag |= ICHG;
- error = iupdat(dp, &time, &time, 1);
+ if (error = iupdat(dp, &time, &time, 1))
+ goto bad;
/*
* Initialize directory with "."
/*
* Initialize directory with "."
* install the entry for it in
* the parent directory.
*/
* install the entry for it in
* the parent directory.
*/
- error = direnter(ip, ndp);
- dp = NULL;
- if (error) {
+ if (error = direnter(ip, ndp)) {
ndp->ni_nameiop &= ~(MODMASK | OPMASK);
ndp->ni_nameiop &= ~(MODMASK | OPMASK);
- ndp->ni_nameiop |= LOOKUP | NOCACHE;
+ ndp->ni_nameiop |= LOOKUP | LOCKLEAF | NOCACHE;
error = namei(ndp);
if (!error) {
error = namei(ndp);
if (!error) {
dp = VTOI(ndp->ni_vp);
dp->i_nlink--;
dp->i_flag |= ICHG;
dp = VTOI(ndp->ni_vp);
dp->i_nlink--;
dp->i_flag |= ICHG;
iput(ip);
} else
ndp->ni_vp = ITOV(ip);
iput(ip);
} else
ndp->ni_vp = ITOV(ip);
*/
if (error = iupdat(ip, &time, &time, 1))
goto bad;
*/
if (error = iupdat(ip, &time, &time, 1))
goto bad;
- if (error = direnter(ip, ndp)) {
- pdir = NULL;
+ if (error = direnter(ip, ndp))
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
*/
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
*/
- if (pdir)
- iput(pdir);
ip->i_nlink = 0;
ip->i_flag |= ICHG;
iput(ip);
ip->i_nlink = 0;
ip->i_flag |= ICHG;
iput(ip);
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)lfs_vnops.c 7.55 (Berkeley) %G%
+ * @(#)lfs_vnops.c 7.56 (Berkeley) %G%
error = direnter(ip, ndp);
if (ndp->ni_dvp != vp)
IUNLOCK(ip);
error = direnter(ip, ndp);
if (ndp->ni_dvp != vp)
IUNLOCK(ip);
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
if (error = iupdat(dp, &time, &time, 1))
goto bad;
}
if (error = iupdat(dp, &time, &time, 1))
goto bad;
}
- if (error = direnter(ip, tndp))
- goto out;
+ if (error = direnter(ip, tndp)) {
+ if (doingdirectory && newparent) {
+ dp->i_nlink--;
+ dp->i_flag |= ICHG;
+ (void) iupdat(dp, &time, &time, 1);
+ }
+ goto bad;
+ }
} else {
if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev)
panic("rename: EXDEV");
} else {
if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev)
panic("rename: EXDEV");
*/
dp->i_nlink++;
dp->i_flag |= ICHG;
*/
dp->i_nlink++;
dp->i_flag |= ICHG;
- error = iupdat(dp, &time, &time, 1);
+ if (error = iupdat(dp, &time, &time, 1))
+ goto bad;
/*
* Initialize directory with "."
/*
* Initialize directory with "."
* install the entry for it in
* the parent directory.
*/
* install the entry for it in
* the parent directory.
*/
- error = direnter(ip, ndp);
- dp = NULL;
- if (error) {
+ if (error = direnter(ip, ndp)) {
ndp->ni_nameiop &= ~(MODMASK | OPMASK);
ndp->ni_nameiop &= ~(MODMASK | OPMASK);
- ndp->ni_nameiop |= LOOKUP | NOCACHE;
+ ndp->ni_nameiop |= LOOKUP | LOCKLEAF | NOCACHE;
error = namei(ndp);
if (!error) {
error = namei(ndp);
if (!error) {
dp = VTOI(ndp->ni_vp);
dp->i_nlink--;
dp->i_flag |= ICHG;
dp = VTOI(ndp->ni_vp);
dp->i_nlink--;
dp->i_flag |= ICHG;
iput(ip);
} else
ndp->ni_vp = ITOV(ip);
iput(ip);
} else
ndp->ni_vp = ITOV(ip);
*/
if (error = iupdat(ip, &time, &time, 1))
goto bad;
*/
if (error = iupdat(ip, &time, &time, 1))
goto bad;
- if (error = direnter(ip, ndp)) {
- pdir = NULL;
+ if (error = direnter(ip, ndp))
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
*/
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
*/
- if (pdir)
- iput(pdir);
ip->i_nlink = 0;
ip->i_flag |= ICHG;
iput(ip);
ip->i_nlink = 0;
ip->i_flag |= ICHG;
iput(ip);
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)ufs_vnops.c 7.55 (Berkeley) %G%
+ * @(#)ufs_vnops.c 7.56 (Berkeley) %G%
error = direnter(ip, ndp);
if (ndp->ni_dvp != vp)
IUNLOCK(ip);
error = direnter(ip, ndp);
if (ndp->ni_dvp != vp)
IUNLOCK(ip);
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
if (error) {
ip->i_nlink--;
ip->i_flag |= ICHG;
if (error = iupdat(dp, &time, &time, 1))
goto bad;
}
if (error = iupdat(dp, &time, &time, 1))
goto bad;
}
- if (error = direnter(ip, tndp))
- goto out;
+ if (error = direnter(ip, tndp)) {
+ if (doingdirectory && newparent) {
+ dp->i_nlink--;
+ dp->i_flag |= ICHG;
+ (void) iupdat(dp, &time, &time, 1);
+ }
+ goto bad;
+ }
} else {
if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev)
panic("rename: EXDEV");
} else {
if (xp->i_dev != dp->i_dev || xp->i_dev != ip->i_dev)
panic("rename: EXDEV");
*/
dp->i_nlink++;
dp->i_flag |= ICHG;
*/
dp->i_nlink++;
dp->i_flag |= ICHG;
- error = iupdat(dp, &time, &time, 1);
+ if (error = iupdat(dp, &time, &time, 1))
+ goto bad;
/*
* Initialize directory with "."
/*
* Initialize directory with "."
* install the entry for it in
* the parent directory.
*/
* install the entry for it in
* the parent directory.
*/
- error = direnter(ip, ndp);
- dp = NULL;
- if (error) {
+ if (error = direnter(ip, ndp)) {
ndp->ni_nameiop &= ~(MODMASK | OPMASK);
ndp->ni_nameiop &= ~(MODMASK | OPMASK);
- ndp->ni_nameiop |= LOOKUP | NOCACHE;
+ ndp->ni_nameiop |= LOOKUP | LOCKLEAF | NOCACHE;
error = namei(ndp);
if (!error) {
error = namei(ndp);
if (!error) {
dp = VTOI(ndp->ni_vp);
dp->i_nlink--;
dp->i_flag |= ICHG;
dp = VTOI(ndp->ni_vp);
dp->i_nlink--;
dp->i_flag |= ICHG;
iput(ip);
} else
ndp->ni_vp = ITOV(ip);
iput(ip);
} else
ndp->ni_vp = ITOV(ip);
*/
if (error = iupdat(ip, &time, &time, 1))
goto bad;
*/
if (error = iupdat(ip, &time, &time, 1))
goto bad;
- if (error = direnter(ip, ndp)) {
- pdir = NULL;
+ if (error = direnter(ip, ndp))
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
*/
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
*/
- if (pdir)
- iput(pdir);
ip->i_nlink = 0;
ip->i_flag |= ICHG;
iput(ip);
ip->i_nlink = 0;
ip->i_flag |= ICHG;
iput(ip);