Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6798601rdb; Tue, 2 Jan 2024 14:02:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGHpDLnRUGx2qzQVmfv3jDNs0Ju0Q5FMoBIGHXefIXNefpJ2N5i7V2KginmPBJ41aSst5+e X-Received: by 2002:a05:6a20:149e:b0:196:a4d3:b9f3 with SMTP id o30-20020a056a20149e00b00196a4d3b9f3mr5545951pzi.110.1704232934051; Tue, 02 Jan 2024 14:02:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704232934; cv=none; d=google.com; s=arc-20160816; b=KACnxD7l6yYRuQm3EggJWk+Zx2TcfVSYzXU50m1JlWdtk7XmefNgV298oTYYVUx1mr 9z8r8/JeogfG6i3iM95r8ge4ThwBzYm5+5eCRdzmDOD3qo/sg6fNWKk82PaGmqhKopdV Hq835PYOXzN0umhxyc73ESGHJ5FLrurSpiSoBwFqbcrCeA44uSImsT/JxCYZYAqAihyW ISSIreOn4tsA6mhQrgtuhoCefxAQat6iBccG+AlnmT1/GrCpyAjU2m/z1TzWg/BKMg9C tad0fGzM9IznZSMtBpDCCzM+fx9Bp9QuYs58s7NkzJJWAC8BIIaStMVyVbNM7XmXk8xs YD9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:content-transfer-encoding:content-id:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:cc:to :references:in-reply-to:from:organization:dkim-signature; bh=NfIqhioGhHP/wJG1PyBueewTz4bWCmx/gOhAGW5jQdE=; fh=bXx0gKTEiN0T4Oki33fWGQwtVMnj8qzLDmt7YPXEEB8=; b=UQJ2O7IX9BD5fySAr43b/FusOMgCaIaUMv4UYZEq2ajyiWZRA4Rnnk+0n/3D8GQnO4 QB13kua0+njal7dWg75ZtcK+Fp990EiPq4xZud+IpIEWJOr14tyKLgH9G225fwGdaa5Q d1ftpRCDFPLFACB24IZLPco8q2hba5DnA7DNpIcBGjl0yT71ISet5UxoQsmhvR6O9sbH QKdorT1sKVWXV6/mwIetqlU51Uh7p9IrrjiyjE2FwHFnLcD6Cu2BRW1IXsos+mVlc8ub WJWkpYwbNv2q17uvWK3cmhgxFiF9/zRqVvXosS7EojwlqJmcqfDspA3zc/b6JMKRwjRs wXfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QUWKjXf+; spf=pass (google.com: domain of linux-kernel+bounces-14903-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ea16-20020a056a004c1000b006d9a20bc8d5si16638205pfb.394.2024.01.02.14.02.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 14:02:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14903-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QUWKjXf+; spf=pass (google.com: domain of linux-kernel+bounces-14903-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B3BD6282488 for ; Tue, 2 Jan 2024 22:02:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F0E7171DC; Tue, 2 Jan 2024 21:49:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QUWKjXf+" X-Original-To: linux-kernel@vger.kernel.org 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 56030171C1 for ; Tue, 2 Jan 2024 21:49:48 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704232187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NfIqhioGhHP/wJG1PyBueewTz4bWCmx/gOhAGW5jQdE=; b=QUWKjXf+aRDgQhp3TIg9Y+Yg4l9az3kXaVGm9ov7ONI68KV+7LU00Q/FRhYCqnIYsajOVh GYfWDE7Mhb9A96eD5yDmVnMg4T+x/MPu2ki812XT6tEDLj5JeGv6i5teF6lgr+cas8Iwal uc17Y4vx0onfbXIZOK+VWo+rowlrK0k= 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-53-fjvlDl11PWuF-0vej4x9hg-1; Tue, 02 Jan 2024 16:49:43 -0500 X-MC-Unique: fjvlDl11PWuF-0vej4x9hg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 C03CB86D4D5; Tue, 2 Jan 2024 21:49:42 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9617D492BE6; Tue, 2 Jan 2024 21:49:39 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20231221132400.1601991-41-dhowells@redhat.com> References: <20231221132400.1601991-41-dhowells@redhat.com> <20231221132400.1601991-1-dhowells@redhat.com> To: Dominique Martinet , Eric Van Hensbergen , Latchesar Ionkov Cc: dhowells@redhat.com, Jeff Layton , Steve French , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Ilya Dryomov , Christian Brauner , 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-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Christian Schoenebeck Subject: [PATCH] 9p: Fix initialisation of netfs_inode for 9p Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <292836.1704232179.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Tue, 02 Jan 2024 21:49:39 +0000 Message-ID: <292837.1704232179@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 This needs a fix that I would fold in. Somehow it gets through xfstests without it, but it seems problems can be caused with executables. David --- 9p: Fix initialisation of netfs_inode for 9p The 9p filesystem is calling netfs_inode_init() in v9fs_init_inode() - before the struct inode fields have been initialised from the obtained fil= e stats (ie. after v9fs_stat2inode*() has been called), but netfslib wants t= o set a couple of its fields from i_size. Reported-by: Marc Dionne Signed-off-by: David Howells Tested-by: Marc Dionne 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 =3D 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 =3D -EINVAL; goto error; } - - v9fs_set_netfs_context(inode); error: return err; = @@ -359,6 +357,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, u= mode_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_b= lock *sb, goto error; = v9fs_stat2inode_dotl(st, inode, 0); + v9fs_set_netfs_context(inode); v9fs_cache_inode_get_cookie(inode); retval =3D v9fs_get_acl(inode, fid); if (retval)