[XFS] Fixed delayed_blks assert failure during umount. The delayed_blks
authorYingping Lu <yingping@sgi.com>
Wed, 11 Jan 2006 04:38:31 +0000 (15:38 +1100)
committerNathan Scott <nathans@sgi.com>
Wed, 11 Jan 2006 04:38:31 +0000 (15:38 +1100)
was caused by ENOSPC but not Rreclaimed by xfs_release or xfs_inactive.
The fix changed the condition in xfs_release and xfs_inactive to invoke
xfs_inactive_free_eofblocks for this special case, changed
xfs_inactive_free_eofblocks to clean the delayed blks after eof. It also
changed xfs_write to set correct eof when ENOSPC occurs.

SGI-PV: 946267
SGI-Modid: xfs-linux-melb:xfs-kern:203788a

Signed-off-by: Yingping Lu <yingping@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
fs/xfs/linux-2.6/xfs_lrw.c
fs/xfs/xfs_vnodeops.c

index 563cb9e975d2b223f3a9bc5848e287fef400cb03..147a28861f6b228fe2449cf31dde5bdb0b7f2efa 100644 (file)
@@ -809,6 +809,10 @@ retry:
                goto retry;
        }
 
+       isize = i_size_read(inode);
+       if (unlikely(ret < 0 && ret != -EFAULT && *offset > isize))
+               *offset = isize;
+
        if (*offset > xip->i_d.di_size) {
                xfs_ilock(xip, XFS_ILOCK_EXCL);
                if (*offset > xip->i_d.di_size) {
index 688fc2cb4b8d9f5f66a00700889bec972bd67ea0..3e8f1cbb7049ba6ac220d2818da923d42557155d 100644 (file)
@@ -1213,7 +1213,8 @@ xfs_inactive_free_eofblocks(
        xfs_iunlock(ip, XFS_ILOCK_SHARED);
 
        if (!error && (nimaps != 0) &&
-           (imap.br_startblock != HOLESTARTBLOCK)) {
+           (imap.br_startblock != HOLESTARTBLOCK ||
+            ip->i_delayed_blks)) {
                /*
                 * Attach the dquots to the inode up front.
                 */
@@ -1548,7 +1549,8 @@ xfs_release(
 
        if (ip->i_d.di_nlink != 0) {
                if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) &&
-                    ((ip->i_d.di_size > 0) || (VN_CACHED(vp) > 0)) &&
+                    ((ip->i_d.di_size > 0) || (VN_CACHED(vp) > 0 ||
+                      ip->i_delayed_blks > 0)) &&
                     (ip->i_df.if_flags & XFS_IFEXTENTS))  &&
                    (!(ip->i_d.di_flags &
                                (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)))) {
@@ -1627,7 +1629,8 @@ xfs_inactive(
 
        if (ip->i_d.di_nlink != 0) {
                if ((((ip->i_d.di_mode & S_IFMT) == S_IFREG) &&
-                    ((ip->i_d.di_size > 0) || (VN_CACHED(vp) > 0)) &&
+                     ((ip->i_d.di_size > 0) || (VN_CACHED(vp) > 0 ||
+                       ip->i_delayed_blks > 0)) &&
                      (ip->i_df.if_flags & XFS_IFEXTENTS) &&
                     (!(ip->i_d.di_flags &
                                (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)) ||