From patchwork Tue Jan 2 21:49:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13509520 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 35CE1C46CD2 for ; Tue, 2 Jan 2024 21:49:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 78BBD6B02D5; Tue, 2 Jan 2024 16:49:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 762C76B02D6; Tue, 2 Jan 2024 16:49:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62AD66B02D8; Tue, 2 Jan 2024 16:49:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 52D066B02D5 for ; Tue, 2 Jan 2024 16:49:52 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 200A3C03ED for ; Tue, 2 Jan 2024 21:49:52 +0000 (UTC) X-FDA: 81635713824.26.41B4176 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 47867A0017 for ; Tue, 2 Jan 2024 21:49:49 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aPIyzKh8; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf15.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=1704232189; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=NfIqhioGhHP/wJG1PyBueewTz4bWCmx/gOhAGW5jQdE=; b=GXrzoTJjfrz4na5pcO5YAraBfHpiUFvP528hvYA15JIPnzgFjD4ntORTguze5FtBAkSezH TTXK8GTdyXwwc4HjBikFnZ/xpEi1F6V2f8OfEJthda2ES9wNjjQ7BaSJ3tF4Mx139xZy2D JB6XkH5wGRsmkmpBwCmmyDINMaBlDEY= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aPIyzKh8; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf15.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=1704232189; a=rsa-sha256; cv=none; b=xr0OJW3cSMRtcTtWnQhjGm0mtZtruAe38CEO00ojGeC6wJ+jYGSgZ86vPZ8qqjK7d1C5vP AcuGPwaNu83lCz6dZgl0xzDPz2Dsa1iDkVY3iAi7xkuuj6NFU4u9cbBvhVmWkcxVBanwXv DVr8Od8TT/4mMgq2fwUQzukPp5kUpuI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704232188; 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=aPIyzKh8aGB5CD5Qt9EmNHcVDP0jODI5e5Hb2ZGVyDR7lsbYWLbdSNpIIkOGdxG1De0/aq mvh/VU53n9z17OqLCAbJpQI3nh6fMHQ0maqLGDQGsF/BttnQ3oVzBtrBvvJNecm+l3lrhS v5Mryyw+h5zxLAiHnBZce2Ayn8pANyg= 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 MIME-Version: 1.0 Content-ID: <292836.1704232179.1@warthog.procyon.org.uk> 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 X-Rspamd-Queue-Id: 47867A0017 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: q7p3bznyonsgmcdst6ybtzmez4ojend9 X-HE-Tag: 1704232189-428139 X-HE-Meta: U2FsdGVkX1+1liYl9OR+UFvuCMxMsPJYZ5QErTMr4a+mEO5TOmixZlFwE95uPECMFPuAENdC6VnH1chLgv2ATRBiGdUgPI1eCHeTF8CK81EAZP5RxtLiE6JTLofH5xv6eYkAFOBwinTPC/LvpvjdgG/rXrTMjfUH/+N8wRHMIBC5HEvq42RkNb3rXRFEtXWchyvQ7h9Y0u7nLGbopSCBzluIzuYMtLv3CpVnoRNnyLfOHpim6CoogtseKg76Cv28z+zWaK3jCXREluiiqLzNBqnnL7cad4c0ZGhVjcX8AmagjoVPsk/j/lrIiANcSw3y+FoDyFKbEFBTnrjGn8At3tnhhJFp/jkj/WaASlRSOA6HWkZ6ZiqgsNp6cuIilJkmK190n/z1liRkdz7RlZ4k+RKAILJbFhvSYcI7fuT1DuOFXIWW4RXUxfckW3jbGfiAxbcphXcyaqdDa8D36SIncg2TsHHIo6gwA27xHBBHW6xG8JnYB5CgZxLliJJLFaky5og5LLQKibm9NQgqTAECXhCGDyg5c3wsnGR4714PLhPXB16sYiqIa0yTKrYBCrj/gzM4yR88IjdLjGSPJdw+CwLtUc0kemGWrZ89UV7/aDTVmdu4vou6T7eZ+0GYmTJLnzJxeAY/U9ZCkuBUBAVbFe6uIkU3N1DdEY9tZmL2qIcH1uXLPU5Rd+dX5ZrD4Sx6LOgBIpJkzUBtv6eTjHVNQodFg6GJHy6i8WYva8HBzvB50dqhepiWLIQtrvB9SJxv1WEo9us71QPXghxSqp9nyB0SEMNVvhzLrQPjsOU6FGfYqty/i8R5CTScc3XeoaN2V710nbpgHWpJUOZD7W3KzqFZpxh2gNVonjMGxETUdtWfXXL+8frAOoNLSxz2skXtWkH9+Lbaiez0jwvdCmNpLZFbIBsy9DsKyoZZwZKUOZMj8uldo/i5vEQM7EhpCj46b0bg2Prx9qHooADu9WH HwZJRuFa KhJRz+myVVGmjItPbdkksGJeS7BEEfzJt/caJQtehyIeIPOLXL9wbxXfl/bs4pGx0ilkYmBmERzLtqH1b6hnnUunAXsYo1rxKQn9EHFkvqFManJ0n+bBlVjN6T82OZpJ9gP8sNKbVEyyPdxiZmq6zaWGjWAhcYzs1R2ACNbgK2me9/MaZxqPv6Y7ibyK57zYf1WB8JxF/sjEeIeECYIWK5U3zWzdRHL0HhrQ3MyOEj/xHsWggse5pjijbDM3BEYNO9tP72xGLdlURknlaKej87UgfdPaTHSN6P5DwzcxO/amRmLJ9AZs4P33zehwxGnqDfDiNTbVRnaSTRNYkCByQFbO2voRotWQXlZhS0AqnIswYwn1c3B01YopS668MATHH8DzFBZHU6EtpsOfcwM5wyxAi2l+BDWEVnz1WtJkzPnmImeK5tLpNXWxJMeBFnh4RRz4okWU1diwV03Yoa5pJkV6/r9PTmzObLQCMfQzPh7iRMefwBS8TdRRiyVAnwVecL4PHY73nTDTxiTA= 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: 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 Acked-by: Dominique Martinet --- 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 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 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)