From patchwork Mon Oct 17 18:58:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 77812 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp532078qge; Mon, 17 Oct 2016 11:59:23 -0700 (PDT) X-Received: by 10.66.228.131 with SMTP id si3mr28741032pac.125.1476730763273; Mon, 17 Oct 2016 11:59:23 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id p123si28591044pga.86.2016.10.17.11.59.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2016 11:59:23 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-73912-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-73912-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-73912-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=FDpsMvdj7W5lrp6X A4PiF3XYJ6CvAnuXPwqOKGgDbwToDkyR5eOPD1fXLq7nKcLuOEgtUgUQGloYaGYc DD21QFCpOm2k2uN6FM2DQURCqFmM2GUceyM1wYMPSJadCoO8+J+ybR4VDpyO2yO4 GdJ/Hh35gCE3ZV/YE0jJfyNZMhM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=wocsSZ3C0KEXIiLTfMIqYE +01qo=; b=IgDdlRoltBQDvFa1f9g+BKudrFqAvSP6aWpvN1F3n9g7t/UhRyjPqR gOF2UK3oGg+IFjSu3AsStze1jl022Lt3n+MOpDBnAN/URkVkJvKgocSlU0cvsLyC hCK/Lt3ATk5Q2LA2I8mX/T7q55hoIGwhAkLc0Olgbj/JjcLkpQWow= Received: (qmail 5351 invoked by alias); 17 Oct 2016 18:59:12 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 5319 invoked by uid 89); 17 Oct 2016 18:59:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=5813, 58, 13 X-HELO: mail-vk0-f52.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Qq/dpkX+DM1j397JTE2OPCz5+0BVdGbeWHUhAuK+KbE=; b=F6O0uCrNF4jIDlxMOhCBh3t5qDWFKMdFVpp4dmexyHg7W8A03DzqDF/91QZW9frHKA vF8evdmtn2QU6woVWfUsQ1X98iHSOT/k82gfFar7bfe755jGlq1o3hPYi+sVqnqiURlu zVa3RsF+jxPu7Cq564qIskrwufZIlITex2X58fP60QtA4kgkqtgkajCKWmKRuqb4RG7D gWhHqMgKLmz0pnVNn1T/vjt8HRWmvlcGMQUUrNzR2kv+STasrnnYMkaMga/kBZTvrNBP B+q1mFfTNO/2cpIp7kGG1j7lwe1xh7jEbC4+c9Ptlyimx8UC1FDkF2VIEkhgb0i7UDIR Cpyw== X-Gm-Message-State: AA6/9RmDiG9Ht2IsuBBbwEwbH61vX2d08VSpqB2en43hHSXj5ohRlguma/5Lj6urEFQP/buv X-Received: by 10.31.114.71 with SMTP id n68mr20106318vkc.129.1476730739092; Mon, 17 Oct 2016 11:58:59 -0700 (PDT) Subject: Re: [PATCH v2 1/3] Consolidate fallocate{64} implementations To: Christoph Hellwig , Andreas Schwab References: <1475021701-22246-1-git-send-email-adhemerval.zanella@linaro.com> <20161017155715.GA20086@lst.de> Cc: Siddhesh Poyarekar , libc-alpha@sourceware.org From: Adhemerval Zanella Message-ID: <830f1b4e-b6a4-060c-acca-ad7b97b34964@linaro.org> Date: Mon, 17 Oct 2016 16:58:53 -0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161017155715.GA20086@lst.de> On 17/10/2016 13:57, Christoph Hellwig wrote: > On Mon, Oct 17, 2016 at 05:52:12PM +0200, Andreas Schwab wrote: >> The error is EOPNOTSUPP, virtio-blk apparently does not support >> fallocate (neither does nfs). > > virtio-blk is a block driver, it's the file system that needs to > support it. NFS 4.2 actually does support a subset of the fallocate > functionality, but the spec isn't finished yet and thus usually > not turned on by default. > > That being said: EOPNOTSUPP is a common return value for fallocate > and should be expected at any time. > Right, I did not take in consideration that fallocate might fall due this constraint. The correct approach would be just set as unsupported if fallocate returns -1/EOPNOTSUPP. I will push this patch: diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 101e120..e329a6b 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -43,7 +43,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \ bits/mman-linux.h tests += tst-clone tst-clone2 tst-fanotify tst-personality tst-quota \ - tst-fallocate tst-fallocate64 tst-sync_file_range + tst-sync_file_range # Generate the list of SYS_* macros for the system calls (__NR_* macros). @@ -173,6 +173,8 @@ ifeq ($(subdir),io) sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \ sync_file_range fallocate fallocate64 sysdep_headers += bits/fcntl-linux.h + +tests += tst-fallocate tst-fallocate64 endif ifeq ($(subdir),elf) diff --git a/sysdeps/unix/sysv/linux/tst-fallocate-common.c b/sysdeps/unix/sysv/linux/tst-fallocate-common.c index 9879488..d98bf4a 100644 --- a/sysdeps/unix/sysv/linux/tst-fallocate-common.c +++ b/sysdeps/unix/sysv/linux/tst-fallocate-common.c @@ -58,7 +58,13 @@ do_test_with_offset (off_t offset) and check if both buffer have the same contents. */ ret = fallocate (temp_fd, 0, offset, BLK_SIZE); if (ret == -1) - FAIL_EXIT1 ("fallocate failed"); + { + /* fallocate might not be fully supported by underlying filesystem (for + instance some NFS versions). */ + if (errno == EOPNOTSUPP) + FAIL_EXIT (77, "fallocate not supported"); + FAIL_EXIT1 ("fallocate failed"); + } ret = fstat (temp_fd, &finfo); if (ret == -1)