Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/tg3-2.6
[safe/jmp/linux-2.6] / fs / xfs / xfs_vnodeops.c
index 443ec6a..e03fa2a 100644 (file)
@@ -1,33 +1,19 @@
 /*
- * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
  * published by the Free Software Foundation.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include "xfs.h"
 #include "xfs_fs.h"
@@ -547,8 +533,7 @@ xfs_setattr(
                /*
                 * Can't change extent size if any extents are allocated.
                 */
-               if ((ip->i_d.di_nextents || ip->i_delayed_blks) &&
-                   (mask & XFS_AT_EXTSIZE) &&
+               if (ip->i_d.di_nextents && (mask & XFS_AT_EXTSIZE) &&
                    ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) !=
                     vap->va_extsize) ) {
                        code = XFS_ERROR(EINVAL);       /* EFBIG? */
@@ -576,7 +561,8 @@ xfs_setattr(
                /*
                 * Can't change realtime flag if any extents are allocated.
                 */
-               if (ip->i_d.di_nextents && (mask & XFS_AT_XFLAGS) &&
+               if ((ip->i_d.di_nextents || ip->i_delayed_blks) &&
+                   (mask & XFS_AT_XFLAGS) &&
                    (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) !=
                    (vap->va_xflags & XFS_XFLAG_REALTIME)) {
                        code = XFS_ERROR(EINVAL);       /* EFBIG? */
@@ -640,8 +626,10 @@ xfs_setattr(
         */
        if (mask & XFS_AT_SIZE) {
                code = 0;
-               if (vap->va_size > ip->i_d.di_size)
+               if ((vap->va_size > ip->i_d.di_size) && 
+                   (flags & ATTR_NOSIZETOK) == 0) {
                        code = xfs_igrow_start(ip, vap->va_size, credp);
+               }
                xfs_iunlock(ip, XFS_ILOCK_EXCL);
                if (!code)
                        code = xfs_itruncate_data(ip, vap->va_size);
@@ -3970,8 +3958,9 @@ xfs_finish_reclaim_all(xfs_mount_t *mp, int noblock)
                                }
                        }
                        XFS_MOUNT_IUNLOCK(mp);
-                       xfs_finish_reclaim(ip, noblock,
-                               XFS_IFLUSH_DELWRI_ELSE_ASYNC);
+                       if (xfs_finish_reclaim(ip, noblock,
+                                       XFS_IFLUSH_DELWRI_ELSE_ASYNC))
+                               delay(1);
                        purged = 1;
                        break;
                }