Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2407617ioo; Sat, 28 May 2022 12:39:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCLMx8WQzcQYlemO7tq8cWfPGWMluLwhwqVVNDHTXSPRnZkwZYnZ1HrBcTOeyby8COVggJ X-Received: by 2002:a05:6a00:2188:b0:50d:b093:12a2 with SMTP id h8-20020a056a00218800b0050db09312a2mr49732842pfi.84.1653766751701; Sat, 28 May 2022 12:39:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653766751; cv=none; d=google.com; s=arc-20160816; b=Ci/9hCfvugpyFh8xtgJG8l6xLQdPgqe4Pv6AwKNTF/bteCCvZ6CDgPjoc7xMG42/72 hMP74geGQNX/OD808vgcQRgBEPzrx/i/sxrQhOVMUewce/VcQn6tEMwUzKgDp9gPMjxD Q5NrSkDBJjaio8W2Ebo7MMtQ4gDCCPXpw3eKm2eToCXQTAwNwcIw6rlGw5ThoQRpXlnp kSUCatH9Hus5GN2BXHl2FnV3giTTkEWFB/9/6uuJYETq09XJGLIx5THuDRUm+jJSdDu8 ol23TqqidgvMBQeCsymUa0ir1VVLZSew8wS2+LUwLzfZEyoVvSascFS4qPnBz9eHfqW0 A2iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-filter; bh=mb7ZmAlHuvpGG1PgGVfmZd0atD/az5Ujm7IAFCqlmoA=; b=ayQbVgvu9VVQIbNn6CCVgDoBQm/9IJ/QTRnTkT1c9w5ktlnwUP8ZPsMtclUruWVHQl DhKeqpk9u7oXbNTtf5ptq4j6+1kJNQaUmzMN1bEaCAcr0opoTZ4TuouBmuZEo6Op2hWr a/GLj3BxcPh+lFub6g2dXW/chGLgSvXfgTvYJooAHrUS/XSPBe7p607+E8NI3U2m9Tsa LONPf6CNaFUrWc9YcXFTFihsMQ+J7/hUeMJ6mpOk0kAB3h5zlgGKxT1GMjNacGM37FRW vFeGqiv7IqIzUK54nFLx1N3pNr8/dbFpv5oIUyXbF+yAFN3cESmxjKUIsibxvqjegggK pKBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=jY8QzXrX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a6-20020a17090ad80600b001bd14e01f27si6531660pjv.21.2022.05.28.12.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:39:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=jY8QzXrX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A9A685DD33; Sat, 28 May 2022 12:03:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239767AbiE0ADU (ORCPT + 99 others); Thu, 26 May 2022 20:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230461AbiE0ADS (ORCPT ); Thu, 26 May 2022 20:03:18 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C60EDA7E06 for ; Thu, 26 May 2022 17:03:17 -0700 (PDT) Received: from sequoia (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id 058F620B71D5; Thu, 26 May 2022 17:03:16 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 058F620B71D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1653609797; bh=mb7ZmAlHuvpGG1PgGVfmZd0atD/az5Ujm7IAFCqlmoA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jY8QzXrXgGOW0gAgEvQQvb1opiIRTxJeqZtvZeFEy9cpJKs0JXN7Gv9/dbw12aSg7 zba1klecrk8VGRGEvghsuOwuw6e1rZ4SiG481RRrnYs69kpq2KtoL81x47gVH7UDe/ p8xUfk3Tp6J1/gT3Lq9g0xR+bW/Wecu/qWOWjbaQ= Date: Thu, 26 May 2022 19:03:12 -0500 From: Tyler Hicks To: Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet Cc: Christian Schoenebeck , Jianyong Wu , v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH] 9p: Fix refcounting during full path walks for fid lookups Message-ID: <20220527000312.GB15462@sequoia> References: <20220525182530.266068-1-tyhicks@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220525182530.266068-1-tyhicks@linux.microsoft.com> X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-05-25 13:25:30, Tyler Hicks wrote: > Decrement the refcount of the parent dentry's fid after walking > each path component during a full path walk for a lookup. Failure to do > so can lead to fids that are not clunked until the filesystem is > unmounted, as indicated by this warning: > > 9pnet: found fid 3 not clunked > > The improper refcounting after walking resulted in open(2) returning > -EIO on any directories underneath the mount point when using the virtio > transport. When using the fd transport, there's no apparent issue until > the filesytem is unmounted and the warning above is emitted to the logs. > > In some cases, the user may not yet be attached to the filesystem and a > new root fid, associated with the user, is created and attached to the > root dentry before the full path walk is performed. Increment the new > root fid's refcount to two in that situation so that it can be safely > decremented to one after it is used for the walk operation. The new fid > will still be attached to the root dentry when > v9fs_fid_lookup_with_uid() returns so a final refcount of one is > correct/expected. > > Include a small readability improvement by using a new variable when > dealing with the root fid as it requires special handling not necessary > with non-root fids. > > Fixes: 6636b6dcc3db ("9p: add refcount to p9_fid struct") > Cc: stable@vger.kernel.org > Signed-off-by: Tyler Hicks This patch was doing a little too much code cleanup when it should have just been fixing the bug. v2 has a patch just focused on fixing the bug followed by additional patches for code cleanup: https://lore.kernel.org/lkml/20220527000003.355812-1-tyhicks@linux.microsoft.com/ Sorry for the churn but v1 wasn't sitting well with me. Tyler