From patchwork Wed Jan 3 14:59:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13510162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FE08C47077 for ; Wed, 3 Jan 2024 15:00:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E88756B02D3; Wed, 3 Jan 2024 10:00:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E0F496B02D6; Wed, 3 Jan 2024 10:00:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C3BFB6B02D8; Wed, 3 Jan 2024 10:00:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id ADE596B02D3 for ; Wed, 3 Jan 2024 10:00:09 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6BE7BA1156 for ; Wed, 3 Jan 2024 15:00:09 +0000 (UTC) X-FDA: 81638310138.11.6BC4D7C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 48AB2180040 for ; Wed, 3 Jan 2024 15:00:06 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Z/r905Ed"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf16.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704294006; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MeAO0oSTBeeKS0vYZcWZAv5QaziKwPxfd8eozSQVml8=; b=7A2INOBDVxXK8/nnzs/gWEtlonF6MOqLjoKDY3pnssrpLPNFpdCh79t7XpOJMjb0tpkdkS qMI8i0O5aIx3EEDuPxKxSZ0EyTMeegHf6+OkWgERB1o254H4LTATnhAGH3fjwL6BJ9zsLa VB+th5kgiPGFOacVmykLpkda0vZ2TKM= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Z/r905Ed"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf16.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704294006; a=rsa-sha256; cv=none; b=aInedhGfxt9EUcHqmCYg6WFX5z53MsnpR21b8aDTFU9OBeM3WefeAV2XCa+ny/FHhhF5aV 1JrN29UBQPxmcF9sCEH8vaS8GYktaZ42lpoZDa9d+lXs8oDLrmhdC9hsaDHerKyzXY1URo DZgiiDKgbaoyOP7g29nRZOXH3jh/9Z8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704294005; 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=MeAO0oSTBeeKS0vYZcWZAv5QaziKwPxfd8eozSQVml8=; b=Z/r905EdIOlGjWxXvb/PkAebcmdvD4nfY6zQdPxR7azq9KOlc9hdMNwJbAxM0lTMYd6puG sO/fJ2gnV2dWPC0XuaC6yJzRj77mqEKEmIAKpYwPzdLe7LdiKKXUt87mWb9lXjW0PBqAu2 ZJGqPnggMgrhUJcjpZN4LPSbnxYkmQs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-463-cI1hlP01MuqdOORVRFc1ug-1; Wed, 03 Jan 2024 09:59:59 -0500 X-MC-Unique: cI1hlP01MuqdOORVRFc1ug-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 355D6185A793; Wed, 3 Jan 2024 14:59:58 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03EE83C30; Wed, 3 Jan 2024 14:59:53 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Steve French , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Latchesar Ionkov , Christian Schoenebeck Subject: [PATCH 2/5] 9p: Fix initialisation of netfs_inode for 9p Date: Wed, 3 Jan 2024 14:59:26 +0000 Message-ID: <20240103145935.384404-3-dhowells@redhat.com> In-Reply-To: <20240103145935.384404-1-dhowells@redhat.com> References: <20240103145935.384404-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Rspamd-Queue-Id: 48AB2180040 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 38wc5y9a576radw86hqpwnckazkh9hsg X-HE-Tag: 1704294006-703948 X-HE-Meta: U2FsdGVkX193dKIBvhgcqnTZqKJuJ3wkpamCB8uFRN24cL0uqR2C4hx1o+rubgGVmD283hOrzInPqAvxV4H2NSYyrGLfXzgTghJpXi2brAPBWo/wxvdisAsAUCSwUi1j0ZISEJq2W4+dBqRsrjnw4Hz/Q2NToiIeqUkmp02V5f1Im1lWY/EK2vP0LT6TPgXUWgx98Iak5Y7e8h/NkEzXsSh1ZdVJlrUZGq72wb1DCxSa5MWkKw5P7hhPol33z7wKUVZK1sLDNggsP1AphUiVfxln1leeIjoawDJX2ryBctU5cTdcYSxGghtpV/wn0gIYPusTJo6cgHkidRjswSxgQzTQz8fZHt2gSAE0GTlQyzveAjQJZqRL56iL07DBF4V3p9WXshRLSiDNyGPLQkEgFw4/TPOCb0Id6Vn6FApoasjv2zDoN5ESQhXKR7YH6XCWEIPWZHiNuoyMrLnVidyk4zwxdS2wXFx8LOCJf7YdalOOIZcwYxVzINUQs6vhvDl5T+7SXcpCWQr0z30lvUjAp0QcjmcWdk9kg3j1pD5EmAyfQ50yD3XshBA7ryfA9h4FKPxZ2GID2pLQmTuK7ww0sJwEkmmyk2UsijmBDIg9L7wtAdo0dkU9J09YhbScLCHzW9MSJ9KmV5cbkZ8QoNTqVQ55cMrADaxA8sQcLt0NRkn3gRYXV04/ydolHXVQ2KHLYvc81Q+6y+jxmA18orjSulg5EjoffYmQ729WKG8hWvAB6yj8ECH9p8VLaShCeKAzM+Em5S5iZRN17xIcuFv88BY9PeSL2Dukc2EWnPY1h6MTf4bZfJgT1wxtsjZR1iNxy/S2B6+PyQBlJ7Fc73O2qmUBkpRvdiwWco5rRAyLmAVBgLXaETTn93Xv4Lj+bw6Ww55HT/uDMgsSxgwQJlBRvoeWW1F06hsDFbPyM7IP4N9BaFRu7dGKh/koB9PZ8Y+4 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 --- 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 731e3d14b67d..0e8418066a48 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h @@ -42,6 +42,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 b66466e97459..32572982f72e 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -246,7 +246,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, true); @@ -326,8 +326,6 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses, err = -EINVAL; goto error; } - - v9fs_set_netfs_context(inode); error: return err; @@ -359,6 +357,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; } @@ -461,6 +460,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 e25fbc988f09..3505227e1704 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -128,6 +128,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)