From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Liu Subject: Re: [PATCH] vfs: Return EINVAL for default SEEK_HOLE, SEEK_DATA implementation Date: Mon, 06 Jan 2014 17:32:41 +0800 Message-ID: <52CA7839.7070200@oracle.com> References: <1388745326-13226-1-git-send-email-jack@suse.cz> <19710447-69E6-47A2-A679-68552967A750@dilger.ca> <52C8A8FC.4080201@fb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Al Viro , "Theodore Ts'o" , "linux-fsdevel@vger.kernel.org" To: Josef Bacik , Andreas Dilger , Jan Kara Return-path: Received: from userp1040.oracle.com ([156.151.31.81]:18136 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754410AbaAFJdE (ORCPT ); Mon, 6 Jan 2014 04:33:04 -0500 In-Reply-To: <52C8A8FC.4080201@fb.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 01/05 2014 08:36 AM, Josef Bacik wrote: > > On 01/03/2014 05:17 PM, Andreas Dilger wrote: >> Shouldn't this be -EOPNOTSUPP, since -EINVAL is for incorrect >> arguments, which isn't the case here. >> > I think we want to be consistent with previous kernels which would > return -EINVAL if whence wasn't set properly, hopefully breaking as few > userspace stuff as possible. Thanks, It seems like that this fix would have a bit influence to man page of lseek(2) as it suppose to: EINVAL whence is not valid. Or: the resulting file offset would be negative, or beyond the end of a seekable device. Where probably need an update to reflect this change regardless of whether return -EINVAL or -EOPNOTSUPP IMHO. Moreover, Solaris/FreeBSD use {f}pathconf(2) syscalls to detect if a file system is support SEEK_HOLE function or not, maybe Glibc/GNULib folks would like to couple lseek(..., SEEK_HOLE) to {f}pathconf(3) in the future, which could make the userspace stuff a bit more flexible across different OS. So, I gone through their man pages and in this case, seems both of them will return -EINVAL if call to {f}pathconf(2) with _PC_MIN_HOLE_SIZE is failed: Solaris: http://docs.oracle.com/cd/E23824_01/html/821-1463/pathconf-2.html FreeBSD: http://www.freebsd.org/cgi/man.cgi?query=pathconf&sektion=2 Thanks, -Jeff