Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750954AbeAPIKm (ORCPT + 1 other); Tue, 16 Jan 2018 03:10:42 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:34094 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750716AbeAPIKk (ORCPT ); Tue, 16 Jan 2018 03:10:40 -0500 X-Google-Smtp-Source: ACJfBouTjPil1rwZDqQhOHCFfVAdZ82HiYmLiuBaUsIomKbr1fq5QyyFbxraQzlH/Qz10xGJVZBXSA== Date: Tue, 16 Jan 2018 16:10:33 +0800 From: Sean Fu To: Theodore Ts'o , Al Viro , adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ext4: Remove repeated test in ext4_file_read_iter. Message-ID: <20180116081033.GA3436@linux-zmni.apac.novell.com> Mail-Followup-To: Theodore Ts'o , Al Viro , adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org References: <1514362798-5850-1-git-send-email-fxinrong@gmail.com> <20180103020805.GB21978@ZenIV.linux.org.uk> <20180110140149.GA5174@linux-zmni.DHCP> <20180110200255.GA6499@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180110200255.GA6499@thunk.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Wed, Jan 10, 2018 at 03:02:55PM -0500, Theodore Ts'o wrote: > On Wed, Jan 10, 2018 at 10:01:49PM +0800, Sean Fu wrote: > > > > Correct, IOCB_NOWAIT read with zero count can return -EAGAIN, But I > > think that it is reasonable. while it got lock, zero would be returned > > in this case. > > Returning -EAGAIN and 0 are not the same thing. Specifically > returning 0 means "end of file". Hence, it is NOT reasonable. > I know that two returnning value mean different things. once the inode is not under lock contention, read again with zero count would return zero. > See the man page for read(2) or the relevant Single Unix Specification > standard: > > RETURN VALUE > On success, the number of bytes read is returned (zero indicates > end of file).... > > Changing the behavior of the system in which will break userspace is > never acceptable, and even more so given that this is just a "cleanup > patch". > I agree with you at this point. Thanks for your reply. > - Ted >