From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F182C433EF for ; Sat, 13 Nov 2021 20:23:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9C08E61177 for ; Sat, 13 Nov 2021 20:23:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9C08E61177 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E65A36B0081; Sat, 13 Nov 2021 15:23:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E15B06B0082; Sat, 13 Nov 2021 15:23:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8E996B0083; Sat, 13 Nov 2021 15:23:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id B670B6B0081 for ; Sat, 13 Nov 2021 15:23:49 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7812918021460 for ; Sat, 13 Nov 2021 20:23:49 +0000 (UTC) X-FDA: 78805032978.20.50EEF6D Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by imf27.hostedemail.com (Postfix) with ESMTP id 1B68970000A4 for ; Sat, 13 Nov 2021 20:23:48 +0000 (UTC) Received: by mail-ed1-f51.google.com with SMTP id w1so52755678edd.10 for ; Sat, 13 Nov 2021 12:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=178hx9F5MIkKas8jxF7m2J6CCeDHC5D9gwDjuYnUjsU=; b=Dg6Nx3R+R0mIAvyO7OOrykmw6ojUJn1COLGmLMGOqfzuxo7DEHwN+Z+leZ0NszG0nc o+lyomDhJPq4T54+0Qzg3Yt1XLCru+KlaARRjB0kC5SKc/ISrLy23TOipzmc3sXIskl+ 5vNIODFl76GCD3exQLRf3DEXpiy7qa0vu7d7A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=178hx9F5MIkKas8jxF7m2J6CCeDHC5D9gwDjuYnUjsU=; b=ic48uqk4ZNec5AedtHnFEbt53aNgYU9ZCxePHxqF4IT0j/olJ5DpQ8KUCEitCK6rrk WlQFNthujsGaR19/BgYDJgkM/vSxrend0d/yg7hxTUnrehE8ETZPnthwpiqwpym2UQ1U sSCLitd5bHFV3w1it7nJlXbS69E0uf/NU9A91YK3nAYt7FpN1HaPoAPgynLrt+YdRHyZ ZSCJAd6Xxlcy+dg2zsBD8TaIKiHmGOsISc9L1nmy4RjdgXkxhQnYvNPoZeDQQBLcZ8et V2Q9rMTqolymzaQm05tNymSEoR1YuXZ6vtFjgeA4PWyO3mBX6sYFElHt2dmXC/ovtE4G wHRg== X-Gm-Message-State: AOAM5320Swyekl3UUJRtRypqNcFFv6eQTKxxA3bD64F6p6trhWyy02IY Qff77aW6Yvewi7HfdyQF0Y11CsksK7P1YMX8U7A= X-Google-Smtp-Source: ABdhPJwjb+MpvItI/gYk5yaKwqWb6BQRkIetWFNQIgfliMX1Wt/KdOwp+lv0zR3koQN96PW/LookCw== X-Received: by 2002:a17:907:86a6:: with SMTP id qa38mr31372742ejc.286.1636835027733; Sat, 13 Nov 2021 12:23:47 -0800 (PST) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com. [209.85.128.51]) by smtp.gmail.com with ESMTPSA id d1sm4084589edn.56.2021.11.13.12.23.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 Nov 2021 12:23:47 -0800 (PST) Received: by mail-wm1-f51.google.com with SMTP id i12so9692060wmq.4 for ; Sat, 13 Nov 2021 12:23:47 -0800 (PST) X-Received: by 2002:a05:600c:4e07:: with SMTP id b7mr42940110wmq.8.1636835026807; Sat, 13 Nov 2021 12:23:46 -0800 (PST) MIME-Version: 1.0 References: <20211111084617.6746-1-ajaygargnsit@gmail.com> <628a49dc-f6f7-5aa4-8a4d-4f2ed19b7f3f@kernel.dk> In-Reply-To: From: Linus Torvalds Date: Sat, 13 Nov 2021 12:23:30 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm: shmem: do not call PageHWPoison on a ERR-page To: Jens Axboe , Arnd Bergmann , Yang Shi Cc: Ajay Garg , Hugh Dickins , Andrew Morton , Linux-MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1B68970000A4 X-Stat-Signature: ne8hks4t7h5k78tt48ok8s93cuh7rr86 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=Dg6Nx3R+; dmarc=none; spf=pass (imf27.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.208.51 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org X-HE-Tag: 1636835028-654167 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: On Sat, Nov 13, 2021 at 12:16 PM Linus Torvalds wrote: > > Neither of the fixes were sent to me, and honestly, I think the real > issue is that the original commit is just too broken for words. Side note: the one you pointed to (by Ajay), had the comment that it could be done differently as an optimization. And I very much agree with that, although I think it would be a lot more than an optimization: just doing if (error) return ERR_PTR(error); earlier in the function would have avoided the issue entirely, and would have made the code a lot easier to read too. But what made me decide to just revert it entirely was that the original commit that caused this all also had stuff like this: - return shmem_getpage(inode, index, pagep, SGP_WRITE); + ret = shmem_getpage(inode, index, pagep, SGP_WRITE); + + if (*pagep && PageHWPoison(*pagep)) { + unlock_page(*pagep); + put_page(*pagep); + ret = -EIO; + } + + return ret; which is another example of exactly the same issue: ignoring errors, and then acting on other information and creating new errors. Again, that code should have checked and handled errors first, and then - if there wasn't an error - added that new HWpoison handling. So that just made me go "this is not worth fixing up, this just needs re-doing", and thus I just went for the revert instead. Linus