From: Jeff Layton Subject: Re: [PATCH 2/2] CIFS: Simplify invalidate part (try #2) Date: Fri, 22 Apr 2011 12:59:06 -0400 Message-ID: <20110422125906.622a281b@tlielax.poochiereds.net> References: <1302635430-3575-1-git-send-email-piastry@etersoft.ru> <20110422075007.2e9c303b@tlielax.poochiereds.net> <20110422101050.1472e618@tlielax.poochiereds.net> <20110422110724.0846b1b0@tlielax.poochiereds.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Pavel Shilovsky , Shirish Pargaonkar , Suresh Jayaraman , linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Steve French Return-path: In-Reply-To: Sender: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: On Fri, 22 Apr 2011 11:28:28 -0500 Steve French wrote: > On Fri, Apr 22, 2011 at 10:07 AM, Jeff Layton wr= ote: > > On Fri, 22 Apr 2011 09:54:10 -0500 > > Steve French wrote: > > > >> On Fri, Apr 22, 2011 at 9:10 AM, Jeff Layton = wrote: > >> > On Fri, 22 Apr 2011 09:02:18 -0500 > >> > Steve French wrote: > >> > > >> >> On Fri, Apr 22, 2011 at 6:50 AM, Jeff Layton wrote: > >> >> > On Fri, 22 Apr 2011 12:09:20 +0400 > >> >> > Pavel Shilovsky wrote: > >> >> > > >> >> >> After conversation with Steve, we decided to drop > >> >> >> filemap_write_and_wait from getattr, because we already do i= t in > >> >> >> cifs_file_aio_write. I also think that we should drop it fro= m > >> >> >> cifs_llseek in this case too. I will repost this patch later= (launder > >> >> >> page operation patch was merged earlier). > >> >> >> > >> >> > > >> >> > I wasn't privy to this discussion, but that makes no sense to= me. Just > >> >> > because we initiated writeout in cifs_file_aio_write, does no= t mean > >> >> > that it's complete. If it's not complete then the size return= ed by the > >> >> > server may be bogus. > >> >> > >> >> What would a local file system do in the case when a write is > >> >> racing with a getattr? =C2=A0In the case of cifs, when we issue > >> >> a write, and don't have oplock, we immediately send the > >> >> write on the network - but AFAIK posix provides no guarantees > >> >> about ordering if they are issued at the same time. > >> >> > >> > > >> > It's not a problem for a local filesystem as there's only one se= t of > >> > metadata to deal with. Even if the writes aren't synced out to d= isk, > >> > you still know how big the file is. > >> > > >> > With a client/server setup like cifs or nfs, you have to deal wi= th two, > >> > and when there are buffered writes then there will be discrepanc= ies. > >> > The simplest way to deal with discrepancies there is to make sur= e > >> > that there aren't any by flushing out any buffered writes before > >> > fetching the attributes. > >> > >> it may sound simpler but doesn't prevent a write racing in just > >> before we send the QueryFileInfo on the wire, and it does > >> hurt performance to redundantly invoke filemap_fdatawrite. > >> > > > > IIUC, POSIX says that the st_size must reflect the results of all > > writes done up to the point that the stat() call was issued. If som= e > > race in after the fact, then that's generally ok, but we don't want= a > > situation where someone issues a ton of writes and then the stat() = call > > doesn't reflect the result of them. >=20 > aio_write doesn't return until filemap_fdatawrite completes and it > calls cifs_writepages which is synchronous - so the st_size > on the server will be uptodate if the write has completed. >=20 Used to be synchronous. One of the goals of the async write patchset I'm working on is to change that. --=20 Jeff Layton