Return-Path: linux-nfs-owner@vger.kernel.org Received: from [38.105.200.112] ([38.105.200.112]:48779 "EHLO mxout1.mail.janestreet.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752303AbbB0NRw (ORCPT ); Fri, 27 Feb 2015 08:17:52 -0500 Received: from tot-qpr-mailcore1.delacy.com ([172.27.56.68] helo=tot-qpr-mailcore1) by mxout1.mail.janestreet.com with smtp (Exim 4.82) (envelope-from ) id 1YRKnM-0003IX-7V for linux-nfs@vger.kernel.org; Fri, 27 Feb 2015 08:17:32 -0500 Received: from mail-yk0-f175.google.com ([209.85.160.175]) by mxgoog1.mail.janestreet.com with esmtps (UNKNOWN:AES128-GCM-SHA256:128) (Exim 4.72) (envelope-from ) id 1YRKnM-0002BK-2O for linux-nfs@vger.kernel.org; Fri, 27 Feb 2015 08:17:32 -0500 Received: by ykp131 with SMTP id 131so7140685ykp.3 for ; Fri, 27 Feb 2015 05:17:31 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1425001738.21632.45.camel@redhat.com> References: <1424964150.13431.57.camel@willson.usersys.redhat.com> <1424964871.10136.6.camel@primarydata.com> <1424964994.640.0.camel@willson.usersys.redhat.com> <1425001738.21632.45.camel@redhat.com> From: Chris Perl Date: Fri, 27 Feb 2015 08:17:11 -0500 Message-ID: Subject: Re: File Read Returns Non-existent Null Bytes To: Harshula Cc: Simo Sorce , Trond Myklebust , Linux NFS Mailing List , Chris Perl , juzou@redhat.com Content-Type: text/plain; charset=UTF-8 Sender: linux-nfs-owner@vger.kernel.org List-ID: > Just want to clarify that your example is of a writer appending to a > file while a reader keeps trying to read upto the EOF. Yes, the reader keeps issuing fixed size reads and eventually hits EOF. It then stat's the file over and over and when it sees more data available to read, it does the same thing. If I modify the reproducer to calculate the available bytes left in the file (as reported by the stat) and then make sure to never hit EOF, it is no longer reproducible. > If so, what's > happening is that the metadata (file size) becomes out of sync with > actual file data requested from the NFS server due to post-op attr > attached to the READ reply containing an updated (increased) file size. > Then NULLs are introduced between the actual file data received and the > new increased file size. This is then presented to user space. This is exactly what I believe is happening (as I kind of mentioned in earlier messages, although I haven't confirmed that its post-op attrs updating the size). Are you saying that even with locking you think this might still be possible? I had assumed that would synchronize the appender and the reader enough that it seemed unlikely, but I can try it.