linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Liu <jeff.liu@oracle.com>
To: Josef Bacik <jbacik@fb.com>, Andreas Dilger <adilger@dilger.ca>,
	Jan Kara <jack@suse.cz>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH] vfs: Return EINVAL for default SEEK_HOLE, SEEK_DATA implementation
Date: Mon, 06 Jan 2014 17:32:41 +0800	[thread overview]
Message-ID: <52CA7839.7070200@oracle.com> (raw)
In-Reply-To: <52C8A8FC.4080201@fb.com>

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

  reply	other threads:[~2014-01-06  9:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-03 10:35 [PATCH] vfs: Return EINVAL for default SEEK_HOLE, SEEK_DATA implementation Jan Kara
2014-01-03 22:17 ` Andreas Dilger
2014-01-05  0:36   ` Josef Bacik
2014-01-06  9:32     ` Jeff Liu [this message]
2014-01-06 10:11     ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52CA7839.7070200@oracle.com \
    --to=jeff.liu@oracle.com \
    --cc=adilger@dilger.ca \
    --cc=jack@suse.cz \
    --cc=jbacik@fb.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).