On Sat, Nov 13, 2021 at 12:16 PM Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> 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