Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752725AbcDUOSm (ORCPT ); Thu, 21 Apr 2016 10:18:42 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:18744 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751790AbcDUOSl (ORCPT ); Thu, 21 Apr 2016 10:18:41 -0400 Subject: Re: [patch] direct-io: propagate -ENOSPC errors To: Jeff Moyer , Christoph Hellwig References: <20160321160208.GA15481@infradead.org> Cc: Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org From: Todd Vierling Message-ID: <07bce0cc-efe2-9a73-09a4-3c041bf6067f@oracle.com> Date: Thu, 21 Apr 2016 10:17:50 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1377 Lines: 28 On 03/21/2016 04:22 PM, Jeff Moyer wrote: >> Just propagating some errors defintively seems odd. > > Not really. read, write, etc only expect a subset of errnos to be > returned. The goal was not to leak kernel-internal or unexpected error > numbers to userspace, and I didn't think I would be able to successfully > audit all code paths that lead here. So, I opted for a more > conservative patch that just allows one more errno through. We have a use case which makes heavy use of dm to map plain files into block devs. Propagating ENOSPC is useful here, as a sparse backing file might run into this when extending, and the downstream app would be able to see something other than EIO. I'm ambivalent on whether or not to allow all errnos through, or just a peephole like ENOSPC here. However, there's another errno which is effectively the same cause as ENOSPC but triggered by a logical rather than physical limit: EDQUOT. If we're looking at a peephole for ENOSPC to be let through, I'd suggest also allowing EDQUOT through. To your concerns about confusing applications with too many possible errnos, EDQUOT could be translated to ENOSPC before being let through to the block dev layer. (The net effect is the same in any case, as the backing store has denied a write due to some kind of space limit.) -- -- Todd Vierling