From patchwork Wed Feb 28 16:02:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 13575731 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6B8315D5CD for ; Wed, 28 Feb 2024 16:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709136142; cv=none; b=Mv8wlfWtxhZpDJUTTAorcSOjZTwsncf+rlkR7QJ9jCe+/gdwnFKTm94bEtl+HIt4CC2csADbTLyVgdqkA06DyXpsDqL0vB5WUD4tvEieqm8BqI44FXMpyDz/i1zELUCKLCa2jEp3hqz4X94XxO7Yr9u+eMsKsI3DQ5eTymYvnDQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709136142; c=relaxed/simple; bh=8cqkb/NZkYtK8b/nuAyQZ4SuAHiDijCUwWScznwSvJM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FSk7IucJZh1u3d3lXP37pTQP//5zCyhT5FSOguMqCMBV8AX/7wTBzfzeQ/HrYjtJbFNWZ7fleoIXN6oLmiHddGxkeZxNAcJEYmvugkXmZuSrLuA2SuQS91x0tfypW7r8IAuTJW8LwjWBupNqgXq7ZfdmB2ZzjDVjYtBoG1CWCPQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=FlnBK/Gw; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FlnBK/Gw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709136139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=WP42bm8xvL/lRAIfAu8ESZY/T+/pzLIZT0SH+0ebrAY=; b=FlnBK/GwAWw2QBjpP/o1u1QsInXIVlqAZi/+f2itZ5x2tbf8BOuJS/yyYtCov6UEmdp8k4 hbfA/3XK17oCnsjydHdNLs98NCB8w/HKGWYsHvUP4w7eYybLOYSjhyyuI+6GZpt6hmZ6A4 9qBJ9YpJ5evC7XfRdpflQzb1i9wsSsI= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-13-4mqM8EeyM9SRCdb6WcdpHg-1; Wed, 28 Feb 2024 11:02:18 -0500 X-MC-Unique: 4mqM8EeyM9SRCdb6WcdpHg-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-565870befefso2910073a12.0 for ; Wed, 28 Feb 2024 08:02:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709136135; x=1709740935; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WP42bm8xvL/lRAIfAu8ESZY/T+/pzLIZT0SH+0ebrAY=; b=cLxhAmPPrdXBuIxcy1mjnMoCiwOcQty0Pf7ng2ZAH3xSM6bMU5fgUZOFj0MIT2xwkA AlsvxbANIiCQdV1YqRal470Xo8zMFfI7ePoH5GTRs4fcrLDGxBbBq54u9gvHsPYoelxK klxNCFzhyNbsLHkLfe5o+uT8y5FPDxbPufNNJjTMrBpZyDNaG9jwf3EqoZWIruKEUHwk aPB2AUtDUTDsEJ9iwe3qqjJ+MlGT727a4019zGKKZ1GlAmAz5zOBQzifC+M55zv2KswA CDSM8n00mt5q2r0ssfB97ddYlzRNaZWmMLeca9SHI9s7Qsk9wTBJXUPCr5+aSg+lzq7Q eiIg== X-Gm-Message-State: AOJu0YzmKTuL114/qq0OT/tDKkWbZzCnGKWrAo5Jx15gECEGY8OVHn4w rMwGjgUS6bud4lOSEiSi/4XkYXVdTgd1g4ujrMEuseXBF/Yo9bCOAQqK0I+KErVJxGGxln1YABb YngbbDvJHPkfm2tSwKu27VkdBhySOrtZcGb6B3tLAy82BVHZZjvnWvMsvoH4QM0qRqMlKWE+fBZ UA2ii698OnUX3Vq2zJRq7vpEl5aOBfMyuNXP1//3ZSM4qAfrs= X-Received: by 2002:aa7:df83:0:b0:564:73e9:a9cd with SMTP id b3-20020aa7df83000000b0056473e9a9cdmr9669408edy.31.1709136135718; Wed, 28 Feb 2024 08:02:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhhOZBBGievRQ2E08GYgV8+5DLLuEJUMrQs4R+hCjv9A2VRh4drqAEe5JKlOv5W337oXfK8Q== X-Received: by 2002:aa7:df83:0:b0:564:73e9:a9cd with SMTP id b3-20020aa7df83000000b0056473e9a9cdmr9669383edy.31.1709136135345; Wed, 28 Feb 2024 08:02:15 -0800 (PST) Received: from maszat.piliscsaba.szeredi.hu (fibhost-66-166-97.fibernet.hu. [85.66.166.97]) by smtp.gmail.com with ESMTPSA id ij13-20020a056402158d00b00565ba75a739sm1867752edb.95.2024.02.28.08.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 08:02:14 -0800 (PST) From: Miklos Szeredi To: Cc: linux-fsdevel@vger.kernel.org, Bernd Schubert , Amir Goldstein , stable@vger.kernel.org Subject: [PATCH 1/4] fuse: replace remaining make_bad_inode() with fuse_make_bad() Date: Wed, 28 Feb 2024 17:02:06 +0100 Message-ID: <20240228160213.1988854-1-mszeredi@redhat.com> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 fuse_do_statx() was added with the wrong helper. Fixes: d3045530bdd2 ("fuse: implement statx") Cc: # v6.6 Signed-off-by: Miklos Szeredi --- fs/fuse/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 25c7c97f774b..ce6a38c56d54 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1214,7 +1214,7 @@ static int fuse_do_statx(struct inode *inode, struct file *file, if (((sx->mask & STATX_SIZE) && !fuse_valid_size(sx->size)) || ((sx->mask & STATX_TYPE) && (!fuse_valid_type(sx->mode) || inode_wrong_type(inode, sx->mode)))) { - make_bad_inode(inode); + fuse_make_bad(inode); return -EIO; } From patchwork Wed Feb 28 16:02:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 13575734 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87B6815D5CC for ; Wed, 28 Feb 2024 16:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709136168; cv=none; b=luBv+BrjQvefCjKe4ZGGTnf70ySfU0fsZ6EAjFj11ty4D3rkPK/Y7NUOMxSLJ27OKRA/mJdkfy+wF8YcbmxHjyTieUeaY3vYojnAVSOA2Nb8iEU8h4GuDs5edatA0gNfmfmZkelMyVNh07CUSQk8qmeq37xyi1eORmiBOzVRXnA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709136168; c=relaxed/simple; bh=gcmDylT5tOFHkuXUNsAiv9r7CLlIpQpP+An4L8BC66A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gQ3Bq95xV69basFmTQHmrmJblRdqBEzcYo+D6kXLlWPdO3Tf04sp1UL9eEY6m3bRoy3k9k8rOL8MmLoDqVxgzL2tbZTrOdQGQuouwnj7JG37gNFX35JXOYcCYTQqbmSTHU1d/kTI8Q+OGYDOFUt6xrdDlIOVHKd9v49kjbmfCOk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iGC8LbGN; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iGC8LbGN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709136164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fkI08nI25MBj/Qiu+niSA2+bh8FbCRap2BNxrenMQ/8=; b=iGC8LbGNFSdHKUVUNzt9pe0WoSRbKp4D7qHVD1D7jNIXwMmo9w6T/No7PKe95jPLImZD2F 0O+ytopFVO7XssA5KxOU4i7zGZ9ylKC15/lKuj4lpPfw7mzJn21BmK86FZbBOtIbt7bF8h Pj0ceCzgsx74DZBQZVTZXg2HqcAon4s= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-343-YL5EFRPINW6N4BKxRyTcDA-1; Wed, 28 Feb 2024 11:02:41 -0500 X-MC-Unique: YL5EFRPINW6N4BKxRyTcDA-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a30f9374db7so109489266b.0 for ; Wed, 28 Feb 2024 08:02:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709136158; x=1709740958; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fkI08nI25MBj/Qiu+niSA2+bh8FbCRap2BNxrenMQ/8=; b=KqSou26DAm69Vhh50IZDf8rCZp2LLiXbYGlgXW/ouJvR3w/ttIcb1dhlXtjLsgJ3Zw aOrYxDtUJ4Ixy+0b7ZQsZAEJe0Ox1bwK+tI0tkjRzg5/7dprGSby+xO7ve38s4Ua3YvS T40VIRbqvUt9QWxG1qstmiEuyMzRbcqvoBn5Qkm2cRXhwx5H1Ti1MYbUBuIBh1+11PG1 cuvSRFnFcuL4GNIAibBsB+28gNY7mfyAKd3sF980CXFXEa1iZw/gwqmeIbwhtAcMuJHD fwRyfhtS+xwpM7SyyZ5hAnvtnWyzKJAqjiAN1RlzyTfOMZg3CLw3Wfo5l1J1gVwbrrBY +1Fw== X-Gm-Message-State: AOJu0YxSyL6RrdiHTZTIiLT8uNcE4OplH95Kb3IxZ6x70Mc4BiJnkCpS t/zePinkUTQPCax8DEydGBpgNflLruO//B/xBsQiZlM5l3XOWQYxjM0Avr/mMZBd94hE3MsPaE1 Y2fZwXLu3uyD82GZSwGzXwxmxG57Dnb/FUKXvQWC/jTaZ7LJkYiwpShwbmEjuzAq3MZE0LDD0Eq Q5tORVzmAhPdiSV0SRfYaLO0cqJsapJop0rrNoJ4TnGnlI0EI= X-Received: by 2002:a17:907:7651:b0:a3c:5e17:1635 with SMTP id kj17-20020a170907765100b00a3c5e171635mr2323536ejc.30.1709136158708; Wed, 28 Feb 2024 08:02:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtyaqg0sFs0DnrHSFhtt4BzD32gz96J4Ljw+YU+3qg/ul93g5YaYWv0q12i7xhgLuFYcajjQ== X-Received: by 2002:a05:6402:3192:b0:566:ef9:1883 with SMTP id di18-20020a056402319200b005660ef91883mr2676894edb.6.1709136137560; Wed, 28 Feb 2024 08:02:17 -0800 (PST) Received: from maszat.piliscsaba.szeredi.hu (fibhost-66-166-97.fibernet.hu. [85.66.166.97]) by smtp.gmail.com with ESMTPSA id ij13-20020a056402158d00b00565ba75a739sm1867752edb.95.2024.02.28.08.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 08:02:15 -0800 (PST) From: Miklos Szeredi To: Cc: linux-fsdevel@vger.kernel.org, Bernd Schubert , Amir Goldstein , Antonio SJ Musumeci , stable@vger.kernel.org Subject: [PATCH 2/4] fuse: fix root lookup with nonzero generation Date: Wed, 28 Feb 2024 17:02:07 +0100 Message-ID: <20240228160213.1988854-2-mszeredi@redhat.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228160213.1988854-1-mszeredi@redhat.com> References: <20240228160213.1988854-1-mszeredi@redhat.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The root inode has a fixed nodeid and generation (1, 0). Prior to the commit 15db16837a35 ("fuse: fix illegal access to inode with reused nodeid") generation number on lookup was ignored. After this commit lookup with the wrong generation number resulted in the inode being unhashed. This is correct for non-root inodes, but replacing the root inode is wrong and results in weird behavior. Fix by reverting to the old behavior if ignoring the generation for the root inode, but issuing a warning in dmesg. Reported-by: Antonio SJ Musumeci Closes: https://lore.kernel.org/all/CAOQ4uxhek5ytdN8Yz2tNEOg5ea4NkBb4nk0FGPjPk_9nz-VG3g@mail.gmail.com/ Fixes: 15db16837a35 ("fuse: fix illegal access to inode with reused nodeid") Cc: # v5.14 Signed-off-by: Miklos Szeredi --- fs/fuse/dir.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index ce6a38c56d54..befb7dfe387a 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -391,6 +391,10 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name err = -EIO; if (fuse_invalid_attr(&outarg->attr)) goto out_put_forget; + if (outarg->nodeid == FUSE_ROOT_ID && outarg->generation != 0) { + pr_warn_once("root generation should be zero\n"); + outarg->generation = 0; + } *inode = fuse_iget(sb, outarg->nodeid, outarg->generation, &outarg->attr, ATTR_TIMEOUT(outarg), From patchwork Wed Feb 28 16:02:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 13575732 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F25C115DBC5 for ; Wed, 28 Feb 2024 16:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709136146; cv=none; b=lp1n5b2R2ZgkXgzULxN36P4HRvdoflOT3caOfXyJrhxZmRPabXXa3+Vfohf0tS6kE0omK2Bb3CuZPZjbt/tnMtCvUxm3HnS8bqMq5fDYemHn+A6TdWr3/jruSeLQBV9izNVWx4ejf7mLDIhUu/EsIyDLp6CGJ122Xb6Bm8BE1iM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709136146; c=relaxed/simple; bh=PxbAKHYgLI1OcHRl8vHYQg+01tE05xhYOI0BJIVrw2I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GwYRMN1ubHU0xvTs23c9Qt2yubODpefaDjH+DcGs+tTHsSbzvHG4hLC/ry0+hFzNo9QaMPMv7kHMz/68v7EnDgCnhwULZ40ES3L67dePn8nJGlAyiRZ0OZo3rd6ZLk7cp+ZDvlVP+TiHJcDYGtElkQe1vSgKjz80fNSDPFesTQw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gVLaK22m; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gVLaK22m" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709136143; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wlZidGHDUsm6YjuGgrJ/SWDsF8BQWxQfJqXAP4zn/+4=; b=gVLaK22mMwnodiNBR5kRTbvxjCUSCDvTnK81RXudYyc49KQ/Wf3hY2oZCS+UVql1taWUGf EbQiaYtmasUsaMJn3oAAmgB0Z7sMdZVhvjyC/ymT+aAdFjIjDzhbBJUlG6ArCrv7PTvkkD czGLnDkgblhc1ix7O0B7ZrG5wzReUGI= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-661-XFaujB6dM8qHjJAwy0l5yQ-1; Wed, 28 Feb 2024 11:02:21 -0500 X-MC-Unique: XFaujB6dM8qHjJAwy0l5yQ-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-558aafe9bf2so5412275a12.1 for ; Wed, 28 Feb 2024 08:02:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709136139; x=1709740939; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wlZidGHDUsm6YjuGgrJ/SWDsF8BQWxQfJqXAP4zn/+4=; b=rCVH+UPtz1d4OSZ8bad5MnCKme5WrjPbdyusr3fQ5X+/A9nRFtcjKVTH9Li5FhveCD QL+o+Hi+rNEHzT4yChputpni5m2vZ0QDOyDmmc77rZg+MbtL0u6MncnFSPmMVVv5WLZw K9rp5gmJEpz0dYD3iW2wmpcexBtBmh7zTN+oopKT9lDSVrVV6pZ8CwF79A79l2s9hrRk 2omZ4GgdqdsmOri3oqEj3p5HWFG3pjW7rhNvkpbGO0O8JbmgXsrCHfsS9TQBrQY4YFHu iJHd+0agz5dUfXiyXrs+tOSGv9dXSn09A33FZ5irsClRLD9Iw49aQJjf+MT0xx1BajG6 /tCw== X-Gm-Message-State: AOJu0YxFLiMx52Q3+6AvVolLiaXIwusc355ZyXkoRt9UJxw5bV0yKU/E AMJnBYZ7ESjcKDVOfcyLHP1IFFoDRNN0F8ZakG/EeShq4rM4yJho/0x0mu/avXyJfHkyJ5cbC7E 2+kO0t8wrel0NQB8Siy3wERXb8FchoQmGDtYLnh9INLo2Fnyqs6wegYtGVnkroJggWKa6CEuoaU Px+37z7OtZEK9bDencafb828j1NFddkqzosmEReFYx1FNIlJc= X-Received: by 2002:a05:6402:1845:b0:565:6f27:9dcf with SMTP id v5-20020a056402184500b005656f279dcfmr10306938edy.34.1709136139013; Wed, 28 Feb 2024 08:02:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXTHVHUP8BhrulS8Tz1mtVfwNA/F60tarZKITiYxPPCqHwt9qQ6ly5ZfgrEFnwrY4kyejMCg== X-Received: by 2002:a05:6402:1845:b0:565:6f27:9dcf with SMTP id v5-20020a056402184500b005656f279dcfmr10306917edy.34.1709136138648; Wed, 28 Feb 2024 08:02:18 -0800 (PST) Received: from maszat.piliscsaba.szeredi.hu (fibhost-66-166-97.fibernet.hu. [85.66.166.97]) by smtp.gmail.com with ESMTPSA id ij13-20020a056402158d00b00565ba75a739sm1867752edb.95.2024.02.28.08.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 08:02:18 -0800 (PST) From: Miklos Szeredi To: Cc: linux-fsdevel@vger.kernel.org, Bernd Schubert , Amir Goldstein , stable@vger.kernel.org Subject: [PATCH 3/4] fuse: don't unhash root Date: Wed, 28 Feb 2024 17:02:08 +0100 Message-ID: <20240228160213.1988854-3-mszeredi@redhat.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228160213.1988854-1-mszeredi@redhat.com> References: <20240228160213.1988854-1-mszeredi@redhat.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The root inode is assumed to be always hashed. Do not unhash the root inode even if it is marked BAD. Fixes: 5d069dbe8aaf ("fuse: fix bad inode") Cc: # v5.11 Signed-off-by: Miklos Szeredi --- fs/fuse/fuse_i.h | 1 - fs/fuse/inode.c | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 7bd3552b1e80..4ef6087f0e5c 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -994,7 +994,6 @@ static inline bool fuse_stale_inode(const struct inode *inode, int generation, static inline void fuse_make_bad(struct inode *inode) { - remove_inode_hash(inode); set_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state); } diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index c26a84439934..aa0614e8791c 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -475,8 +475,11 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid, } else if (fuse_stale_inode(inode, generation, attr)) { /* nodeid was reused, any I/O on the old inode should fail */ fuse_make_bad(inode); - iput(inode); - goto retry; + if (inode != d_inode(sb->s_root)) { + remove_inode_hash(inode); + iput(inode); + goto retry; + } } fi = get_fuse_inode(inode); spin_lock(&fi->lock); From patchwork Wed Feb 28 16:02:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 13575733 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3524615D5B9 for ; Wed, 28 Feb 2024 16:02:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709136147; cv=none; b=JUTc3onWhk2OaSQQR7NkKlIkbsmcuZyW7GCcZ7YY3dGS+9vGU+r/FRR/1rG+FlTq8b691qRiGiRsEB+A/qi379eOcPEEMr6EKB5sRNhAU5Osj4bGdl41aNG5YoSA61/tyx73PdlUV23ao/5K+GlNx2/aO88lxt7Lh2UtRKnDoeQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709136147; c=relaxed/simple; bh=TCHW8nniWCVaSjBjSAlAylrWTlDHg/Z7IwHcvKcnHHE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PJQYOeb7GftmZfaMbJlTwajaXRvHfwEaWKR5sgYgU/GPMaF4V6zzQHX0CjQskX7V3mP/nbOobuqpikrBw0G32Sn6iNpM+UjrJx7CyazP4dbng/0nt1rtsfwDPRfsVhFr263/40A4uUWtOQqmMe9seg593QFmFf5rFGoLDF6tCyU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=eDFdP1JM; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eDFdP1JM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709136144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=czKZlhI6mYWrYYIePiKqSQJGybasOe5lcTQz0bhQ7fs=; b=eDFdP1JMzJaaF6PP4iR5BWLpzJReTvMZcNvT8YSXj67EYWI8tKg8jxDgj54oekY5Q6XHpN jceSXR+XzvVDFurigR2Iuo653uuX47+0vgh5ef7QM9IAae0M3xNO9AMufXENvvKcubk/V8 6Ge6YWZ7tZbSFsEuEfgQjIhO0cUpwmg= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-596-tKOEEzpeMSaPzXwFkiI5rg-1; Wed, 28 Feb 2024 11:02:23 -0500 X-MC-Unique: tKOEEzpeMSaPzXwFkiI5rg-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-565317b6490so2685278a12.2 for ; Wed, 28 Feb 2024 08:02:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709136141; x=1709740941; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=czKZlhI6mYWrYYIePiKqSQJGybasOe5lcTQz0bhQ7fs=; b=HK4C3eByDcqQ1pK/algd0aXjy4CV8GX70D4Yt7LluJK59+OU4y7dxXQw+qYHcZxEtp TSZWNlW2IrHhxzmR5UH428UXRMZR8IKmc5zr2a+nxzpjE2gCZf1eCy38wgbAgLvbg8lt /FLk8CHQWJr3wU8VVo7D2Cf2FfLgPZ5EboKd5MISw3REbuork+pxgF/3nVgqy/ckQi+d /qs2tedrjmwvhYlPOo2KBloMuibBRGYdpkjeOMv/LnDeR/W8WXw52PP0Bcfx53xYo2YR xqBDCwuMyzRc3ursq85kchKmnKspSyz4nnfKjZh5z+wkgzxCnbi5+amZWdm1jZtOZNVk dZ0Q== X-Gm-Message-State: AOJu0YwV9NcChWuyX+b42U6C2pCckqrFKG74sOFSQqjrQXgcB+Gw69vV CeT37PPjVvIHgtqvsMfgnALrtUP/YqsfNA+9DdEGcvvGBN0l9NEJyq3SPakUF/+raVdplcyPGic J38fBfBvYjgDToQb0lfwSaWuqyqG2dnmLU6450mBJc+2LLm3rPF1slqGM2CaXSKOoeDqVwVwafl D7QQ26+kjk7wQUHYTCAiIyfeTivep14xIYW787DNbgg3j6QB8= X-Received: by 2002:aa7:c348:0:b0:566:1684:5037 with SMTP id j8-20020aa7c348000000b0056616845037mr5109135edr.17.1709136141052; Wed, 28 Feb 2024 08:02:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcC5RcVyEqEx26jzMgxPvBzJ+TmciqblhqUbm9uqRsHnK22ULH4l9jv24j2zrRZYcI24NnjQ== X-Received: by 2002:aa7:c348:0:b0:566:1684:5037 with SMTP id j8-20020aa7c348000000b0056616845037mr5109119edr.17.1709136140759; Wed, 28 Feb 2024 08:02:20 -0800 (PST) Received: from maszat.piliscsaba.szeredi.hu (fibhost-66-166-97.fibernet.hu. [85.66.166.97]) by smtp.gmail.com with ESMTPSA id ij13-20020a056402158d00b00565ba75a739sm1867752edb.95.2024.02.28.08.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 08:02:19 -0800 (PST) From: Miklos Szeredi To: Cc: linux-fsdevel@vger.kernel.org, Bernd Schubert , Amir Goldstein Subject: [PATCH 4/4] fuse: use FUSE_ROOT_ID in fuse_get_root_inode() Date: Wed, 28 Feb 2024 17:02:09 +0100 Message-ID: <20240228160213.1988854-4-mszeredi@redhat.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228160213.1988854-1-mszeredi@redhat.com> References: <20240228160213.1988854-1-mszeredi@redhat.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 ...when calling fuse_iget(). Signed-off-by: Miklos Szeredi --- fs/fuse/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index aa0614e8791c..0a59062deb30 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -979,7 +979,7 @@ static struct inode *fuse_get_root_inode(struct super_block *sb, unsigned mode) attr.mode = mode; attr.ino = FUSE_ROOT_ID; attr.nlink = 1; - return fuse_iget(sb, 1, 0, &attr, 0, 0); + return fuse_iget(sb, FUSE_ROOT_ID, 0, &attr, 0, 0); } struct fuse_inode_handle {