Re: [PATCH 4/6] xfs: allow reusing busy extents where safe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 23, 2011 at 11:20:24AM +1100, Dave Chinner wrote:
> >  		overlap = xfs_alloc_busy_try_reuse(pag, busyp,
> >  						   fbno, fbno + flen);
> > -		if (overlap) {
> > +		if (overlap == -1 || (overlap && userdata)) {
> >  			spin_unlock(&pag->pagb_lock);
> >  			xfs_log_force(tp->t_mountp, XFS_LOG_SYNC);
> >  			goto restart;
> 
> Ok, so the only time we'll do a log force now is on an complete
> overlap or a partial userdata overlap?

We do it if we would have to split the busy extent, or reallocate
metadata to userdata.

> > +		if (!args->userdata ||
> > +		    (busyp->flags & XFS_ALLOC_BUSY_USERDATA)) {
> > +			int overlap;
> > +
> > +			overlap = xfs_alloc_busy_try_reuse(args->pag, busyp,
> > +							   fbno, fbno + flen);
> > +			if (unlikely(overlap == -1)) {
> > +				spin_unlock(&args->pag->pagb_lock);
> > +				xfs_log_force(args->mp, XFS_LOG_SYNC);
> > +				goto restart;
> > +			}
> 
> Hmmmm - I'm not so sure we can reuse overlapped data extents for
> data allocations without a log force at all as there is no guarantee
> that the data will not be overwritten before the original free
> transaction is on disk.
> 
> That is, recovery may not replay the original data extent free
> transaction or the new allocation transaction, but there is nothing
> stopping us from having written the new data into the extent before
> the crash occurred, especially as delayed allocation places the
> allocation very close the data IO issue. e.g.:
> 
> 	thread X		thread Y
> 	free data extent ABC
> 				allocate data extent BCD
> 				partial overlap, no log force
> 				issue data IO
> 				.....
> 
> 		 <crash>
> 
> That leads to corruption of the data in the original file because
> neither transaction is written to disk, but new data is....

You're right.  It's fine from the transaction point of view, but
it could leave wrong data in a file.  I'll disallow this case, too.

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux