Deleted Added
full compact
ext2_vnops.c (221128) ext2_vnops.c (221166)
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 * Copyright (c) 1982, 1986, 1989, 1993

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

34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 *
40 * @(#)ufs_vnops.c 8.7 (Berkeley) 2/3/94
41 * @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
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 * Copyright (c) 1982, 1986, 1989, 1993

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

34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 *
40 * @(#)ufs_vnops.c 8.7 (Berkeley) 2/3/94
41 * @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
42 * $FreeBSD: head/sys/fs/ext2fs/ext2_vnops.c 221128 2011-04-27 18:25:35Z jhb $
42 * $FreeBSD: head/sys/fs/ext2fs/ext2_vnops.c 221166 2011-04-28 14:27:17Z jhb $
43 */
44
45#include "opt_suiddir.h"
46
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/kernel.h>
50#include <sys/fcntl.h>

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

733 goto out;
734 }
735 if (ip->i_flags & (IMMUTABLE | APPEND)) {
736 error = EPERM;
737 goto out;
738 }
739 ip->i_nlink++;
740 ip->i_flag |= IN_CHANGE;
43 */
44
45#include "opt_suiddir.h"
46
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/kernel.h>
50#include <sys/fcntl.h>

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

733 goto out;
734 }
735 if (ip->i_flags & (IMMUTABLE | APPEND)) {
736 error = EPERM;
737 goto out;
738 }
739 ip->i_nlink++;
740 ip->i_flag |= IN_CHANGE;
741 error = ext2_update(vp, 1);
741 error = ext2_update(vp, !DOINGASYNC(vp));
742 if (!error)
743 error = ext2_direnter(ip, tdvp, cnp);
744 if (error) {
745 ip->i_nlink--;
746 ip->i_flag |= IN_CHANGE;
747 }
748out:
749 return (error);

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

879 /*
880 * 1) Bump link count while we're moving stuff
881 * around. If we crash somewhere before
882 * completing our work, the link count
883 * may be wrong, but correctable.
884 */
885 ip->i_nlink++;
886 ip->i_flag |= IN_CHANGE;
742 if (!error)
743 error = ext2_direnter(ip, tdvp, cnp);
744 if (error) {
745 ip->i_nlink--;
746 ip->i_flag |= IN_CHANGE;
747 }
748out:
749 return (error);

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

879 /*
880 * 1) Bump link count while we're moving stuff
881 * around. If we crash somewhere before
882 * completing our work, the link count
883 * may be wrong, but correctable.
884 */
885 ip->i_nlink++;
886 ip->i_flag |= IN_CHANGE;
887 if ((error = ext2_update(fvp, 1)) != 0) {
887 if ((error = ext2_update(fvp, !DOINGASYNC(fvp))) != 0) {
888 VOP_UNLOCK(fvp, 0);
889 goto bad;
890 }
891
892 /*
893 * If ".." must be changed (ie the directory gets a new
894 * parent) then the source directory must not be in the
895 * directory hierarchy above the target, as this would

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

938 */
939 if (doingdirectory && newparent) {
940 if ((nlink_t)dp->i_nlink >= LINK_MAX) {
941 error = EMLINK;
942 goto bad;
943 }
944 dp->i_nlink++;
945 dp->i_flag |= IN_CHANGE;
888 VOP_UNLOCK(fvp, 0);
889 goto bad;
890 }
891
892 /*
893 * If ".." must be changed (ie the directory gets a new
894 * parent) then the source directory must not be in the
895 * directory hierarchy above the target, as this would

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

938 */
939 if (doingdirectory && newparent) {
940 if ((nlink_t)dp->i_nlink >= LINK_MAX) {
941 error = EMLINK;
942 goto bad;
943 }
944 dp->i_nlink++;
945 dp->i_flag |= IN_CHANGE;
946 error = ext2_update(tdvp, 1);
946 error = ext2_update(tdvp, !DOINGASYNC(tdvp));
947 if (error)
948 goto bad;
949 }
950 error = ext2_direnter(ip, tdvp, tcnp);
951 if (error) {
952 if (doingdirectory && newparent) {
953 dp->i_nlink--;
954 dp->i_flag |= IN_CHANGE;

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

1206 /*
1207 * Bump link count in parent directory
1208 * to reflect work done below. Should
1209 * be done before reference is created
1210 * so reparation is possible if we crash.
1211 */
1212 dp->i_nlink++;
1213 dp->i_flag |= IN_CHANGE;
947 if (error)
948 goto bad;
949 }
950 error = ext2_direnter(ip, tdvp, tcnp);
951 if (error) {
952 if (doingdirectory && newparent) {
953 dp->i_nlink--;
954 dp->i_flag |= IN_CHANGE;

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

1206 /*
1207 * Bump link count in parent directory
1208 * to reflect work done below. Should
1209 * be done before reference is created
1210 * so reparation is possible if we crash.
1211 */
1212 dp->i_nlink++;
1213 dp->i_flag |= IN_CHANGE;
1214 error = ext2_update(dvp, 1);
1214 error = ext2_update(dvp, !DOINGASYNC(dvp));
1215 if (error)
1216 goto bad;
1217
1218 /* Initialize directory with "." and ".." from static template. */
1219 if (EXT2_HAS_INCOMPAT_FEATURE(ip->i_e2fs,
1220 EXT2F_INCOMPAT_FTYPE))
1221 dtp = &mastertemplate;
1222 else

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

1650 }
1651
1652 if (cnp->cn_flags & ISWHITEOUT)
1653 ip->i_flags |= UF_OPAQUE;
1654
1655 /*
1656 * Make sure inode goes to disk before directory entry.
1657 */
1215 if (error)
1216 goto bad;
1217
1218 /* Initialize directory with "." and ".." from static template. */
1219 if (EXT2_HAS_INCOMPAT_FEATURE(ip->i_e2fs,
1220 EXT2F_INCOMPAT_FTYPE))
1221 dtp = &mastertemplate;
1222 else

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

1650 }
1651
1652 if (cnp->cn_flags & ISWHITEOUT)
1653 ip->i_flags |= UF_OPAQUE;
1654
1655 /*
1656 * Make sure inode goes to disk before directory entry.
1657 */
1658 error = ext2_update(tvp, 1);
1658 error = ext2_update(tvp, !DOINGASYNC(tvp));
1659 if (error)
1660 goto bad;
1661 error = ext2_direnter(ip, dvp, cnp);
1662 if (error)
1663 goto bad;
1664
1665 *vpp = tvp;
1666 return (0);
1667
1668bad:
1669 /*
1670 * Write error occurred trying to update the inode
1671 * or the directory so must deallocate the inode.
1672 */
1673 ip->i_nlink = 0;
1674 ip->i_flag |= IN_CHANGE;
1675 vput(tvp);
1676 return (error);
1677}
1659 if (error)
1660 goto bad;
1661 error = ext2_direnter(ip, dvp, cnp);
1662 if (error)
1663 goto bad;
1664
1665 *vpp = tvp;
1666 return (0);
1667
1668bad:
1669 /*
1670 * Write error occurred trying to update the inode
1671 * or the directory so must deallocate the inode.
1672 */
1673 ip->i_nlink = 0;
1674 ip->i_flag |= IN_CHANGE;
1675 vput(tvp);
1676 return (error);
1677}