xfs
[Top] [All Lists]

Re: [PATCH 4/4] xfs: implement freezing by emptying the AIL

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 4/4] xfs: implement freezing by emptying the AIL
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Sat, 24 Mar 2012 13:06:18 -0400
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <20120321235738.GB5091@dastard>
References: <20120316175541.258282540@xxxxxxxxxxxxxxxxxxxxxx> <20120316175636.554421689@xxxxxxxxxxxxxxxxxxxxxx> <20120321235738.GB5091@dastard>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Mar 22, 2012 at 10:57:38AM +1100, Dave Chinner wrote:
> > +    * threshold.
> > +    */
> > +   if (atomic_read(&ailp->xa_wait_empty))
> > +           target = xfs_ail_max(ailp)->li_lsn;
> 
> I don't think this is safe - we may have finished pushing the AIL to
> empty, but the waiter that decrements xa_wait_empty may not have run
> yet and we can race with that. In that case, xfs_ail_max() will
> return NULL as the AIL is empty.

True - I'll add a check for that.

> > +{
> > +   DEFINE_WAIT(wait);
> > +
> > +   /*
> > +    * We use a counter instead of a flag here to support multiple
> > +    * processes calling into sync at the same time.
> > +    */
> > +   atomic_inc(&ailp->xa_wait_empty);
> > +   do {
> > +           prepare_to_wait(&ailp->xa_empty, &wait, TASK_KILLABLE);
> 
> Why a killable wait? We need to wait until the push is complete
> before returning because we can't return an error and we don't want
> ctrl-c to break out of this loop while writeback it still taking
> place on a non-shutdown based unmount (e.g. got thousands of inodes
> to write on a slow RAID5 device doing RMW cycles for every inode).

The idea was to ease debugging if we couldn't empty the AIL.  But given
that we'd leak tons of structures that probably is not a good idea.
I'll change it.

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