From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752957AbZENSsd (ORCPT ); Thu, 14 May 2009 14:48:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751880AbZENSsW (ORCPT ); Thu, 14 May 2009 14:48:22 -0400 Received: from fg-out-1718.google.com ([72.14.220.159]:22092 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750906AbZENSsV (ORCPT ); Thu, 14 May 2009 14:48:21 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:message-id:from:to:cc:subject:in-reply-to:references :user-agent:mime-version:content-type; b=Sc8TbmH02DCZ99VEs3VjqgcfPjrnN6UEucmjB3F46oINz3ktE6LrK+32F/e9IEo4I5 PL1wfvE72Zm7S2s834BvRH4TktgoCGP+kww5L9PHpKg91MT0n8GHWQKtbZrbIm7YxT8e 8BQ/+8fXVntmdPY3mk5ItZoHslLrZNpR7eqfM= Date: Thu, 14 May 2009 20:48:18 +0200 Message-ID: <87eiurzfkd.wl%vmayatsk@redhat.com> From: Vitaly Mayatskikh To: Josef Bacik Cc: Vitaly Mayatskikh , sandeen@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/2] sys_write() should write all valid data In-Reply-To: <20090514180234.GB10059@dhcp231-156.rdu.redhat.com> References: <1242317939-15392-1-git-send-email-v.mayatskih@gmail.com> <20090514180234.GB10059@dhcp231-156.rdu.redhat.com> User-Agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/22.3 Mule/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Thu, 14 May 2009 14:02:34 -0400, Josef Bacik wrote: > Ok all in all I don't think this is a good way to handle this problem. > Hopefully somebody smarter than I will speak up, but what you are trying to do > here is have your cake and eat it too. You want to get the size of what we were > able to fault in and return that, which should be a size_t, btw, fault_in_pages_readable() has argument `size' of type int... > but you also want to > throw back an error if something happened, which needs a signed value. I think > the best way to handle this would be to make check_readable_bytes return size_t, > and then if you get an EFAULT back, have it return 0. Then the caller can say > "hey I couldn't fault anything in, let me make what I want to fault in smaller", > and then if that fault returns 0 we can exit. Won't it be suboptimal to trap in the same place twice? > I hope thats helpful/correct :). -- wbr, Vitaly