ext2_vnops.c (6b88668f0bfcca09035549e25d0f3c181cd537c8) ext2_vnops.c (b4a58fbf640409a1e507d9f7b411c83a3f83a2f3)
1/*-
2 * modified for EXT2FS support in Lites 1.1
3 *
4 * Aug 1995, Godmar Back (gback@cs.utah.edu)
5 * University of Utah, Department of Computer Science
6 */
7/*-
8 * SPDX-License-Identifier: BSD-3-Clause

--- 892 unchanged lines hidden (view full) ---

901 * parent) then the source directory must not be in the
902 * directory hierarchy above the target, as this would
903 * orphan everything below the source directory. Also
904 * the user must have write permission in the source so
905 * as to be able to change "..". We must repeat the call
906 * to namei, as the parent directory is unlocked by the
907 * call to checkpath().
908 */
1/*-
2 * modified for EXT2FS support in Lites 1.1
3 *
4 * Aug 1995, Godmar Back (gback@cs.utah.edu)
5 * University of Utah, Department of Computer Science
6 */
7/*-
8 * SPDX-License-Identifier: BSD-3-Clause

--- 892 unchanged lines hidden (view full) ---

901 * parent) then the source directory must not be in the
902 * directory hierarchy above the target, as this would
903 * orphan everything below the source directory. Also
904 * the user must have write permission in the source so
905 * as to be able to change "..". We must repeat the call
906 * to namei, as the parent directory is unlocked by the
907 * call to checkpath().
908 */
909 error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread);
909 error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, curthread);
910 VOP_UNLOCK(fvp);
911 if (oldparent != dp->i_number)
912 newparent = dp->i_number;
913 if (doingdirectory && newparent) {
914 if (error) /* write access check above */
915 goto bad;
916 if (xp != NULL)
917 vput(tvp);

--- 108 unchanged lines hidden (view full) ---

1026 * it above, as the remaining link would point to
1027 * a directory without "." or ".." entries.
1028 */
1029 ext2_dec_nlink(xp);
1030 if (doingdirectory) {
1031 if (xp->i_nlink > 2)
1032 panic("ext2_rename: linked directory");
1033 error = ext2_truncate(tvp, (off_t)0, IO_SYNC,
910 VOP_UNLOCK(fvp);
911 if (oldparent != dp->i_number)
912 newparent = dp->i_number;
913 if (doingdirectory && newparent) {
914 if (error) /* write access check above */
915 goto bad;
916 if (xp != NULL)
917 vput(tvp);

--- 108 unchanged lines hidden (view full) ---

1026 * it above, as the remaining link would point to
1027 * a directory without "." or ".." entries.
1028 */
1029 ext2_dec_nlink(xp);
1030 if (doingdirectory) {
1031 if (xp->i_nlink > 2)
1032 panic("ext2_rename: linked directory");
1033 error = ext2_truncate(tvp, (off_t)0, IO_SYNC,
1034 tcnp->cn_cred, tcnp->cn_thread);
1034 tcnp->cn_cred, curthread);
1035 xp->i_nlink = 0;
1036 }
1037 xp->i_flag |= IN_CHANGE;
1038 vput(tvp);
1039 xp = NULL;
1040 }
1041
1042 /*

--- 376 unchanged lines hidden (view full) ---

1419 else {
1420 ip->i_size = DIRBLKSIZ;
1421 ip->i_flag |= IN_CHANGE;
1422 }
1423
1424#ifdef UFS_ACL
1425 if (dvp->v_mount->mnt_flag & MNT_ACLS) {
1426 error = ext2_do_posix1e_acl_inheritance_dir(dvp, tvp, dmode,
1035 xp->i_nlink = 0;
1036 }
1037 xp->i_flag |= IN_CHANGE;
1038 vput(tvp);
1039 xp = NULL;
1040 }
1041
1042 /*

--- 376 unchanged lines hidden (view full) ---

1419 else {
1420 ip->i_size = DIRBLKSIZ;
1421 ip->i_flag |= IN_CHANGE;
1422 }
1423
1424#ifdef UFS_ACL
1425 if (dvp->v_mount->mnt_flag & MNT_ACLS) {
1426 error = ext2_do_posix1e_acl_inheritance_dir(dvp, tvp, dmode,
1427 cnp->cn_cred, cnp->cn_thread);
1427 cnp->cn_cred, curthread);
1428 if (error)
1429 goto bad;
1430 }
1431
1432#endif /* UFS_ACL */
1433
1434 /* Directory set up, now install its entry in the parent directory. */
1435 error = ext2_direnter(ip, dvp, cnp);

--- 63 unchanged lines hidden (view full) ---

1499 cache_purge(dvp);
1500 VOP_UNLOCK(dvp);
1501 /*
1502 * Truncate inode. The only stuff left
1503 * in the directory is "." and "..".
1504 */
1505 ip->i_nlink = 0;
1506 error = ext2_truncate(vp, (off_t)0, IO_SYNC, cnp->cn_cred,
1428 if (error)
1429 goto bad;
1430 }
1431
1432#endif /* UFS_ACL */
1433
1434 /* Directory set up, now install its entry in the parent directory. */
1435 error = ext2_direnter(ip, dvp, cnp);

--- 63 unchanged lines hidden (view full) ---

1499 cache_purge(dvp);
1500 VOP_UNLOCK(dvp);
1501 /*
1502 * Truncate inode. The only stuff left
1503 * in the directory is "." and "..".
1504 */
1505 ip->i_nlink = 0;
1506 error = ext2_truncate(vp, (off_t)0, IO_SYNC, cnp->cn_cred,
1507 cnp->cn_thread);
1507 curthread);
1508 cache_purge(ITOV(ip));
1509 if (vn_lock(dvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) {
1510 VOP_UNLOCK(vp);
1511 vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
1512 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
1513 }
1514out:
1515 return (error);

--- 483 unchanged lines hidden (view full) ---

1999 */
2000 error = ext2_update(tvp, !DOINGASYNC(tvp));
2001 if (error)
2002 goto bad;
2003
2004#ifdef UFS_ACL
2005 if (dvp->v_mount->mnt_flag & MNT_ACLS) {
2006 error = ext2_do_posix1e_acl_inheritance_file(dvp, tvp, mode,
1508 cache_purge(ITOV(ip));
1509 if (vn_lock(dvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) {
1510 VOP_UNLOCK(vp);
1511 vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
1512 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
1513 }
1514out:
1515 return (error);

--- 483 unchanged lines hidden (view full) ---

1999 */
2000 error = ext2_update(tvp, !DOINGASYNC(tvp));
2001 if (error)
2002 goto bad;
2003
2004#ifdef UFS_ACL
2005 if (dvp->v_mount->mnt_flag & MNT_ACLS) {
2006 error = ext2_do_posix1e_acl_inheritance_file(dvp, tvp, mode,
2007 cnp->cn_cred, cnp->cn_thread);
2007 cnp->cn_cred, curthread);
2008 if (error)
2009 goto bad;
2010 }
2011#endif /* UFS_ACL */
2012
2013 error = ext2_direnter(ip, dvp, cnp);
2014 if (error)
2015 goto bad;

--- 335 unchanged lines hidden ---
2008 if (error)
2009 goto bad;
2010 }
2011#endif /* UFS_ACL */
2012
2013 error = ext2_direnter(ip, dvp, cnp);
2014 if (error)
2015 goto bad;

--- 335 unchanged lines hidden ---