From patchwork Wed Jan 3 14:59:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13510161 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 8682DC47077 for ; Wed, 3 Jan 2024 15:00:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 056106B0389; Wed, 3 Jan 2024 10:00:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F20F16B038C; Wed, 3 Jan 2024 09:59:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9C816B038F; Wed, 3 Jan 2024 09:59:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id BE29C6B0389 for ; Wed, 3 Jan 2024 09:59:59 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6400B120931 for ; Wed, 3 Jan 2024 14:59:59 +0000 (UTC) X-FDA: 81638309718.08.F535B4D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 9239E40026 for ; Wed, 3 Jan 2024 14:59:56 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hlTmFtm2; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.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=1704293996; 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=SdFCD8YJUNnwtU5qwz/M+xF7ih7tS/QW8qR9RpiR7QY=; b=rj6wrk7LrtlqBGkgST9BlsbIzUyjAgPHJcBK3/H/J1RSKCr4rS2sXi2olQ+B6WbJ4x0FEB Spt2cBrIBLIE+rwHPHqMDVOlG+ogefBodB/lpXZohHGRRA53LZEQOly46Umz1i/7w6U11Z LfbI8JeXq136mevX280MRrAuqO3LDJ0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hlTmFtm2; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.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=1704293996; a=rsa-sha256; cv=none; b=sD0lu8aUzmGBFu2uIhtbD7Yn52K9h5o1IpKkNdkr8sW/5UQOsfaEjfWlh43DZHRHv8cd/L Fox6eYxYXpWWb0HYkqW3oq1z5PjaZxppcXIj7NWzasSIsBaU60PTrNu4dflKzeia7r4unD /KyuWa7K5eCbiUhGYsO6L4DQpim98jU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704293995; 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=SdFCD8YJUNnwtU5qwz/M+xF7ih7tS/QW8qR9RpiR7QY=; b=hlTmFtm2JAPatbFNtzg35SlztGKjfiQwqVSLRrR4uQbXx0Qwn4J/uIdZP4AY1HI1Q1G0+P V5wGFzXE4OWFmbskcaAUCUwhtdchSghTd014pUm9wkdPd7yfnftpMXVa7MyoajEedXdKSr QMh/9hy6DdWREQA2wW/5nF1PIS1nQdY= 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-369-l-ZawQD_NwSxVHuoSJh8mg-1; Wed, 03 Jan 2024 09:59:54 -0500 X-MC-Unique: l-ZawQD_NwSxVHuoSJh8mg-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 450EB83B826; Wed, 3 Jan 2024 14:59:53 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45F673C27; Wed, 3 Jan 2024 14:59:49 +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, Yiqun Leng , Jia Zhu Subject: [PATCH 1/5] cachefiles: Fix __cachefiles_prepare_write() Date: Wed, 3 Jan 2024 14:59:25 +0000 Message-ID: <20240103145935.384404-2-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: 9239E40026 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: sf5uttcgf49cce3wzikmazpwy5izx5ax X-HE-Tag: 1704293996-358308 X-HE-Meta: U2FsdGVkX18DL7c3GL0C4BO6G9sMBVsbZ7EGo1Pnx7bKnZfHTB9egI06LxWXZKcZaPhZq2rIKTuz0WaRU1LVbnfs606ruqTvYxWeB/11cUx5njKqJXD4tOHw8fis085won46ZWQ7zpXb7NvMXGDEkql3Dy7++0DBgJvhN2Zo5//sGDB0Wp/FHMWexRGMQ8VRjxWvzisXe3wzPTxXQkpUI/HrGCr1RJraVMw7beA8O5zXbjyqxI+8+ROFYeR/+sFFO6aDDtTrRdnUS6Vc2f3nwHlJ/wL5hUMeEE9w73zW1ZJlkf+IFA7S8BtcTNypoQoVbZnxXTkRePKmCwXngQZliuXUA+aztkitW/ISK2A0LveJb4jp5YhuE3qG+8/Rr2ZxY2NJlL7HTlt2KX0mY06QXE1Z2k3WEK8tcjepg04gHPX6WNd+qcSNsI+3pQrDgWkYTFnJzjE6c24LwYbENdV84NajhwxQarcA4Scd5Y34WhwTDqzSB9UrPPpB22wPl35gysMmCnLQLKak7/9M/lqjhmAxQVeMnXWCmNBumj5W/jviD9c0jBDom8GARZ7NZOA3/IlIQeWFfF8uzRYxxducABTRC+toeqZym0hemgRXpyzdfyuroDC0r7maz5QROduQ48XpgULJBBkuGf8u4NBler1fRaNLjKe3baRwTZJ1QsI4rQ91FxPkg/k0Kh8gC0K64QubbBAWsNrpfkRV6XjTDMaG3cuRCmYbfl+fCj6rB7bb3bWG3eO9vLEVIRQye3VHnx4Cii5r7C4x47hy4bnBe9SGamc4lfgvFFhm5/MEnTcgREyH4oYrNxCQxqTKkXKOw8cR8kTHE69efxk09bnSKVmDkntdxjsvrSUoTHPXdbC3heGnotw1fYNwt+SAcA3e8xTq8c7fVlesyT4cAINHAAsexhsWW2EOKDrXy6zBE0v/yQY60z2mFKUlbpv9egtd2PE1G5kee/17g5yiQp3 OJzdUSrz +NMYvSyzc1jPyFauzQfQ08+MeZM9GU2ZyWfxjm+IKrpho7wmQkLeXOc6iW628v66phMe05T70ExSKM+g/vG1NlTfPy3/hkPuEv1AcUbWQypb2n2zFxtl+ReAvcsPa5L3AQxhGx8y5dLI2b6/w7A1vhtTu5HVmyBhqcYB6FEeeVtCEnlHxiILCTA1UTL2h5FrYL5DlsnJGFQpqAN+8Oh/AX8UfgaxCxrioTIIVArnCpyhPGIRbCQjpLNBCUnf0N/KcsOGzLL4tAJd7uq7Q7tAVMfO4tRqc7mkuEREe28nAHXTOrA+nKBbFvPlBHNbH+cIWO33XkzzUSkwwXFBoiLMkChAC4bk71Q//a1gnpOQjT5SMkM9lCINb6rwS6802iOW7EYV1BGs5lzHYhCByzOtd9+Y8AwFur/NIp/MwFsTb2O+9CH8IENG2k5k/TGOEOb8ANrPVnGusRZ0MOc5U+LSio3ggCPh6QuwPpakr 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: Fix __cachefiles_prepare_write() to correctly determine whether the requested write will fit correctly with the DIO alignment. Reported-by: Gao Xiang Signed-off-by: David Howells Tested-by: Yiqun Leng Tested-by: Jia Zhu cc: Jeff Layton cc: linux-cachefs@redhat.com cc: linux-erofs@lists.ozlabs.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org Reported-by: Simon Horman Reported-by: kernel test robot Signed-off-by: David Howells Reviewed-by: Simon Horman --- fs/cachefiles/io.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/fs/cachefiles/io.c b/fs/cachefiles/io.c index bffffedce4a9..7529b40bc95a 100644 --- a/fs/cachefiles/io.c +++ b/fs/cachefiles/io.c @@ -522,16 +522,22 @@ int __cachefiles_prepare_write(struct cachefiles_object *object, bool no_space_allocated_yet) { struct cachefiles_cache *cache = object->volume->cache; - loff_t start = *_start, pos; - size_t len = *_len, down; + unsigned long long start = *_start, pos; + size_t len = *_len; int ret; /* Round to DIO size */ - down = start - round_down(start, PAGE_SIZE); - *_start = start - down; - *_len = round_up(down + len, PAGE_SIZE); - if (down < start || *_len > upper_len) + start = round_down(*_start, PAGE_SIZE); + if (start != *_start) { + kleave(" = -ENOBUFS [down]"); + return -ENOBUFS; + } + if (*_len > upper_len) { + kleave(" = -ENOBUFS [up]"); return -ENOBUFS; + } + + *_len = round_up(len, PAGE_SIZE); /* We need to work out whether there's sufficient disk space to perform * the write - but we can skip that check if we have space already @@ -542,7 +548,7 @@ int __cachefiles_prepare_write(struct cachefiles_object *object, pos = cachefiles_inject_read_error(); if (pos == 0) - pos = vfs_llseek(file, *_start, SEEK_DATA); + pos = vfs_llseek(file, start, SEEK_DATA); if (pos < 0 && pos >= (loff_t)-MAX_ERRNO) { if (pos == -ENXIO) goto check_space; /* Unallocated tail */ @@ -550,7 +556,7 @@ int __cachefiles_prepare_write(struct cachefiles_object *object, cachefiles_trace_seek_error); return pos; } - if ((u64)pos >= (u64)*_start + *_len) + if (pos >= start + *_len) goto check_space; /* Unallocated region */ /* We have a block that's at least partially filled - if we're low on @@ -563,13 +569,13 @@ int __cachefiles_prepare_write(struct cachefiles_object *object, pos = cachefiles_inject_read_error(); if (pos == 0) - pos = vfs_llseek(file, *_start, SEEK_HOLE); + pos = vfs_llseek(file, start, SEEK_HOLE); if (pos < 0 && pos >= (loff_t)-MAX_ERRNO) { trace_cachefiles_io_error(object, file_inode(file), pos, cachefiles_trace_seek_error); return pos; } - if ((u64)pos >= (u64)*_start + *_len) + if (pos >= start + *_len) return 0; /* Fully allocated */ /* Partially allocated, but insufficient space: cull. */ @@ -577,7 +583,7 @@ int __cachefiles_prepare_write(struct cachefiles_object *object, ret = cachefiles_inject_remove_error(); if (ret == 0) ret = vfs_fallocate(file, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, - *_start, *_len); + start, *_len); if (ret < 0) { trace_cachefiles_io_error(object, file_inode(file), ret, cachefiles_trace_fallocate_error); 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) From patchwork Wed Jan 3 14:59:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13510164 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 7D56FC47077 for ; Wed, 3 Jan 2024 15:00:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0CC536B0399; Wed, 3 Jan 2024 10:00:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0550F6B039A; Wed, 3 Jan 2024 10:00:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E10846B039B; Wed, 3 Jan 2024 10:00:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C75D46B0399 for ; Wed, 3 Jan 2024 10:00:22 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 74A1C1A08B9 for ; Wed, 3 Jan 2024 15:00:10 +0000 (UTC) X-FDA: 81638310180.25.1DF3218 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 965BDA0017 for ; Wed, 3 Jan 2024 15:00:08 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZcosswAf; spf=pass (imf15.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704294008; a=rsa-sha256; cv=none; b=KHN+BjOEKwy5aVFAj0KOt6XWD5izvzZdA2V1XkdRBAKOnwncVFPbh5I46ytuFt2ysYKcmW BZXNitK2RRvzKX0DoaCXM+ywzMCQzIY9jvxgCe9/EisQGPXiJIh+d/o6NICF42+QgzGw0L 7VmjOYWEv/HpNRBeMsEo5iJPlL4y4l4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZcosswAf; spf=pass (imf15.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704294008; 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=ZUPriBHgZCe048XAouZ6FVZlUrGVgRcZGkDmJ6vhI+o=; b=VrnSwjB4m5wxDxQ7kLAkLHH0+c5+DRDzW8YRhSW39tmy1b1HmPuvDZ4T+n4IsKpIN2MY55 kvRxOnxnkLpVvzg8ywByG2QRNlBg5mx1ZpLRl5TvArE1yzQXlGZKoy11BVgtF4tmOf5Hic o01urj4cWINJle5XBubujcwdbkRz+1c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704294007; 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=ZUPriBHgZCe048XAouZ6FVZlUrGVgRcZGkDmJ6vhI+o=; b=ZcosswAfmwuQQDPOw/u+XeeOx1T9QEmw5bQsPu+2eaHVWQghGX+4v0Ohw65WDkCa1vRvrH WBQc9uwCEP52J6hMbCRYzfFoksEbM1i1J4wbGGV9ik3D+xYqkH9Xo9DaWiw8ChX5jK+UoW kFuiqPUeTPM4z3mQbRkheUySAX6hhdI= 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-194-mFIdXobHMneufCW3dOaAMw-1; Wed, 03 Jan 2024 10:00:04 -0500 X-MC-Unique: mFIdXobHMneufCW3dOaAMw-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 7FA74185A780; Wed, 3 Jan 2024 15:00:02 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0074C3C30; Wed, 3 Jan 2024 14:59:58 +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 3/5] 9p: Do a couple of cleanups Date: Wed, 3 Jan 2024 14:59:27 +0000 Message-ID: <20240103145935.384404-4-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-Server: rspam08 X-Rspamd-Queue-Id: 965BDA0017 X-Stat-Signature: 5fpihxrau9pf3kk1uauhfzwbdidbgx16 X-Rspam-User: X-HE-Tag: 1704294008-305125 X-HE-Meta: U2FsdGVkX1+EJmuLL/2tPMsmdLswjH2kWEc1DN9gS7sOYdvHckFXwHUmSvY32kjxqhkm4iDXZtm+UUAsrdOcMkVeE6af82J0xRANStEaQ2Au34O123qhCtxWjBNsf7tXgnvLRKwTt8CiEKZM8ZYrVmUsKM6BqoMS5fE1VbRqscICFjw89JMoBfjkBwolmjtWNm93wCN3i4UthrOrNgSgoOHZJ0EU8/Jlvrw2vmKd+F53VtdYqsydiQrLgjMOv4o7kSk2ofsd/+15RtmQwn9yz6gZsx2l4L4TPHU7lHCHjwz7hNAMf58EWE5qjWw1gNwgCxJXboRZGfqGgUxeA3jCLeopVQ1hPBjvyWARjXsLLFAyU2JKEINcTiSGm2qtpL1+u8C7uvH0Svy3jGjSChIM6sAcE5c4lpU31S+TmVdLZGsafJT0L5LiG/mGw7Pto3o0BCmYMZ3hlNpBJJ5ugsg42/ConMelgAq/2F/CziS2zD1MFSQ9LHu7oXKt0ZjF6q78pG7ft9303z5HF26eeuiM572mbWYfDshpFp9vmwBiiMcTZibi/2lR0n39M9HZTsNnAcT0LCYE7mlE2aQEuTUy6eRi/zz8OjGoiSMrITlq3Fba8sQMlhJIrCgxHPiEyAlNk8uiE9qqHu4MLvX2siitSic4gKmJinR/EETMcQPmaRHHRr+FMIYph2Q9ZaMMJB96CEtQxT2S9bo8z5rx15Q7tkO8GjNDwPIzTBNPlzKN88BeP3zm2C6WCKrxTyxzEN2dGtZeXLGBgz1xlAl8kyLro6ehiJaj6fYcUTytIOM4XpUEcnvuMFMifjcr9/EGNUxK3OFk4y8r8POhez+wsOCT5Hs15x459Spy3nGXnjDLru7JQl/OisxadpKsOvFRveDxaDQAa2wyFHnjrlt5UG7oVKP3z1T+JMy5K+l/NOjE9h2s8/AhSGMn7Z3JltdyAuOxhmTdHPLMcpL74C3wTnB aOCw/oRN amzva9UiNvXdlH0JmcPI6q3Ds5s9SERmcJfxvJNYJNeSFk1DLq8Yhjs2VObKpBY6jpir/Se5Pa0tiw9xWQWkFNUhv+0cA9O8S/mkGtCHpBe6LkCufHBQMcIamDT/E/tpi6PVaKH2vB7im2tR9mF0Knj9u0M0xtc4+ouiicvVuhpih53KGt9Gx3w1h/OeBEptZcgjJwHbWPrT2K4CnUQeIi85f2T2Ww/MzE/olZK9EI43kn9VWzYpv3TCW4O69M/m1Ik5CZhK+yRde6hpdXolGtf1w7JzaW37VWV1RtmxE+3ksezYHe14afFG7cO21+P68678QpufswVzZ7Yl7UXBqCskrMq/zf+UMmmWw/0L1Decs+TmYzzVciZFBxUuEgbTWxlqYO/1lNJ0VOR17t37yHhpAhGgo8AworC6h 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: Do a couple of cleanups to 9p: (1) Remove a couple of unused variables. (2) Turn a BUG_ON() into a warning, consolidate with another warning and make the warning message include the inode number rather than whatever's in i_private (which will get hashed anyway). Suggested-by: Dominique Martinet Link: https://lore.kernel.org/r/ZZULNQAZ0n0WQv7p@codewreck.org/ Signed-off-by: David Howells cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Christian Schoenebeck cc: v9fs@lists.linux.dev cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org Acked-by: Dominique Martinet --- fs/9p/vfs_addr.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index d8fb407189a0..f7f83eec3bcc 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -28,8 +28,6 @@ static void v9fs_upload_to_server(struct netfs_io_subrequest *subreq) { - struct inode *inode = subreq->rreq->inode; - struct v9fs_inode __maybe_unused *v9inode = V9FS_I(inode); struct p9_fid *fid = subreq->rreq->netfs_priv; int err; @@ -98,15 +96,13 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file) if (file) { fid = file->private_data; - BUG_ON(!fid); + if (!fid) + goto no_fid; p9_fid_get(fid); } else { fid = v9fs_fid_find_inode(rreq->inode, writing, INVALID_UID, true); - if (!fid) { - WARN_ONCE(1, "folio expected an open fid inode->i_private=%p\n", - rreq->inode->i_private); - return -EINVAL; - } + if (!fid) + goto no_fid; } /* we might need to read from a fid that was opened write-only @@ -115,6 +111,11 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file) WARN_ON(rreq->origin == NETFS_READ_FOR_WRITE && !(fid->mode & P9_ORDWR)); rreq->netfs_priv = fid; return 0; + +no_fid: + WARN_ONCE(1, "folio expected an open fid inode->i_ino=%lx\n", + rreq->inode->i_ino); + return -EINVAL; } /** From patchwork Wed Jan 3 14:59:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13510163 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 67486C47073 for ; Wed, 3 Jan 2024 15:00:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E87BD6B02E6; Wed, 3 Jan 2024 10:00:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E10156B02EC; Wed, 3 Jan 2024 10:00:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C633A6B02EB; Wed, 3 Jan 2024 10:00:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AD9756B02E6 for ; Wed, 3 Jan 2024 10:00:14 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 89A1C12092B for ; Wed, 3 Jan 2024 15:00:14 +0000 (UTC) X-FDA: 81638310348.15.33CDA0F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 79D7A1A0027 for ; Wed, 3 Jan 2024 15:00:12 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PKcc3oFd; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1704294012; 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=l/klC/ghutWIOc1+EVzXLrxXcGHqt0/sieVr6S5RVKE=; b=i11J86ToHllfSF8A/b6QqBe8W3DiyL0CwvNnmVtNxuurS+kHGiCvsogS7FSQNGgoCumtC8 LRMoaFfxB9YL52KjeMHIJ+B1fUaggDeoMQj0OHT/1W4oIdzqKTVD4l8gNktWFHBZhmNYiy bR6tgP0KObPr19JiqODtFYtPdTcdLiY= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PKcc3oFd; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704294012; a=rsa-sha256; cv=none; b=I8KmmddyNBTTdmDbSA0JyJMhAEhEmHk3jgeekOHXy5GSkqq7zOOyHpxuFbf32QwxF85XrV ivO861yXRX7PT391DmG5oC2xVEhwpfXmJe69tBVHubjk5ci/8HDMaNKY8iiZaEd09xQoW5 ek1kXEJ/voD1k6mxvcvAl9UiUHaUS4s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704294011; 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=l/klC/ghutWIOc1+EVzXLrxXcGHqt0/sieVr6S5RVKE=; b=PKcc3oFdjtuJktPx/Q9JV6aDZd72LiH+YYZzgii44amt9wGCPsNJJ77T6z8PSIOEUf5KUQ g/Zos1dJKtCGWRrOsutw5Y/KcoVXKRbk6nzZ0pkT2VShd+HMypjiVg+Pl8tNZeecGdDxh1 ab2GRXfpeeaNlhRKUvwn+3TGFVXeSiw= 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-14-L2AWb4usNJ6xafig_4JuOw-1; Wed, 03 Jan 2024 10:00:08 -0500 X-MC-Unique: L2AWb4usNJ6xafig_4JuOw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 4C7D38F4126; Wed, 3 Jan 2024 15:00:06 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DFEE2026D66; Wed, 3 Jan 2024 15:00:03 +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 4/5] 9p: Always update remote_i_size in stat2inode Date: Wed, 3 Jan 2024 14:59:28 +0000 Message-ID: <20240103145935.384404-5-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.4 X-Rspamd-Queue-Id: 79D7A1A0027 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: narcighrinxwi6d45imk7ge54mjg1wpw X-HE-Tag: 1704294012-66857 X-HE-Meta: U2FsdGVkX1/ytuf/GTwLZ8Lys4EeqeAlGpM7FVfIHk17GnUODLwMAWOld4mBmIA6XgSi+q2no1va1WR8KPwBucE9qaStJoEruCby0oLPvc0PcYRPvNdmJ8EpboX0heBvGITK8Kv5dbeMpX0rsfJmY3+UbbGaYluwOXXhcCx8igK4i6RPM3MZJfMrTllYA5ZeTz4R1jY0wPBtDfQZ/vjE/XfYahwn9VJMJV0PmuBsduCkBcas+/1IRg3hU891VP76ad3WcVLnkMV0a2ZdWTrPv2S4fi4K02YaDn9LoCQsQsU4iOp4Oz+uf6QyfRIy+w/byfO/S0Dd22EB9piSccR97DLp7Jkg8aXMwMR+2bR0Ah0Q3j9nDKBh7ujSYhu8OHJX+8r6iUFmZ3cPLyTen0oWgf1YZ1ImjteZKuXWLxx1Cx335VbsKTKyAnIxK/tPvdPA7QuLoxSB5etqdf7STL93FLFXkwcuR5f1yjNb+VJQ9nTrdXEzwXHKUp12hVBbPYXtk24c6i05eiLeCq8xHb+2RvJ0Y/tuZxjuMbhfMOitEV2Cmn2GcYhL//O2sxESsLU7vxvxddkvUuLKCzJmhdU4kBBm4JeESqr6ctAzs7tHaibWGTCFEIUrMQbVStAbR5M3gdhjzRRbv2QLadKN+sDk/PP9VQHhX/8wAzXLh8kbMFnpV0IoOHiUc0RbewlP3Cd+uvb3XUfJs2O/EH9zc2zEuu7AfPo2WKlg6iRzsuF1L/Z82cLMVxMOtlI7aH+YgFbjR2cdPoN8WwerFnCbjRrS9f1yGvo/35WXDZfIfb01RCno7b5HVm+dqR2q8wk/nghRCUE5o7hhWOglD2WoJthMGZoEyrOWGcz7+cHw6kDCoyKs8Une9LdzwzXHgxhu3vEjLDQYWFjmzyR+GlXkKUJ0Yl4/yLi0AkAomxbv7cR5C8I6wrfeYUkQSc+19e+GVjZA93T1mRedB3UOf1Jd5Tq Mogwemz9 oKfGeFljFhzFpseH8RCFqXiFps5/u4ui5xldSNrOTcCaALzMmq1R0HvUEd23MVQ9e0MwHle7TdP5C9LWhGL9NJFEMSJbI0Pd7oODjbd36XrkPv225/hQkULgx/aW/fvIMqimsjQhyYFMOfrsR3vBMXnN90AQXtFSDboCDGfx+RlkjxpM0NeGlQ4sp5UCfHpHBYGEYM6Off5T/BYdwx3Hev93/ypIJLfw2ClbU0QuEFwNIr1lAo+JHs6cd/I6bT3BAHg/fPtbpB+xm5iFOyrPyfyaidnlvtgjZzF4SZICECi9qVP/qTmFlgRtfVUzTxOANSYJOoG6YJFb964SCC9jtPkMGPagmz8iA9vgOqWli15ecr4Y/48r64WmZqr+DpFOkOaY0/BA74yDpImz0sipspX09bynaV5f+5W8NT+IHkK2mwBHvm2CdG8R54XYluZscjYxbsobssIcipNY= 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: Always update remote_i_size in v9fs_stat2inode*() if the size is available, even if we are asked not to update i_isize Suggested-by: Dominique Martinet Link: https://lore.kernel.org/r/ZZVctju5TEjS218p@codewreck.org/ Signed-off-by: David Howells cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Christian Schoenebeck cc: v9fs@lists.linux.dev cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org --- fs/9p/vfs_inode_dotl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 3505227e1704..aa3a77bb5e86 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -684,10 +684,10 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode, mode |= inode->i_mode & ~S_IALLUGO; inode->i_mode = mode; } - if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE) && - stat->st_result_mask & P9_STATS_SIZE) { + if (stat->st_result_mask & P9_STATS_SIZE) { v9inode->netfs.remote_i_size = stat->st_size; - v9fs_i_size_write(inode, stat->st_size); + if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE)) + v9fs_i_size_write(inode, stat->st_size); } if (stat->st_result_mask & P9_STATS_BLOCKS) inode->i_blocks = stat->st_blocks; From patchwork Wed Jan 3 14:59:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13510165 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 9741DC3DA6E for ; Wed, 3 Jan 2024 15:00:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 279B76B039C; Wed, 3 Jan 2024 10:00:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 202BC6B039D; Wed, 3 Jan 2024 10:00:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02DA16B039E; Wed, 3 Jan 2024 10:00:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id DF5856B039C for ; Wed, 3 Jan 2024 10:00:29 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9E48F140925 for ; Wed, 3 Jan 2024 15:00:29 +0000 (UTC) X-FDA: 81638310978.08.67A1698 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 862FB40015 for ; Wed, 3 Jan 2024 15:00:23 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WlvIIMQY; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704294023; a=rsa-sha256; cv=none; b=elAQqiV5G+NfU2HwHFht/xXcN7Fg3hx32LKcwXkatPRSKv74R2krYp4WeX3E6hf19XhupA g16L9VlvAtcNNJdyJeONH0W/a9UWhRuZo2QLSYYM5s+uVQp0vBnY8Gk6bWSkvY7ycInnrK 05nNYPTpfkUZeOljlBRnvC9T5di07/0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WlvIIMQY; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1704294023; 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=7QMJZ+3lHeykV3WPSbajID2T4bzMyvXitF+gI+XPTjU=; b=LaP9x0jT40p/0QSJ7VOep6ujCMsuaAXQvNLOWCmBT9+1R5K2TyT983pJ6auv0VtIUo733q yPoPaa9DJi2OencKBu/bEztQYCTkW5ClU10McRRdKRxMjcB5S+EfyOzhtm3RlFnyAFZbP8 T1zmPZB3pcpsoXoA23vJGM5spo+JF04= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704294016; 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=7QMJZ+3lHeykV3WPSbajID2T4bzMyvXitF+gI+XPTjU=; b=WlvIIMQY0Jc70EjRsDm3sWLi9Edks09+k12WzFYdIz6MkmSMAgYdFppVcZRRiyAzDO98EQ L/V8725gWJnJeFp2y9pu1q9Mb9X/v9G5vy5rOvpLAQJGWVr2OK9lknruEOsifKbioInJZI Yr3skH16iF4m2ohBfQZVaZE0keA3Hxw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-590-aceTF6bhNCidJMmyrfkt8A-1; Wed, 03 Jan 2024 10:00:12 -0500 X-MC-Unique: aceTF6bhNCidJMmyrfkt8A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 4AA321E441CA; Wed, 3 Jan 2024 15:00:10 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A2D21121306; Wed, 3 Jan 2024 15:00:06 +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 5/5] 9p: Use length of data written to the server in preference to error Date: Wed, 3 Jan 2024 14:59:29 +0000 Message-ID: <20240103145935.384404-6-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.3 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 862FB40015 X-Stat-Signature: uyp696ie3spzqnzmg1n5ja8f6pt7suai X-HE-Tag: 1704294023-138680 X-HE-Meta: U2FsdGVkX1/erz1P4QxHpWJjzru2V0GRpRgtP16KONYg107dEO9Z4XFByQ2b0VbmhKtCmZ2m/qBMPIRvJi4bUu6ZLN7S/9PttQJ0aqYS2SeADzOZWnQM1nTuOCQ7XVNc8vcPL23fMEKIiMvtqGbKDm0PiM095QcRhw+Rt9V8Z6bv3Sc5Hqdjz/SeRTT8RMuGOrS6EBWAwlbjm9qOSOa3tLiNGFFTVUbXC7gHJyf9LfaOgL8owSA6hmFdm/2IGBAoJqcxKygmIA7uy0xOGYxyWj+DdvVNhqW23cQXZ0fqZJDky1p8/FRy26W1LYrHwz5ymXKWvr1c+YJC2YOeY1njUSYIWIIBV/tVyYpEqFWxOsx0ynZliuq/Vg6w2kid8ChDyPXHzynZG7kj+IveO3VH4ewr5wP3CQjedWV7BWa5pRENogKbyQJ5svbNedtpxScwGuNAxGHkSAdc92NCciAFGMbWOaSIi9iRxrnNAvVs8zbf6I/3fv4ylAwxeVzsGV4pL2U+B6UN5wplKfpcxJx0lyZZIENRaHeWjajSymB++PZunbFcbsbheRdnOSbookLWOvApYyz4Smf/l46JSKXq2n9PjyQDbheqoscX1eIufT/sU9Kli9zCmbPwhkAQ6gW6GiabLrYuMxT7WJ0cCf5gS+L9cDrPhcqwhFIj4X2/pkDVP9LXGdfqMKuLfBh8PEcOKPhoI16GIqk0w7pkjeHG8Szf9ub52/6QiGqdC1NP4/KIPdPm2DxQ9z9FFPNrcw5F/eQITrKXFjxijPlgJ20aK8GBs5aMVty/em/YA9SQBA5sKGo8afsIefBXgiQ0eLQiHcfqB7V7bsVQ7JHkE/KMOvLpPcePFacbw7nFe+6H26yPC/pbZmoE6eE3xSnBSPdMRnWUlLjUexzN6MT4BsIhSuRyJUV1C+YezqO6UBRw4YVZVf4eeEiqEj2nS3K2k4ZYYAeTRSh+Ambz/SNwvCA vO3+gg6f dzYFlOzHB0B+R3AjSpzTbvcsbWPfwKZle74rQflArju5rfwHPkaXD8Z0+uuiUfeI5Z4VGbF8LIbzjqXb1Fitwtq07S7wyq/nT6IwJtqFE492MEczcuZ4da1McPCB6VrBrUKOxOYBc8RnehQYD8OXQ1aMFES9+TuJtUhjv9aQeY1Ll6r6Yj6CD88LePt1O2PcIpqUcjPfDh+zrTy/ZsFKFK73agq/eBx1Sic966uvz4EbgS6NH16C9wwL1NvlHO/Y2OdRihOocNtvZ1BT04SVGDfmrT3ZjxANkMPfA11Ow9enn9wmhKOct5uinzPPmXFkmlANvexo8zeaR83rHIY7kzWY0Z7Kftkum33HdLyP1vY7wHxjGcxXjF688+YJCDjbtptPLdZgmsgkHDwDp6Lmz7D9G9NhxCgbIPtFPe6uxxKiJ/3zk6IxoM3ijXA== 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: In v9fs_upload_to_server(), we pass the error to netfslib to terminate the subreq rather than the amount of data written - even if we did actually write something. Further, we assume that the write is always entirely done if successful - but it might have been partially complete - as returned by p9_client_write(), but we ignore that. Fix this by indicating the amount written by preference and only returning the error if we didn't write anything. (We might want to return both in future if both are available as this might be useful as to whether we retry or not.) Suggested-by: Dominique Martinet Link: https://lore.kernel.org/r/ZZULNQAZ0n0WQv7p@codewreck.org/ Signed-off-by: David Howells cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Christian Schoenebeck cc: v9fs@lists.linux.dev cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org Acked-by: Dominique Martinet --- fs/9p/vfs_addr.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index f7f83eec3bcc..047855033d32 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -29,12 +29,11 @@ static void v9fs_upload_to_server(struct netfs_io_subrequest *subreq) { struct p9_fid *fid = subreq->rreq->netfs_priv; - int err; + int err, len; trace_netfs_sreq(subreq, netfs_sreq_trace_submit); - p9_client_write(fid, subreq->start, &subreq->io_iter, &err); - netfs_write_subrequest_terminated(subreq, err < 0 ? err : subreq->len, - false); + len = p9_client_write(fid, subreq->start, &subreq->io_iter, &err); + netfs_write_subrequest_terminated(subreq, len ?: err, false); } static void v9fs_upload_to_server_worker(struct work_struct *work) From patchwork Wed Jan 3 15:47:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13510209 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 B70A9C3DA6E for ; Wed, 3 Jan 2024 15:47:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 169776B00D4; Wed, 3 Jan 2024 10:47:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F22D6B00D9; Wed, 3 Jan 2024 10:47:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EADA46B00D4; Wed, 3 Jan 2024 10:47:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D8E976B00CD for ; Wed, 3 Jan 2024 10:47:24 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A11481603D4 for ; Wed, 3 Jan 2024 15:47:24 +0000 (UTC) X-FDA: 81638429208.18.87F0F3D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf04.hostedemail.com (Postfix) with ESMTP id DC00B40021 for ; Wed, 3 Jan 2024 15:47:21 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VEpWuMPY; spf=pass (imf04.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704296841; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=T4zshVgbXU4KADwit5ys0TaPmzA2s1+8lP1tq0kT5oQ=; b=vVzZn7qwbXvDJ2F26v/JkfXqYz/4ojGubaf0JDr02QeWzEFgmVh/jUdI1KeP7dM3vr+rP1 9XXN9iyQk7l2XgvRCsPZtgaKlUaVZ1I+QzIZHMLOkv+XOyj9WPMlr53IckSoogPgrNbca8 wXvwgtgFe3Vou4NP8iJBKtet4yEjxeY= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VEpWuMPY; spf=pass (imf04.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704296841; a=rsa-sha256; cv=none; b=GxUba2kFhmktye5IcATM77c2hh5mVykanWcSmfgT24syHD0Lu59ZHFjiJ3sy1tPNhqxyLA 6IQdnuzB0d4ju9yzm7xbE1sD/vgj2vbKZCPbaq4cLCAxPUFKrVcgoyT3yvHPDjTIHdYK9z xumyWN9Av7E2Z9mFN/cS84HrFVKcnxE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704296841; 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: in-reply-to:in-reply-to:references:references; bh=T4zshVgbXU4KADwit5ys0TaPmzA2s1+8lP1tq0kT5oQ=; b=VEpWuMPY3MtXvcWapOe78oF2dSQ5eYY4an0qgFlrw8iFoH5AU/FdxATBKxDcnlsgGj6fip G+wg9BiStGUUDONiAvHZoU1rkmTcgwmNnYZ9v3OSgtTSIFzGT9ZCy9DqLbRsXZ8FwUPRVc hl9L3tox1PCMKK+xu9s/gaImK9bE/do= 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-586-Lmp8D3ZiP6Ojc5GmI18XTw-1; Wed, 03 Jan 2024 10:47:15 -0500 X-MC-Unique: Lmp8D3ZiP6Ojc5GmI18XTw-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 A2F02884346; Wed, 3 Jan 2024 15:47:13 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6923E492BE6; Wed, 3 Jan 2024 15:47:10 +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: <20240103145935.384404-1-dhowells@redhat.com> References: <20240103145935.384404-1-dhowells@redhat.com> To: Christian Brauner , Jeff Layton Cc: dhowells@redhat.com, Gao Xiang , Dominique Martinet , 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 Subject: [PATCH 6/5] netfs: Rearrange netfs_io_subrequest to put request pointer first MIME-Version: 1.0 Content-ID: <396880.1704296824.1@warthog.procyon.org.uk> Date: Wed, 03 Jan 2024 15:47:04 +0000 Message-ID: <396881.1704296824@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Rspamd-Queue-Id: DC00B40021 X-Rspam-User: X-Stat-Signature: 1q3ehpjq7prwnc34e659ebthh1nujfsp X-Rspamd-Server: rspam01 X-HE-Tag: 1704296841-840365 X-HE-Meta: U2FsdGVkX1/Y21twI3js6uBECo3AsNEVI7C+RMv04oZOhkt0Jy1+oaJrrOKDIzXRbA4Mo99tqkfNnbPTML6P7ftENB19vp66jR7FC5h99anogxfzlJ3wcNcTMQ7x2Nm5DU61IFfrsw19jPuKm7YYHmBCkjTelIj9nVnmvaKZYhkfLalxeP4un9giabPHTDwhAo7O1Xfy96QcWVL1Ar29pycXUmfaWV43MTUxtLP2oavIERIN14D7e42154El0CdRVNbS4Iwb55dh7Z85sxb8pjX9hVAibmzT58SufsItNmk7SYMY2Gn6qmG2Kixw04xxUx4D4zYc4QUpgxhgrH3YgLNT2KCH484OxE9uiSWRl3JbdXQMSAmgUimLcQRSNzeV8dXdrjYslxpAUpvRLCoU0bFR++6a1clAkN8FhqpAJS9gmhNoooiXrtKfHWO5JdQGKBR7VqI1ZYd2WAwaSDWF89OBEsSJP9AI+vjL0RjHFqmt17YZ1qbWP3M6G2SlSaDLDN0Y4OQgcShEVO3WX4duZuTwWrWTPrytDbp1GHs6rFb9Nq3AAA5Qlb3HH+ZsdBwj85KSjWJGKzxtXKPTCxZLlT+XdDEMIrr/iQlfCeTwetZ6C30vkOGcQAYx1StHfE5d5vc7+ngPqPI40ojWol/mAlhY68Z2dZ8lY882KwdoAEipjIYHkXbxy7f3fSdzt+Tyv6zwk+ri9qyjSTM1cCtJF5D0HQJTd3e2LE7q9jv1IQoH2/EHKYDrlrjLIH2uei4QdCIHuXEWOotUhivaynEv6UYqon9bSbA/HpcKpsg2eZuPucnYpiHMTV8L7pIRxWgtfQKqrNxkdLBNRrmgUD0vSK0Zu6eme5IznTi+kQ4hCZYxuPozUl6iB0GUeiNQICFRStQsB7DLAPQAoaGG4v8z+xh6IhUbxQaqfoOZuWXxJsC6uIXhS1ihJAAkJdISzKcUM1M+h58RUnWm4QjWzwP B6zkKiJR 47K+4vSBbPuZXsUCcHDhTVq6bpNzXgE+PkUkKBhPObCO8949lpUGjZj7HaTMjVYAsImVtWqvwJ1aTMWrPisCyo6G2mtoHEtGic/FUm8T7YSnp/WW0HFp/39zZHYM9vLpA7VNl2VKTy1yRXvLr3k38zSB7AO7LKsBhyg0JjXnVPNmAUhb52I9yjVvZVrzcOWvj8UnfXV9ukFfNKKh0TZqj4R7G3FgLcrtkqT67TbJpGebFbXF4EfM4Z0tkPLDBEq2nQoJJ4dQhs2qnuNrWU4m2ICYSXNMcSPBQDw4wUy4cP+ZyfaVN/s+P0KlGCw+8PvdqgvUTG5WVVzllCD+FAjshIQUOuJ+F8ueVuZ+Crv8E11Fb82Ki3Tt8jnyMw1bwyUIcrY1LE2qfPULzCHVjp1CFfJli7f/QWDyNWFbJL4fHO7hxZO8= 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: netfs: Rearrange netfs_io_subrequest to put request pointer first Rearrange the netfs_io_subrequest struct to put the netfs_io_request pointer (rreq) first. This then allows netfs_io_subrequest to be put in a union with a pointer to a wrapper around netfs_io_request. This will be useful in the future for cifs and maybe ceph. Signed-off-by: David Howells cc: Steve French cc: Shyam Prasad N cc: Rohith Surabattula cc: Jeff Layton cc: linux-cifs@vger.kernel.org cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- include/linux/netfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/netfs.h b/include/linux/netfs.h index 852956aa3c4b..d3bac60fcd6f 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -204,8 +204,8 @@ struct netfs_cache_resources { * the pages it points to can be relied on to exist for the duration. */ struct netfs_io_subrequest { - struct work_struct work; struct netfs_io_request *rreq; /* Supervising I/O request */ + struct work_struct work; struct list_head rreq_link; /* Link in rreq->subrequests */ struct iov_iter io_iter; /* Iterator for this subrequest */ loff_t start; /* Where to start the I/O */ From patchwork Wed Jan 3 21:15:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13510512 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 27262C47073 for ; Wed, 3 Jan 2024 21:15:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14AEC8D006C; Wed, 3 Jan 2024 16:15:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0FB5C8D0070; Wed, 3 Jan 2024 16:15:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F36B88D006C; Wed, 3 Jan 2024 16:15:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E41148D006C for ; Wed, 3 Jan 2024 16:15:55 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A21D4120948 for ; Wed, 3 Jan 2024 21:15:55 +0000 (UTC) X-FDA: 81639257070.16.ADC6E1E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf22.hostedemail.com (Postfix) with ESMTP id CD6BBC0005 for ; Wed, 3 Jan 2024 21:15:52 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QwDM5yw+; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf22.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1704316552; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Lz9BpuJT9ZqjBzLEQFTtycxe4tbIVPZFPrNygtaFHDI=; b=6RSctYqc/TCRJuXX3Df8qNs6LnnBCi/hL24V1vDl3nPdCF4+1SEjLHNTXWw0J4imiAifAS tDITdG6EEsPvuf5UbdZsqbqAYoYS5y51wnuPYVWsYYz7gGmq92VfeW1QxIlbLr3QVf4D2q VZoYM9euMixMYF1IC8ILliR5A3j26Go= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QwDM5yw+; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf22.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704316553; a=rsa-sha256; cv=none; b=0osYs1VOL7PVt3il1JE0y9EayiJ9P10fKSsFVc/wIujYQa/2RQ8OXOulH58YKJKOPpnzrj 90cQ5fSqDxzbR5U8okgID4XJxuTHE6fDEH02EkIRCyjNM2b82HA3sFPhf+U6YkAtuQn/zE uOkTYbYC/XXkDcs1InxE3778yoxls3s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704316552; 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: in-reply-to:in-reply-to:references:references; bh=Lz9BpuJT9ZqjBzLEQFTtycxe4tbIVPZFPrNygtaFHDI=; b=QwDM5yw+VmJ8YBM7dt5dcbVZuatQF/CCRbqDR+Rz+xbvFT1Ljwn7yXQUnOu/scH2Wt5ffv UCEUK76dhKR++7KEfzL6Cf5W9/zwOR+woc0U4EL1y+Zbxabqj+LHBQ4PCboTdghZtqGN69 uf/gdVeb+8T0VX24meMydBOKaytxi5Q= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-640-1v-GWHbRM9e1RxN52-Av-w-1; Wed, 03 Jan 2024 16:15:48 -0500 X-MC-Unique: 1v-GWHbRM9e1RxN52-Av-w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 5354F3806710; Wed, 3 Jan 2024 21:15:47 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 576BF492BC6; Wed, 3 Jan 2024 21:15:44 +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: <20240103145935.384404-1-dhowells@redhat.com> References: <20240103145935.384404-1-dhowells@redhat.com> To: Christian Brauner , Jeff Layton , Marc Dionne Cc: dhowells@redhat.com, Gao Xiang , Dominique Martinet , Steve French , Matthew Wilcox , 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 Subject: [PATCH 7/5] netfs: Fix proc/fs/fscache symlink to point to "netfs" not "../netfs" MIME-Version: 1.0 Content-ID: <900276.1704316543.1@warthog.procyon.org.uk> Date: Wed, 03 Jan 2024 21:15:43 +0000 Message-ID: <900277.1704316543@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: CD6BBC0005 X-Stat-Signature: tupg5ks9o8pmkwe6eeet5txix8gbcj5f X-Rspam-User: X-HE-Tag: 1704316552-979078 X-HE-Meta: U2FsdGVkX1/tL0UxnBdiFfZSM1/yatIQu90SozmEKoXyAY22rAQo2GidF93fOWaDJNkg2kU3fpkPSoN0q82VrgvnCEX7HquXr2ekIIpI9gq0e5+6Za43FgkJ00yMJ+4rowq0LUFAvy3pY8jMS9tg7SCl3gtKKyD+2NBHJnpOVh3qcLYGk4cFhOR/fyfJXsoUZFPwJCbv21On4z7HzEGOHVDOF9lfUzAEO3IQHbBv0a8PEqMob5KpyzLp8WYj8HAzHt8WrBaxtKfDZ/E8A4QVLcMOInjL7pouM0GSSB6eiU0JbPREeI30i88iv5ZthAgp5RlysNZRFDWdZJbMItQnAWoBUDTJGHfzRaKxMtVItroYRYp6omURwN9X3W5a4LibpeS7jr5THOYkMdiEgg/8mcztPfV0OeZoj0K9zmosODX0D55nPXOklaFzWnptnWhImtsCJKsB9kLGjocJwwWKVh37pE1PYejeTKsqh6PvTrq5A6DIfHXqMugpjkNsNZnFYRWgDp2YXJEIZu9sHNU63yMYJwhTWxl4JSjKeMxJUc3nKRsOWtGO3bvmK1KV/Qwr9GyYH1XnzI/Z2j10BSxFE9TaqSeVLy2A960CVMKV5G6BdyoWnrqk/34ziBIC8PvP4Qg/VQFs7DHRPhLQR5YqTptEL1xjh0pPIJVXoLXkduo6uXsoc+yX+eIwnxGakoRcA20EkQXTLqzyxNdWGe69CJFzUYKuIXTd+t+QANJPoHdJgXBwaryJ2sPKm4cVyeoGoFKY/MjqDr558Gl+Pitdui1c7p3/9B2vu/0qHA6uQ98yF9JrGWLxISGlX9dLCaZHBD1AIKy9jziMpHZZLU09kvmxdBo80Z+SnbGtxUwYKjYqYAjKZATfneBsp6aMTCeyJWeCvEFUDxlVadltQW0zWo9F0hK4eKovR8dIjffE4HPcMNycsutbFm1ROu1D+GQAsSvGgT+bysJJvOwCSRI 4C9G6r6M T1nHM9CLrmQRryxEzdzlwSZqYxr3poSWpCraIq+n7nfcWRL2m6i9uEYvbhckBQ0ASi0l+LEMPzLG8GfiKM1M1oxX+bETlXyJzAvQ+53VXMzBunFyCBfYjyTilS6wQbBudLQM6EOJqwLsAWtUeM+XHxgCIaI7rV8fh58c9LF02dcZ3+L52rMU/BV8/2s4t5VUMh8sQDBh5w5ZfHlDGzO88Ixb4OqfyHjQzZmH11ZIG5zDuCrrlVd00uFTl9q2ad5Q6OxV3tLnRcB9BT1lztwrwoSa16BSmLVaQD9+LsJZdQbZhdkU= 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: Fix the proc/fs/fscache symlink to point to "netfs" not "../netfs". Reported-by: Marc Dionne Signed-off-by: David Howells cc: Jeff Layton cc: Christian Brauner cc: linux-fsdevel@vger.kernel.org cc: linux-cachefs@redhat.com --- fs/netfs/fscache_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/netfs/fscache_proc.c b/fs/netfs/fscache_proc.c index ecd0d1edafaa..874d951bc390 100644 --- a/fs/netfs/fscache_proc.c +++ b/fs/netfs/fscache_proc.c @@ -16,7 +16,7 @@ */ int __init fscache_proc_init(void) { - if (!proc_symlink("fs/fscache", NULL, "../netfs")) + if (!proc_symlink("fs/fscache", NULL, "netfs")) goto error_sym; if (!proc_create_seq("fs/netfs/caches", S_IFREG | 0444, NULL,