Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751851AbeAJUDB (ORCPT + 1 other); Wed, 10 Jan 2018 15:03:01 -0500 Received: from imap.thunk.org ([74.207.234.97]:33222 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751002AbeAJUDA (ORCPT ); Wed, 10 Jan 2018 15:03:00 -0500 Date: Wed, 10 Jan 2018 15:02:55 -0500 From: Theodore Ts'o To: Sean Fu Cc: 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: <20180110200255.GA6499@thunk.org> Mail-Followup-To: Theodore Ts'o , Sean Fu , 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180110140149.GA5174@linux-zmni.DHCP> User-Agent: Mutt/1.9.2 (2017-12-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false 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 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. 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". - Ted