Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp779715rdb; Sun, 28 Jan 2024 08:34:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYpqwD538SE1u1jXwlo/AAFIH/63iRKLcPPcS5z7lP36dwBoNca+zchjWEs4Qu3/z98j2y X-Received: by 2002:a05:622a:412:b0:42a:53f4:51e6 with SMTP id n18-20020a05622a041200b0042a53f451e6mr4243478qtx.104.1706459692584; Sun, 28 Jan 2024 08:34:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706459692; cv=pass; d=google.com; s=arc-20160816; b=A1rxl1PVShDOapW2dQ/MisVrWuLmUnONqN5Efi2JCyg5E0E0P46Y/FpHBu6fjerjfI E9Yy2G7W2RXJPc5N4ko5DQueHUQuytEPppluSa0mVawDJxgMvkfEVWVvMmk3IoVTBSHs S3+4gXYZ2f5/iU687Hksp3HAiLlV8mF4GhlC0u097IGzyGbuVjYiYaknw9B1XTUqiH1O YxI0RsuRkJ3FeTDzUqnvhOLj5BaowQj5nsZcP1k+MvMaJOP6w+27lKBLzPxcizopP5Wi V9aJYHZCZzidGJmQh1nmF/YkBsK8wyYemnPwccqobVgIlSBT0eZXdaCmot29NcMwdV2h N7pg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+wBFc7u9cFV2d6BCKnGDWPtCXW5uTy6T/S9JxsNcB1Q=; fh=R7xXmX5FtNDigaqTBBqrSd3vd57Ub8aKveRuhABkIf8=; b=ccPCh4Gfo+L6RaEKANkdkoJMvqAn6DpsiwIE+P3xcFLtbqYljG2PLovuYwTkrdCx0Z BGC/0YIuYzs5ShHKjnWPBsW3cxwuwO1Eipx1taQtiok2/4k8FPamNnmB64G+OHqxOi/Y ObBKTgzZb1m+WflsC4QmlYVKffBXkfNRm8yvCHyUhCzoa4LvqTA95FPLMEwsoKDWwFj5 Zh/gCmM6bj5RaZ66mvT748pNybmiS+wW7gSEDQg9kGhUzalkuuXd8VjuO3numb0uCHub yFZGxvXF6FQJ++QivWfjtvnmYKJ60KjVuowTLsL80o0m9RMfWyyP9RiFcIegYJQUYbrX Xkag== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IVHaagHJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-41768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m1-20020a05622a118100b0042a8e216627si3393258qtk.251.2024.01.28.08.34.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 08:34:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IVHaagHJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-41768-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41768-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 49C7B1C20ABA for ; Sun, 28 Jan 2024 16:34:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BCCD474E0F; Sun, 28 Jan 2024 16:14:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IVHaagHJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D339474E28; Sun, 28 Jan 2024 16:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706458487; cv=none; b=jDD48kaNwh2LwtyjTm50EguZkYda1ELYaP1xJ3yBMDGmffuqmOAbrt66zph3rtWYOjyUqAjqfceObflokYHzk8HH6AfsU8AGgfWHsVu6SU2O3GzgsO4WC+gXINPSSqvfOmg/yrKhzOL2fKJYZzPhXBXa6Gud5kAG7CVpvVDFpuA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706458487; c=relaxed/simple; bh=u7SVI9qUo9q53OR8A8IJE7j3KNcd9J1N/pSHxSjcf/8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=giI5jasActGJhyjkpsb0vcSJWmiqJdTveRy+Ch/Pc3VbrUw62Zxs+y8INUsEMJS1BXh2TkrwABqGi8SsMcaUSh9k2YlCFDBHpA4x6gW3kRlJZgGx0EsWKZRO7cJjd4itUbzSeEbD7gQq6fHqeOeKTTYB4I4b7JIbxu2GjiyLwr4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IVHaagHJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68AB5C433A6; Sun, 28 Jan 2024 16:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706458487; bh=u7SVI9qUo9q53OR8A8IJE7j3KNcd9J1N/pSHxSjcf/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IVHaagHJdsoY3NnJoGaLpNk2gXFFXtSb5bKoDmX1+7/M9ZoC5aPnc/SlLotMSDGCr /OyeKk06IPMAfCX58gYAWooSTR9dUcYSVPimfPvZj2931GLo/E2Kb4LR5nlxCwx77P kx+FWBMYE9jUu1hVXS54o27NB8GupakibOpnJcyqRyFiRjj79n/W5qwev272brdI3W f34C/+QdfAywKaVuZ5/ynpFh/38EI5y6ryX016s7qFKR9ZknFgCc497UU3qTs3NZy/ 3rUZxomU4O1NDKts9PRwZaEnEF3VATxIE1TevBK0TKMqamPUJMKB9QCLLhI94Erylk NKt3TH/yf96PA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: David Howells , Marc Dionne , Dominique Martinet , Eric Van Hensbergen , Latchesar Ionkov , Christian Schoenebeck , v9fs@lists.linux.dev, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, Sasha Levin Subject: [PATCH AUTOSEL 6.1 13/27] 9p: Fix initialisation of netfs_inode for 9p Date: Sun, 28 Jan 2024 11:13:58 -0500 Message-ID: <20240128161424.203600-13-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240128161424.203600-1-sashal@kernel.org> References: <20240128161424.203600-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.75 Content-Transfer-Encoding: 8bit From: David Howells [ Upstream commit 9546ac78b232bac56ff975072b1965e0e755ebd4 ] The 9p filesystem is calling netfs_inode_init() in v9fs_init_inode() - before the struct inode fields have been initialised from the obtained file stats (ie. after v9fs_stat2inode*() has been called), but netfslib wants to set a couple of its fields from i_size. Reported-by: Marc Dionne Signed-off-by: David Howells Tested-by: Marc Dionne Tested-by: Dominique Martinet Acked-by: Dominique Martinet cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Dominique Martinet cc: Christian Schoenebeck cc: v9fs@lists.linux.dev cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org Signed-off-by: Sasha Levin --- fs/9p/v9fs_vfs.h | 1 + fs/9p/vfs_inode.c | 6 +++--- fs/9p/vfs_inode_dotl.c | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index bc417da7e9c1..633fe4f527b8 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h @@ -46,6 +46,7 @@ struct inode *v9fs_alloc_inode(struct super_block *sb); void v9fs_free_inode(struct inode *inode); struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev); +void v9fs_set_netfs_context(struct inode *inode); int v9fs_init_inode(struct v9fs_session_info *v9ses, struct inode *inode, umode_t mode, dev_t rdev); void v9fs_evict_inode(struct inode *inode); diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 4d1a4a8d9277..5e2657c1dbbe 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -250,7 +250,7 @@ void v9fs_free_inode(struct inode *inode) /* * Set parameters for the netfs library */ -static void v9fs_set_netfs_context(struct inode *inode) +void v9fs_set_netfs_context(struct inode *inode) { struct v9fs_inode *v9inode = V9FS_I(inode); netfs_inode_init(&v9inode->netfs, &v9fs_req_ops); @@ -344,8 +344,6 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses, err = -EINVAL; goto error; } - - v9fs_set_netfs_context(inode); error: return err; @@ -377,6 +375,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev) iput(inode); return ERR_PTR(err); } + v9fs_set_netfs_context(inode); return inode; } @@ -479,6 +478,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, goto error; v9fs_stat2inode(st, inode, sb, 0); + v9fs_set_netfs_context(inode); v9fs_cache_inode_get_cookie(inode); unlock_new_inode(inode); return inode; diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 5cfa4b4f070f..e15ad46833e0 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -130,6 +130,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, goto error; v9fs_stat2inode_dotl(st, inode, 0); + v9fs_set_netfs_context(inode); v9fs_cache_inode_get_cookie(inode); retval = v9fs_get_acl(inode, fid); if (retval) -- 2.43.0