From patchwork Thu Oct 25 02:22:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yufen Yu X-Patchwork-Id: 10655355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6EFDA109C for ; Thu, 25 Oct 2018 02:21:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AF792B748 for ; Thu, 25 Oct 2018 02:21:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F8D02B74C; Thu, 25 Oct 2018 02:21:04 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8AEF2B748 for ; Thu, 25 Oct 2018 02:21:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0085B6B0010; Wed, 24 Oct 2018 22:21:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id ED1686B0266; Wed, 24 Oct 2018 22:21:02 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9B946B0269; Wed, 24 Oct 2018 22:21:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by kanga.kvack.org (Postfix) with ESMTP id B35A36B0010 for ; Wed, 24 Oct 2018 22:21:02 -0400 (EDT) Received: by mail-io1-f71.google.com with SMTP id k9-v6so5713175iob.16 for ; Wed, 24 Oct 2018 19:21:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:mime-version; bh=9Wjr4q6PdAyj/0aZ+ms1EkcjhYs2t1bNBRCHJgZhL0A=; b=NtZ3b+NUMhGA0Itvr7d8vGs4xwMljj15Wdw2tAE+wIjcp/XPJQqnh7R2JcJnRmtWJ0 9m4R3afvwYmIHZz+butA2M0lkKxZkJf7OACPRbsrpYe4ne3spq7hskSJbCUFms3+IImp TTCM9ckJP7AdRBcru6huZZyunlhPpGAxeAGv+SiZZKHt8xN0flasijXFLjCYh/hHYCYQ 6Kw4ppwlXEcJWxWxNbOkMsmX/6O7V7SE4E54DFgTtBjcBZyhinnEiWqvlhR1vGNg1Adp nTNU6pg1SISpTIZyouF/Bvo5PA/kV3iZKfVTZr1ZP5R4b0CyjodTFHt7qSffkSUbVQsy k0vw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yuyufen@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yuyufen@huawei.com X-Gm-Message-State: AGRZ1gLuxvck/f35h6zGfI1GRx3lX/dg6b1KieI32bYfYqGLFR4Y4jeA iOs1Q9ZlNO3QrGbOF18ojKUcCBX141fv0rOE8n+a7pdAGnZtdO9WgWpjuHGko93zP1PSTO4wVAC LF8RWw/hxAiXy+Rk1F4O87OOAqOoGdsywpqkuMMSuGmLuYSfOspW+xYyiuG9r9oZDLw== X-Received: by 2002:a24:1a09:: with SMTP id 9-v6mr28559iti.75.1540434062528; Wed, 24 Oct 2018 19:21:02 -0700 (PDT) X-Google-Smtp-Source: AJdET5e7ex0Ee+MHQtfaXFfKXyYsNlu8/0ugTNnXHMjiKHn8Ki8MXSYlwIdi7mf3hXArD8lE+5mp X-Received: by 2002:a24:1a09:: with SMTP id 9-v6mr28540iti.75.1540434061651; Wed, 24 Oct 2018 19:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540434061; cv=none; d=google.com; s=arc-20160816; b=slwP419XjKgBDp0DXadt5sB+krV5ci7ZT4Jyy+mCyeUUQ3pLbNlPvcmAlM60lF2QPB GY2fcwtICPedO3UHjvF/sy88AnRW5IU2QdNuJRkfQ/CNIrPZeePjChK2eCrwfbNZkqqK VviX0ObwCe7KOT9SBzHtZic7PW7+ncqbl4Nu4nd78U/pkExLMGRC5q4dw+V3R++mKoYs o4T647jScBwEDS9KTX3IUK6GwuYMiguLxivRuWiVCPcsRN+ko57D0npgjprs8ONVFUDs rfWdFjdVgo7oFknda4d/V7sGKaAeDe4/3ex3tSQVwlbw0BcGKLps75QaJ5NiKFXg5x1t kleQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:subject:cc:to:from; bh=9Wjr4q6PdAyj/0aZ+ms1EkcjhYs2t1bNBRCHJgZhL0A=; b=JJR14gwkpuiotai5wBn0LekuUOnqwDG8zihx/nUI8+yVMLeO6Zweczth0WrSCGlkpm m3UXkPLFz/NcDMDB/FWxYU3gS4cuZ+AT+XdF0qCAegOg/tuLFcl9VMUhDNk8VlEV38/I kRFLnCd36x4KEWlxk4A4Q+xeTzh0YrysFdB8w+wGJr7/Wtc+JfkSsoUTw0EAcOTIzUPU 8zMDtGEWXlVCyAllBzRTfXfcwOjuy944i0eZKhP7uyh6fkiPmMoFYO+TGv51CegSKaZ9 Kt09DWU5JDLEQyC3imiYNKT2+R2Ku+FsNwiAv+iS8wFG/KCU1SQ+DBAuFT9c9JbBT20y JiwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yuyufen@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yuyufen@huawei.com Received: from huawei.com (szxga04-in.huawei.com. [45.249.212.190]) by mx.google.com with ESMTPS id i21-v6si4397516ioa.94.2018.10.24.19.21.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 19:21:01 -0700 (PDT) Received-SPF: pass (google.com: domain of yuyufen@huawei.com designates 45.249.212.190 as permitted sender) client-ip=45.249.212.190; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yuyufen@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=yuyufen@huawei.com Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 55FAEE3710017; Thu, 25 Oct 2018 10:20:26 +0800 (CST) Received: from huawei.com (10.90.53.225) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.408.0; Thu, 25 Oct 2018 10:20:27 +0800 From: Yufen Yu To: , CC: , , Subject: [PATCH] tmpfs: let lseek return ENXIO with a negative offset Date: Thu, 25 Oct 2018 10:22:56 +0800 Message-ID: <1540434176-14349-1-git-send-email-yuyufen@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.90.53.225] X-CFilter-Loop: Reflected X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP For now, the others filesystems, such as ext4, f2fs, ubifs, all of them return ENXIO when lseek with a negative offset. It is better to let tmpfs return ENXIO too. After that, tmpfs can also pass generic/448. Signed-off-by: Yufen Yu --- mm/shmem.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 0376c124..f37bf06 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2608,9 +2608,7 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence) inode_lock(inode); /* We're holding i_mutex so we can access i_size directly */ - if (offset < 0) - offset = -EINVAL; - else if (offset >= inode->i_size) + if (offset < 0 || offset >= inode->i_size) offset = -ENXIO; else { start = offset >> PAGE_SHIFT;