Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3668dd8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs

* 'for-linus' of git://oss.sgi.com/xfs/xfs:
  xfs: remove block number from inode lookup code
  xfs: rename XFS_IGET_BULKSTAT to XFS_IGET_UNTRUSTED
  xfs: validate untrusted inode numbers during lookup
  xfs: always use iget in bulkstat
  xfs: prevent swapext from operating on write-only files
parents 744c5578 7b6259e7
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -128,13 +128,12 @@ xfs_nfs_get_inode(
		return ERR_PTR(-ESTALE);

	/*
	 * The XFS_IGET_BULKSTAT means that an invalid inode number is just
	 * fine and not an indication of a corrupted filesystem.  Because
	 * clients can send any kind of invalid file handle, e.g. after
	 * a restore on the server we have to deal with this case gracefully.
	 * The XFS_IGET_UNTRUSTED means that an invalid inode number is just
	 * fine and not an indication of a corrupted filesystem as clients can
	 * send invalid file handles and we have to handle it gracefully..
	 */
	error = xfs_iget(mp, NULL, ino, XFS_IGET_BULKSTAT,
			 XFS_ILOCK_SHARED, &ip, 0);
	error = xfs_iget(mp, NULL, ino, XFS_IGET_UNTRUSTED,
			 XFS_ILOCK_SHARED, &ip);
	if (error) {
		/*
		 * EINVAL means the inode cluster doesn't exist anymore.
+3 −4
Original line number Diff line number Diff line
@@ -679,10 +679,9 @@ xfs_ioc_bulkstat(
		error = xfs_bulkstat_single(mp, &inlast,
						bulkreq.ubuffer, &done);
	else	/* XFS_IOC_FSBULKSTAT */
		error = xfs_bulkstat(mp, &inlast, &count,
			(bulkstat_one_pf)xfs_bulkstat_one, NULL,
		error = xfs_bulkstat(mp, &inlast, &count, xfs_bulkstat_one,
				     sizeof(xfs_bstat_t), bulkreq.ubuffer,
			BULKSTAT_FG_QUICK, &done);
				     &done);

	if (error)
		return -error;
+5 −10
Original line number Diff line number Diff line
@@ -237,15 +237,12 @@ xfs_bulkstat_one_compat(
	xfs_ino_t	ino,		/* inode number to get data for */
	void		__user *buffer,	/* buffer to place output in */
	int		ubsize,		/* size of buffer */
	void		*private_data,	/* my private data */
	xfs_daddr_t	bno,		/* starting bno of inode cluster */
	int		*ubused,	/* bytes used by me */
	void		*dibuff,	/* on-disk inode buffer */
	int		*stat)		/* BULKSTAT_RV_... */
{
	return xfs_bulkstat_one_int(mp, ino, buffer, ubsize,
				    xfs_bulkstat_one_fmt_compat, bno,
				    ubused, dibuff, stat);
				    xfs_bulkstat_one_fmt_compat,
				    ubused, stat);
}

/* copied from xfs_ioctl.c */
@@ -298,13 +295,11 @@ xfs_compat_ioc_bulkstat(
		int res;

		error = xfs_bulkstat_one_compat(mp, inlast, bulkreq.ubuffer,
				sizeof(compat_xfs_bstat_t),
				NULL, 0, NULL, NULL, &res);
				sizeof(compat_xfs_bstat_t), 0, &res);
	} else if (cmd == XFS_IOC_FSBULKSTAT_32) {
		error = xfs_bulkstat(mp, &inlast, &count,
			xfs_bulkstat_one_compat, NULL,
			sizeof(compat_xfs_bstat_t), bulkreq.ubuffer,
			BULKSTAT_FG_QUICK, &done);
			xfs_bulkstat_one_compat, sizeof(compat_xfs_bstat_t),
			bulkreq.ubuffer, &done);
	} else
		error = XFS_ERROR(EINVAL);
	if (error)
