X-Spam-Checker-Version: SpamAssassin 3.4.0-r929098 (2010-03-30) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.4.0-r929098 Received: from cuda.sgi.com (cuda2.sgi.com [192.48.176.25]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id q2OH6KIe068543 for ; Sat, 24 Mar 2012 12:06:20 -0500 X-ASG-Debug-ID: 1332608779-04cbb05c3a478bc0001-NocioJ Received: from bombadil.infradead.org (173-166-109-252-newengland.hfc.comcastbusiness.net [173.166.109.252]) by cuda.sgi.com with ESMTP id SfQ4CrKNlywnfzpH (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO) for ; Sat, 24 Mar 2012 10:06:19 -0700 (PDT) X-Barracuda-Envelope-From: BATV+ad309bf9b63c677c6a53+3135+infradead.org+hch@bombadil.srs.infradead.org X-Barracuda-Apparent-Source-IP: 173.166.109.252 Received: from hch by bombadil.infradead.org with local (Exim 4.76 #1 (Red Hat Linux)) id 1SBUPy-0008Sx-Nz; Sat, 24 Mar 2012 17:06:18 +0000 Date: Sat, 24 Mar 2012 13:06:18 -0400 From: Christoph Hellwig To: Dave Chinner Cc: Christoph Hellwig , xfs@oss.sgi.com Subject: Re: [PATCH 4/4] xfs: implement freezing by emptying the AIL Message-ID: <20120324170618.GD21708@infradead.org> X-ASG-Orig-Subj: Re: [PATCH 4/4] xfs: implement freezing by emptying the AIL References: <20120316175541.258282540@bombadil.infradead.org> <20120316175636.554421689@bombadil.infradead.org> <20120321235738.GB5091@dastard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120321235738.GB5091@dastard> User-Agent: Mutt/1.5.21 (2010-09-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html X-Barracuda-Connect: 173-166-109-252-newengland.hfc.comcastbusiness.net[173.166.109.252] X-Barracuda-Start-Time: 1332608779 X-Barracuda-Encrypted: AES256-SHA X-Barracuda-URL: http://192.48.176.25:80/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-Spam-Score: 0.10 X-Barracuda-Spam-Status: No, SCORE=0.10 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=1.3 tests=RDNS_DYNAMIC X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.92126 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_DYNAMIC Delivered to trusted network by host with dynamic-looking rDNS 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.