From: Jeff Layton Subject: Re: [PATCH] CIFS: Use invalidate_inode_pages2 instead of invalidate_remote_inode (try #4) Date: Tue, 22 Mar 2011 13:42:46 -0400 Message-ID: <20110322134246.4b9e497e@corrin.poochiereds.net> References: <1300229732-4902-1-git-send-email-piastry@etersoft.ru> <20110322074233.546d4553@corrin.poochiereds.net> <20110322080409.23461155@corrin.poochiereds.net> <20110322111711.55365655@corrin.poochiereds.net> <20110322123549.022e590e@corrin.poochiereds.net> <20110322130334.0680b9a3@corrin.poochiereds.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Pavel Shilovsky , 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 Tue, 22 Mar 2011 12:13:03 -0500 Steve French wrote: > On Tue, Mar 22, 2011 at 12:03 PM, Jeff Layton wr= ote: > > On Tue, 22 Mar 2011 11:46:54 -0500 > > Steve French wrote: > > > >> On Tue, Mar 22, 2011 at 11:42 AM, Steve French wrote: > >> > Isn't there a lock across lseek? > >> > > >> >>> but how could we have PageDirty? =C2=A0We just did filemap_wri= te_and_wait > >> >>> (unless some private mmap case where it may be ok?). > >> >>> > >> >> > >> >> Nothing prevents the page from being redirtied after writeback. > >> > >> If it is redirtied, we immediately do a filemap_fdatawrite anyway = (in > >> the write/aio_write path) so there isn't a delay in writing data t= o > >> the server. > >> > > > > The bottom line is that you're asking to revalidate the file, findi= ng > > that it has changed and are trying to invalidate the pagecache. Som= e of > > those pages are may not be invalidated though, so you won't end up = with > > new data from the server if you go to do a read. > > > > The whole point of this patch is to fix data-integrity issues, righ= t? > > So why only do a half-assed job of that? >=20 > The data gets written (immediately). The page gets freed either > immediately or (in the unlikely event it was busy) the next time we d= o > a seek or revalidate or any of the other places that checks the > invalidate flag. Not sure how there is a data integrity issue. If w= e > do return EBUSY - it makes no sense on seek (we got the updated file > size) - the only case it might make sense on is strictcache read whic= h > was racing with an mmapped write and in that case the data the client > has is up to date and the next read will toss the page out of cache > since the mapping is marked invalid. Seems a lot of complexity to > return EBUSY to strictcache read since there isn't anything it can do > about it other than spin and retry and we would retry anyway on the > next operation on that file. >=20 The fact that data gets written immediately is immaterial. It's still in cache so a pagefault can find it, and it's still potentially wrong. I'm also not clear on why you're focused on seeks. What matters is that a page got dirtied while it had data on it that we were getting ready to toss out. The right course of action at that point is to try and write out the data and then return an error if that doesn't "fix" it.=20 --=20 Jeff Layton