patch-2.4.26 linux-2.4.26/fs/xfs/xfs_dfrag.c

Next file: linux-2.4.26/fs/xfs/xfs_dir2_node.c
Previous file: linux-2.4.26/fs/xfs/xfs_clnt.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.25/fs/xfs/xfs_dfrag.c linux-2.4.26/fs/xfs/xfs_dfrag.c
@@ -119,6 +119,11 @@
 		tip = XFS_BHVTOI(tbdp);
 	}
 
+	if (ip->i_mount != tip->i_mount) {
+		error =  XFS_ERROR(EINVAL);
+		goto error0;
+	}
+
 	if (ip->i_ino == tip->i_ino) {
 		error =  XFS_ERROR(EINVAL);
 		goto error0;
@@ -147,20 +152,17 @@
 	xfs_lock_inodes(ips, 2, 0, lock_flags);
 
 	/* Check permissions */
-	if ((error = _MAC_XFS_IACCESS(ip, MACWRITE, NULL))) {
-		goto error0;
-	}
-	if ((error = _MAC_XFS_IACCESS(tip, MACWRITE, NULL))) {
+	error = xfs_iaccess(ip, S_IWUSR, NULL);
+	if (error)
 		goto error0;
-	}
-	if ((current_fsuid(cred) != ip->i_d.di_uid) &&
-	    (error = xfs_iaccess(ip, S_IWUSR, NULL)) &&
-	    !capable_cred(NULL, CAP_FOWNER)) {
+
+	error = xfs_iaccess(tip, S_IWUSR, NULL);
+	if (error)
 		goto error0;
-	}
-	if ((current_fsuid(cred) != tip->i_d.di_uid) &&
-	    (error = xfs_iaccess(tip, S_IWUSR, NULL)) &&
-	    !capable_cred(NULL, CAP_FOWNER)) {
+
+	/* Verify that both files have the same format */
+	if ((ip->i_d.di_mode & S_IFMT) != (tip->i_d.di_mode & S_IFMT)) {
+		error = XFS_ERROR(EINVAL);
 		goto error0;
 	}
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)