Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1151590pxy; Fri, 23 Apr 2021 01:11:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHtGFKHJDp87NIh2dHkgMMuI6KSMJj/W5R+pATXd7qYcG7oPJn8+oOxGdTthry+WCPypg0 X-Received: by 2002:a65:5c88:: with SMTP id a8mr2586417pgt.130.1619165477411; Fri, 23 Apr 2021 01:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619165477; cv=none; d=google.com; s=arc-20160816; b=W0B2S1Z3LlXwWsZfLnL+0xGo0Z40q2gjSRJCdaJBrC53TZ3rPS6oLa5j0xce7VAfDv P4mVdK3lXuVAYgg9BhTZCjWLp4iB9ufuCwceJKPYAWV2cZaWa3M89t2kYlA11/kJj6FC ip6zPaTEdySoVq1/+ICBAuUyZD6CxWFfjUJYvv0Q1t7yIaPk8Exf1ypsz4xECWin9asR iAlZFi5ebG2ay1Moo6LTa9t+3g1VXXhPw7cyOAON9N6ZzsVT98Vuml8g6mS/ekCfXNWd EeT3N0b1aDX3ZaMQutm+NIaw3/w0XunDgqoJg6RCrR32tzmr00UudiAE4WIRilSjv8qd sEZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=9ehiXslja300i2vGj1/93A1eFwKfaTwfsPk1xeLX9g0=; b=GN9tNKnkHqumRopINz8e8vPkFsFxAkrH4/e6CaE1Lgz7BpJPns00CTjQiU1knbrdTM Hi8Xm6WbJTLlsO5hU404cXlyCPvHiNupq5llBGm+iRg07jldFwJFNYtgSLMBh7TGuuvb Argt268xFhftI8H4bR/u3+iu7ZLHFWd4i7Qv2xetO8q7I7II4PXXIgYNU76aQ8/L8R6F kz8mM1PeHGqHti5Dwi830x9TpaU6FCwW1sI+VDGeIR9EOU41KoMaZ0lHkR5hwkZvujbA 2h7tPoXdith1ifruEGA65fwi4gUC81zrxVYfY+7JBe8/NLeHPm4KHqcUdXgf6BHQjyGF bG9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mTvEpz2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y15si5811263pll.304.2021.04.23.01.11.04; Fri, 23 Apr 2021 01:11:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mTvEpz2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241348AbhDWILH (ORCPT + 99 others); Fri, 23 Apr 2021 04:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241336AbhDWILG (ORCPT ); Fri, 23 Apr 2021 04:11:06 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50AC3C061574; Fri, 23 Apr 2021 01:10:29 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id r12so72642315ejr.5; Fri, 23 Apr 2021 01:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=9ehiXslja300i2vGj1/93A1eFwKfaTwfsPk1xeLX9g0=; b=mTvEpz2zpeZnMPAsi5WCXFZWP6lDmuYfIHb8spsDH+ZFdAw5955Jn4QCxuCahCwVhu 2HfEZB6dg1r5ZFiYL9cFtr+Eg+uOdzzf10gwJshgk6Dk0/jn8oqeZ6Rqc3JHhUSCByZT eIqiD3BzxpNBtswgL1dPuvnJhlbvdIXqHw2F0hoP9T1nVa+685UqEsz5JoW4QpU4UulT bVnm/9Y+I6Z+7t0sDQ1YFdF9SQP7EVB/JVHanABcn7GMxf/teGdINxjrY+Gj0JyrTAOr 1hauBrNq0ZirSeDDRTC+zCEK9hVLSWBSnmJ5d8NW+h2uj+kh7RoQqlzS0Xmt4zYOOKhW 3X5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=9ehiXslja300i2vGj1/93A1eFwKfaTwfsPk1xeLX9g0=; b=HYLHj8Lo7Ju3DOpcmkfFR4SwdZkQG6C+KfLfu7hHVExQFdulT0rl9PN9jVtkPIBjsV +ajA5iPowPHfX/BXN8fPypcUUwYftw4fiZsXaou8swbygzFkm64jFufq5u/65TCX6YWC n5ZixKHHO4vRs9GKUtTI68E1HKK56oAQYTKHEjdIAV+lu6I82xqQo8DBkd7Wmb+cDECD oap0Psx9XBy/97gMDhMNzMbUanimCuYR5ysbfFUbF+QqUHYBk0L5SsixpoxsbpfZsI21 +MGddxlA+Sjh6rqUCBiDrxIvP0hnq1TjjFapH7uDL/Q3+68oZn9YARMFXOtQi2ojGUGD 1BOg== X-Gm-Message-State: AOAM533Y/Lu8/ANUmv3Vlut7xOErhF/ZAjVFBl2IOeISc+T/8uspZNaV HNkPxUBYWOLG59f1ETi1WpM= X-Received: by 2002:a17:906:cc46:: with SMTP id mm6mr3007567ejb.138.1619165428070; Fri, 23 Apr 2021 01:10:28 -0700 (PDT) Received: from ?IPv6:2a02:908:1252:fb60:509f:9ae8:ad1c:20a4? ([2a02:908:1252:fb60:509f:9ae8:ad1c:20a4]) by smtp.gmail.com with ESMTPSA id t14sm3461827ejj.77.2021.04.23.01.10.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Apr 2021 01:10:27 -0700 (PDT) Subject: Re: [PATCH 1/2] coda: fix reference counting in coda_file_mmap error path To: Jan Harkes Cc: linux-kernel@vger.kernel.org, linux-unionfs@vger.kernel.org, dri-devel@lists.freedesktop.org, coda@cs.cmu.edu, miklos@szeredi.hu, akpm@linux-foundation.org, jgg@ziepe.ca References: <20210421132012.82354-1-christian.koenig@amd.com> <91292A4A-5F97-4FF8-ABAD-42392A0756B5@cs.cmu.edu> <20210422135103.hif4a5znhzt4pc6f@cs.cmu.edu> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <1dce6311-c708-19a8-a9cb-489602d6e930@gmail.com> Date: Fri, 23 Apr 2021 10:10:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210422135103.hif4a5znhzt4pc6f@cs.cmu.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 22.04.21 um 15:51 schrieb Jan Harkes: > On Thu, Apr 22, 2021 at 02:39:41PM +0200, Christian König wrote: >> Am 22.04.21 um 14:27 schrieb Jan Harkes: >>> Looks good to me. >>> >>> I'm also maintaining an out of tree coda module build that people sometimes use, which has workarounds for differences between the various kernel versions. >>> >>> Do you have a reference to the corresponding mmap_region change? If it is merged already I'll probably be able to find it. Is this mmap_region change expected to be backported to any lts kernels? >> That is the following upstream commit in Linus tree: >> >> commit 1527f926fd04490f648c42f42b45218a04754f87 >> Author: Christian König >> Date:   Fri Oct 9 15:08:55 2020 +0200 >> >>     mm: mmap: fix fput in error path v2 >> >> But I don't think we should backport that. >> >> And sorry for the noise. We had so many places which expected different >> behavior that I didn't noticed that two occasions in the fs code actually >> rely on the current behavior. >> >> For your out of tree module you could make the code version independent by >> setting the vma back to the original file in case of an error. That should >> work with both behaviors in mmap_region. > Awesome, I'll give that a try, it may very well be a cleaner solution > either way. > > And thank you for following up after your original patch and finding > the filesystems that mess around with those mappings. I'm sure it would > have taken me a while to figure out why file refcounts would go weird > for some people, especially because this only happens in the error path. Kudos goes to Miklos for figured out why the refcount for overlayfs was suddenly wrong. And please also see the follow up commit: commit 295992fb815e791d14b18ef7cdbbaf1a76211a31 (able/vma_file) Author: Christian König Date:   Mon Sep 14 15:09:33 2020 +0200     mm: introduce vma_set_file function v5 It adds a new vma_set_file() function which implements the necessary refcount dance for changing the vma file in a clean manner. Thanks, Christian. > > Jan >