Return-Path: linux-nfs-owner@vger.kernel.org Received: from mxout1.mail.janestreet.com ([38.105.200.112]:34778 "EHLO mxout1.mail.janestreet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753261AbbB0UOK (ORCPT ); Fri, 27 Feb 2015 15:14:10 -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 1YRRIX-0002qR-Ep for linux-nfs@vger.kernel.org; Fri, 27 Feb 2015 15:14:09 -0500 Received: from mail-yk0-f176.google.com ([209.85.160.176]) by mxgoog1.mail.janestreet.com with esmtps (UNKNOWN:AES128-GCM-SHA256:128) (Exim 4.72) (envelope-from ) id 1YRRIX-000517-9v for linux-nfs@vger.kernel.org; Fri, 27 Feb 2015 15:14:09 -0500 Received: by ykq19 with SMTP id 19so8216924ykq.9 for ; Fri, 27 Feb 2015 12:14:09 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Chris Perl Date: Fri, 27 Feb 2015 15:13:48 -0500 Message-ID: Subject: Re: File Read Returns Non-existent Null Bytes To: David Brodbeck Cc: Trond Myklebust , Linux NFS Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-nfs-owner@vger.kernel.org List-ID: > I *think* in the situation where the file is being appended to, you're not > likely to see anything but nulls. Agreed. > I'm not an expert but I think this occurs > when the read happens between the file size being extended and the new data > being written, effectively making a 'hole' at the end of the file. As said in other replies, its because the size is updated causing too much data to be read out of the page cache, effectively appending NULLs to the data. > When you're reading a file that's been concurrently modified, you can get > corruption (a mix of new and old data) on pretty much any filesystem that > doesn't enforce mandatory locks. It's just much less likely on a local > filesystem because the window is shorter and more operations are atomic. If you're talking about a local filesystem and you have one process appending data (with O_APPEND) and another reading, I don't believe you'll see the same sort of issue (but, I could be wrong).