xfs
[Top] [All Lists]

Re: ASSERT trip in XFS

To: Daniel Moore <dxm@xxxxxxxxxxxxxxxxxxxxxxxx>, linux-xfs@xxxxxxxxxxx
Subject: Re: ASSERT trip in XFS
From: Steve Lord <lord@xxxxxxx>
Date: Mon, 22 Jan 2001 14:50:16 -0600
In-reply-to: Message from Steve Lord <lord@sgi.com> of "Mon, 22 Jan 2001 11:27:34 CST." <200101221727.f0MHRYv12660@jen.americas.sgi.com>
Sender: owner-linux-xfs@xxxxxxxxxxx
> > 
> > With T-o-T XFS, on IDE, no kio, SMP, no HIGHMEM, qa 042 fails in page_daemo
> n:
> > (related to recent "xfs_strategy" changes ?)
> > 
> > (failed 2 out of 2 runs)
> 
> I cannot make this test fail for me, but I did manage to hit this via
> other means. I will dig into it, but yes the strategy change looks like
> a candidate for causing this. More to follow....
> 
> Steve
> 


Daniel, can you try this patch, I do not have a sure fire way of
triggering this problem on my hardware. The problem appears to be
related to locking differences between Irix and Linux (again), the
strategy call in Irix is called with the buffer locked for the
duration, which means no one can change the underlying extents.
In the Linux case we have one page locked, and anything else in
the system can truncate the file out underneath us - we end up
allocating a new extent from scratch rather than turning a delalloc
into a real extent, this causes the extent to trip.

This patch stops strategy from allocating real disk blocks beyond the
current end of file, it could be more sophisticated, but this is more
a proof of concept fix than anything else.

Steve


===========================================================================
Index: linux/fs/xfs/linux/xfs_lrw.c
===========================================================================

--- /usr/tmp/TmpDir.15502-0/linux/fs/xfs/linux/xfs_lrw.c_1.72   Mon Jan 22 
14:45:20 2001
+++ linux/fs/xfs/linux/xfs_lrw.c        Mon Jan 22 14:44:09 2001
@@ -794,14 +794,12 @@
                return XFS_ERROR(EIO);
 
        if (flags & PBF_READ) {
-               ASSERT(ismrlocked(&ip->i_iolock, MR_ACCESS | MR_UPDATE) != 0);
                unlocked = 0;
                lockmode = xfs_ilock_map_shared(ip);
                error = xfs_iomap_read(&ip->i_iocore, offset, count,
                                 XFS_BMAPI_ENTIRE, pbmapp, npbmaps, NULL);
                xfs_iunlock_map_shared(ip, lockmode);
        } else { /* PBF_WRITE */
-               ASSERT(ismrlocked(&ip->i_iolock, MR_ACCESS | MR_UPDATE) != 0);
                ASSERT(flags & PBF_WRITE);
                vp = BHV_TO_VNODE(bdp);
                xfs_ilock(ip, XFS_ILOCK_EXCL);
@@ -966,12 +964,25 @@
                                                XFS_EXTSIZE_WR);
                        }
 
+
                        /*
                         * Allocate the backing store for the file.
                         */
                        XFS_BMAP_INIT(&(free_list),
                                        &(first_block));
                        nimaps = XFS_STRAT_WRITE_IMAPS;
+
+                       /*
+                        * Ensure we don't go beyond eof - it is possible
+                        * the extents changed since we did the read call,
+                        * we dropped the ilock in the interim.
+                        */
+
+                       end_fsb = XFS_B_TO_FSB(mp, XFS_SIZE(mp, io));
+                       if ((map_start_fsb + count_fsb) > end_fsb) {
+                               count_fsb = end_fsb - map_start_fsb;
+                       }
+
                        error = XFS_BMAPI(mp, tp, io, map_start_fsb, count_fsb,
                                        XFS_BMAPI_WRITE, &first_block, 1,
                                        imap, &nimaps, &free_list);



<Prev in Thread] Current Thread [Next in Thread>