From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Allison Subject: Re: fallocate vs ENOSPC Date: Mon, 28 Nov 2011 16:45:26 -0800 Message-ID: <20111129004526.GB21894@samba2> References: <4ECF6D41.2040801@draigBrady.com> <20111125104050.GA26729@infradead.org> <20111127031455.GK5167@thunk.org> <20111127234331.GW2386@dastard> <20111128051054.GZ2386@dastard> <4ED34C66.8050300@draigBrady.com> <20111128184940.GA5170@samba2> <20111129002629.GB2386@dastard> Reply-To: Jeremy Allison Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Jeremy Allison , Theodore Tso , =?iso-8859-1?Q?P=E1draig?= Brady , Christoph Hellwig , linux-fsdevel@vger.kernel.org To: Dave Chinner Return-path: Received: from fn.samba.org ([216.83.154.106]:55258 "EHLO lists.samba.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752877Ab1K2Apb (ORCPT ); Mon, 28 Nov 2011 19:45:31 -0500 Content-Disposition: inline In-Reply-To: <20111129002629.GB2386@dastard> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Nov 29, 2011 at 11:26:29AM +1100, Dave Chinner wrote: > On Mon, Nov 28, 2011 at 10:49:40AM -0800, Jeremy Allison wrote: > > On Mon, Nov 28, 2011 at 09:36:18AM -0500, Theodore Tso wrote: > > >=20 > > > On Nov 28, 2011, at 3:55 AM, P=E1draig Brady wrote: > > >=20 > > > >=20 > > > > You lucidly detailed issues with 1. which I suppose could be so= mewhat > > > > mitigated by not fallocating < say 1MB, though I suppose file s= ystems > > > > could be smarter here and not preallocate small chunks (or when > > > > otherwise not appropriate). We can already get ENOSPC from a wr= ite() > > > > after an fallocate() in certain edge cases, so it would probabl= y make > > > > sense to expand those cases. > > >=20 > > > I'm curious -- why are you so worried about ENOSPC? > > >=20 > > > You need to check the error returns on write(2) anyway (and it's = good > > > programming practice anyways --- don't forget to check on close b= ecause > > > some network file systems only push to the network on close, and = in > > > some cases they might only get quota errors on the close), so I d= on't see > > > why using fallocate() to get an early ENOSPC is so interesting fo= r you. > >=20 > > Unfortunately for Samba, Windows clients will *only* report ENOSPC > > to the userspace apps if the initial fallocation fails. Most of > > the Windows apps don't bother to check for write() fails after > > the initial allocation succeeds. > >=20 > > We check for and report them back to the Windows client anyway of > > course, but most Windows apps just silently corrupt their data in > > this case. > >=20 > > That's why we use fallocate() in Samba :-(. >=20 > IOWs, what you really want is a space reservation mechanism. You've > only got this preallocate hammer, so you use it, yes? Yes, absolutely. We're just trying to provide the Windows semantics the clients expect. Jeremy. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html