From patchwork Fri Apr 7 09:15:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9669155 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 028E6602B3 for ; Fri, 7 Apr 2017 09:15:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3FD028497 for ; Fri, 7 Apr 2017 09:15:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D746328607; Fri, 7 Apr 2017 09:15:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8729328497 for ; Fri, 7 Apr 2017 09:15:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756033AbdDGJPh (ORCPT ); Fri, 7 Apr 2017 05:15:37 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:36246 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755304AbdDGJPf (ORCPT ); Fri, 7 Apr 2017 05:15:35 -0400 Received: by mail-wr0-f196.google.com with SMTP id o21so13089428wrb.3; Fri, 07 Apr 2017 02:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=F/UEEdr4dQ58RIW3lq4weYjSZZuYjhz7TqmoJsTB1mU=; b=UpWoPeCsQ3eVkGYSzg1NMMLADzbbOazurHFA5YbeuqFnQpvHT9VauULUHIm3Tv32uX BKkmYyB5bhv+YsGblkT60fXiwp1EvfHq09lMVWdjAWi6SqlD9FZOIMqG4gOx670AZwow a0ImFvKlqYmoAj19PsjoYbAFFAk5imezas5GsVmVKhSaqkhernTqbNn6+vsaFlLt4vmt yz+nEioPc8dZ5JO3UPSqt9qQNsw3lEPLdbFDRq0SZq1xBJdd526u/Wpl17YQaAs2/mTU uyFMBtcJVsIAcANgxTwWqdw0+8zEAet+O0PYdFLvfPzlT4pNPqZYY3k6sfQ6l7vgCTM+ uL0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=F/UEEdr4dQ58RIW3lq4weYjSZZuYjhz7TqmoJsTB1mU=; b=uihG9C32ZN5UlfObvturOrw5Armo9Ix+fWGNwZXhZ1UzPyNxI5FOmMw/IBpciNRLso hyAyQpxFvVtlgAtpVh+FrByYs6yxaE866THpO1jD7GwOZ8c/llsvyKj+O12tKIXZOPIu VmpGUPaFvHoirKpQSTWH52IR1ZeYa2JUlPkpn9gUIE4v1edzNkcFpANHx4OkTUQqvsgw gkD/BQpUsONJOu6Lo1OCrdO4ktDvNeQ9MM5pYBoqchZW1UwfuNdyRBBBp8jXl5mI2GyG kpbgF8SKULLn46iwuSPCf7kgLXLZDOME5i7UxqKcNQ4a09fZSBGA+LEsSULEzYnNbbM/ yxEA== X-Gm-Message-State: AFeK/H3qDM+XgtuSLmj9C+UEBxTfRaVFrDKMy+kqW59ECf85/PbLoxnZCfGGMAMQJFPOCA== X-Received: by 10.223.177.145 with SMTP id q17mr33291291wra.13.1491556534372; Fri, 07 Apr 2017 02:15:34 -0700 (PDT) Received: from amir-VirtualBox.lan (bzq-79-176-107-16.red.bezeqint.net. [79.176.107.16]) by smtp.gmail.com with ESMTPSA id 24sm5260232wrw.46.2017.04.07.02.15.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Apr 2017 02:15:33 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , Xiong Zhou , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v4 4/4] t_immutable: add ftruncate to append only tests Date: Fri, 7 Apr 2017 12:15:39 +0300 Message-Id: <1491556539-17147-1-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491457434-7359-3-git-send-email-amir73il@gmail.com> References: <1491457434-7359-3-git-send-email-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The truncate and ftruncate syscalls check the IS_APPEND() flag in 2 different vfs code paths and I had to fix both in order to fix overlayfs IS_APPEND() violations. Add the ftruncate test to t_immutable, so overlay/030 can verify the fix. Signed-off-by: Amir Goldstein --- src/t_immutable.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) Eryu, Added another patch to the series. It stands by itself regardless of test overlay/030, but together with overlay/030 they provide full coverage of the kernel fixes I posted. Amir. diff --git a/src/t_immutable.c b/src/t_immutable.c index 8a12d2c..7a7195e 100644 --- a/src/t_immutable.c +++ b/src/t_immutable.c @@ -892,6 +892,21 @@ static int test_append(const char *dir) } errno = 0; + if ((fd = open(path, O_RDWR|O_APPEND)) == -1) { + fprintf(stderr, "open(%s, O_RDWR|O_APPEND) failed: %s\n", path, strerror(errno)); + fail++; + } else { + if (ftruncate(fd, 0) != -1) { + fprintf(stderr, "ftruncate(%s, 0) did not fail\n", path); + fail++; + } else if (errno != EPERM) { + fprintf(stderr, "ftruncate(%s, 0) did not set errno == EPERM\n", path); + fail++; + } + close(fd); + } + + errno = 0; if (truncate(path, 0) != -1) { fprintf(stderr, "truncate(%s, 0) did not fail\n", path); fail++;