From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve French Subject: Re: What trigge fsync of file on last close of the open inode? Date: Wed, 04 Oct 2006 10:13:45 -0500 Message-ID: <4523CFA9.7030200@us.ibm.com> References: <4522BFA8.9040000@us.ibm.com> <1159905941.18918.7.camel@kleikamp.austin.ibm.com> <4522CBFD.3010202@us.ibm.com> <4522D30E.7080505@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Dave Kleikamp , linux-fsdevel@vger.kernel.org, Shirish S Pargaonkar Return-path: Received: from e5.ny.us.ibm.com ([32.97.182.145]:34755 "EHLO e5.ny.us.ibm.com") by vger.kernel.org with ESMTP id S1161217AbWJDPMz (ORCPT ); Wed, 4 Oct 2006 11:12:55 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.13.8/8.12.11) with ESMTP id k94FCsS2003994 for ; Wed, 4 Oct 2006 11:12:54 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay04.pok.ibm.com (8.13.6/8.13.6/NCO v8.1.1) with ESMTP id k94FCsJa132558 for ; Wed, 4 Oct 2006 11:12:54 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id k94FCr4P020279 for ; Wed, 4 Oct 2006 11:12:54 -0400 To: Zach Brown In-Reply-To: <4522D30E.7080505@oracle.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Zach Brown wrote: > Steve French wrote: > >> Dave Kleikamp wrote: >> >>>> Someone had reported a problem with a writepages call coming in on >>>> with no open files (so presumably the file was closed, with dirty >>>> pages not written). >>>> > > So is the problem that you're getting a cifs_writepages() call after > cifs_close() returns? > > > Probably - I could not see any other path that could cause that cifs error to be logged to dmesg >> May be a case in which filemap_fdatawrite returns before the write(s) is >> sent to the vfs and write races with close (although cifs will defer a >> file close if a write is pending on that handle)? >> > > Are writes to mmap()ed regions involved at all? They lead to pages > being dirtied at unmapping and eventually hitting ->writepage, > potentially after ->flush and ->release have been called. > > I don't think so - but the person reporting it did not give much information, and the error is not something that I have been seeing so I can't draw conclusions about that. > I imagine you could force writeback of dirty pages in ->release so that > you don't wait for writeback to come around and hit them. Heck, it > might be doing this already. I didn't look very hard :). > filemap_fdatawrite is called in cifs flush (which I verified is called just before close) and close will be delayed (not sent over the network) if a write is pending on that file handle but there may be two possibilities: 1) the page gets dirty while it is being released (between fput->->cifs_flush and fput->cifs_close) 2) filemap_fdatawrite did not flush the pages fast enough - and needs to be changed to the filemap write and wait variant of the call in this location.