+8 −10
Original line number Diff line number Diff line
@@ -1632,10 +1632,7 @@ xfs_qm_dqusage_adjust(
	xfs_ino_t	ino,		/* inode number to get data for */
	void		__user *buffer,	/* not used */
	int		ubsize,		/* not used */
	void		*private_data,	/* not used */
	xfs_daddr_t	bno,		/* starting block of inode cluster */
	int		*ubused,	/* not used */
	void		*dip,		/* on-disk inode pointer (not used) */
	int		*res)		/* result code value */
{
	xfs_inode_t	*ip;
@@ -1660,7 +1657,7 @@ xfs_qm_dqusage_adjust(
	 * the case in all other instances. It's OK that we do this because
	 * quotacheck is done only at mount time.
	 */
	if ((error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_EXCL, &ip, bno))) {
	if ((error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_EXCL, &ip))) {
		*res = BULKSTAT_RV_NOTHING;
		return error;
	}
@@ -1796,9 +1793,10 @@ xfs_qm_quotacheck(
		 * Iterate thru all the inodes in the file system,
		 * adjusting the corresponding dquot counters in core.
		 */
		if ((error = xfs_bulkstat(mp, &lastino, &count,
				     xfs_qm_dqusage_adjust, NULL,
				     structsz, NULL, BULKSTAT_FG_IGET, &done)))
		error = xfs_bulkstat(mp, &lastino, &count,
				     xfs_qm_dqusage_adjust,
				     structsz, NULL, &done);
		if (error)
			break;

	} while (!done);
@@ -1889,14 +1887,14 @@ xfs_qm_init_quotainos(
		    mp->m_sb.sb_uquotino != NULLFSINO) {
			ASSERT(mp->m_sb.sb_uquotino > 0);
			if ((error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino,
					     0, 0, &uip, 0)))
					     0, 0, &uip)))
				return XFS_ERROR(error);
		}
		if (XFS_IS_OQUOTA_ON(mp) &&
		    mp->m_sb.sb_gquotino != NULLFSINO) {
			ASSERT(mp->m_sb.sb_gquotino > 0);
			if ((error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino,
					     0, 0, &gip, 0))) {
					     0, 0, &gip))) {
				if (uip)
					IRELE(uip);
				return XFS_ERROR(error);
+12 −15
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ xfs_qm_scall_trunc_qfiles(
	}

	if ((flags & XFS_DQ_USER) && mp->m_sb.sb_uquotino != NULLFSINO) {
		error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, 0, 0, &qip, 0);
		error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, 0, 0, &qip);
		if (!error) {
			error = xfs_truncate_file(mp, qip);
			IRELE(qip);
@@ -271,7 +271,7 @@ xfs_qm_scall_trunc_qfiles(

	if ((flags & (XFS_DQ_GROUP|XFS_DQ_PROJ)) &&
	    mp->m_sb.sb_gquotino != NULLFSINO) {
		error2 = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, 0, 0, &qip, 0);
		error2 = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, 0, 0, &qip);
		if (!error2) {
			error2 = xfs_truncate_file(mp, qip);
			IRELE(qip);
@@ -417,12 +417,12 @@ xfs_qm_scall_getqstat(
	}
	if (!uip && mp->m_sb.sb_uquotino != NULLFSINO) {
		if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino,
					0, 0, &uip, 0) == 0)
					0, 0, &uip) == 0)
			tempuqip = B_TRUE;
	}
	if (!gip && mp->m_sb.sb_gquotino != NULLFSINO) {
		if (xfs_iget(mp, NULL, mp->m_sb.sb_gquotino,
					0, 0, &gip, 0) == 0)
					0, 0, &gip) == 0)
			tempgqip = B_TRUE;
	}
	if (uip) {
@@ -1109,10 +1109,7 @@ xfs_qm_internalqcheck_adjust(
	xfs_ino_t	ino,		/* inode number to get data for */
	void		__user *buffer,	/* not used */
	int		ubsize,		/* not used */
	void		*private_data,	/* not used */
	xfs_daddr_t	bno,		/* starting block of inode cluster */
	int		*ubused,	/* not used */
	void		*dip,		/* not used */
	int		*res)		/* bulkstat result code */
{
	xfs_inode_t		*ip;
@@ -1134,7 +1131,7 @@ xfs_qm_internalqcheck_adjust(
	ipreleased = B_FALSE;
 again:
	lock_flags = XFS_ILOCK_SHARED;
	if ((error = xfs_iget(mp, NULL, ino, 0, lock_flags, &ip, bno))) {
	if ((error = xfs_iget(mp, NULL, ino, 0, lock_flags, &ip))) {
		*res = BULKSTAT_RV_NOTHING;
		return (error);
	}
@@ -1205,15 +1202,15 @@ xfs_qm_internalqcheck(
		 * Iterate thru all the inodes in the file system,
		 * adjusting the corresponding dquot counters
		 */
		if ((error = xfs_bulkstat(mp, &lastino, &count,
				 xfs_qm_internalqcheck_adjust, NULL,
				 0, NULL, BULKSTAT_FG_IGET, &done))) {
			break;
		}
	} while (! done);
		error = xfs_bulkstat(mp, &lastino, &count,
				 xfs_qm_internalqcheck_adjust,
				 0, NULL, &done);
		if (error) {
			cmn_err(CE_DEBUG, "Bulkstat returned error 0x%x", error);
			break;
		}
	} while (!done);

	cmn_err(CE_DEBUG, "Checking results against system dquots");
	for (i = 0; i < qmtest_hashmask; i++) {
		xfs_dqtest_t	*d, *n;
Loading