From patchwork Mon Jan 22 12:38:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13525411 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 800A3C47DAF for ; Mon, 22 Jan 2024 12:39:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8933F6B0081; Mon, 22 Jan 2024 07:39:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 81B9B6B0085; Mon, 22 Jan 2024 07:39:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 695366B0087; Mon, 22 Jan 2024 07:39:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 58ECB6B0081 for ; Mon, 22 Jan 2024 07:39:01 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 322791A098B for ; Mon, 22 Jan 2024 12:39:01 +0000 (UTC) X-FDA: 81706901682.26.DD7EF01 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 78F13C001C for ; Mon, 22 Jan 2024 12:38:59 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dsokuTG6; spf=pass (imf22.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=1705927139; a=rsa-sha256; cv=none; b=jNk1xfTUPtIZN40R63GSHeAL/OQMYotzTZubw0rIC3Qj1WDUWUrYwsMeF288JKemw8UV6j Zg2+2xA62yamu++eKOlYx+/RtqeunNe9NlUYG8wN0fC5TJ0972ppTlUtrAOym6gGRgwZNW wwh7WI8IgNyGlzo7poKq7tt87Y1KRxQ= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dsokuTG6; spf=pass (imf22.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=1705927139; 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=LLfnoKn4t/yDid+WiN3BaWAqYKQWNZ/dauf1CAfFF1o=; b=SfbXLWeeBo9njDCRSBO/gLQAhgmCCdLBSkiaONOcl4vhpntueMd5LVktTV2xgZaddiaDqp e3bLnWMyD9l3Vj7j4NKIdJdsc+VoVEa7GQTRPHf6yDXyhM5iUJ9NPBMM2sss3zRA2sKnlK +3OEJT/O7lUOQfQuPHQxt/B7GGFFbeI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705927138; 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=LLfnoKn4t/yDid+WiN3BaWAqYKQWNZ/dauf1CAfFF1o=; b=dsokuTG6hWCNBRDFhmP/II9qesx6w/8pUDeVG6cd7uiv7EEd0PMSIVdt1sXQj2wUNlLdSj MZBWhfd/JrYxNJJxSnWR3d1ERZ39ktRpeK4NmUoMrNbx0POfPj9Q5fQS7KM3K/dx5yPQwv yw1QX1JPwfr6ORy776/AoxRLMCgRLE4= 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-638-vstBTg2yNa2a-V6xl5BWBg-1; Mon, 22 Jan 2024 07:38:54 -0500 X-MC-Unique: vstBTg2yNa2a-V6xl5BWBg-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 DCE273C025A1; Mon, 22 Jan 2024 12:38:53 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0330D111E408; Mon, 22 Jan 2024 12:38:51 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, 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, linux-kernel@vger.kernel.org, linux-cachefs@redhat.com Subject: [PATCH 01/10] netfs: Don't use certain internal folio_*() functions Date: Mon, 22 Jan 2024 12:38:34 +0000 Message-ID: <20240122123845.3822570-2-dhowells@redhat.com> In-Reply-To: <20240122123845.3822570-1-dhowells@redhat.com> References: <20240122123845.3822570-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 78F13C001C X-Stat-Signature: uc9kgxyncj4s8xgubkcxfh41apmnhn88 X-Rspam-User: X-HE-Tag: 1705927139-298585 X-HE-Meta: U2FsdGVkX1/yEwXDIzjT6DQUdDFjN2twJeT8hbPH0aXm7/60qEIx4PdhWXjxiTOHdzfaXLSMKX4Dd97qIX1UHYJGZjjtFthjO/JydFfclqMXPWMiBywdCCYPBeKqTiz8nxlHtU7nU/ZSFVCf2Nsu+9zQMK4XzlmF+C/uBYsOj1FcvmD/23sHq0Mtuu4P2PKWV5QGfFB2VjkA6wbbNboZJFwlYgP2xvSn6PqHBqGtCT3FdFDBhO1cbBd7U3146Yy8GfivkJPi3lp9qGIuKajcxiqSf3c1/pAvrhPQ4IlPEnhAwhynGtvztQzG/F0MtJ5d7TbHXJ93+Y6GnJto6ssqexsRj59GRYIf302DtsqjRKZtCsLYCbuxOno2kA6e77wLfuU+M+jE+a9zHUiQ909Klvwj32WD9Xm2JBccjEZB1ekO1puStoSugpSHW/FkNLFhTFIjFFJQAKc7gHSe1tktzjgUedcEGUJjCtJte+t+2L+7JWKUgRototESABZfQ1jKZQtR17wCrSuj4CO6kRXso5KnFyTYYiJQAu0wXHjj2bdiwQT7hXMQHBij232q98gG03BkFAYGysb0KpElaG6Bkb2a1PWNZwlQFsV/IO6Z+eN4ylbO/dCjQP+Vqs794e/UZfGJG6A0E/ciqijmg+XUqNB2TB/1yJT6n4DxHORZ4vx94Vk0E99jsOssKwgxxaULkK0Z/5GsEEAFynFFWTsm+OJ7M+gbMYWTtkA2ErzN2H5sBu6RV2fQrjEwZAMu7u1noSVAlxglGqIyECWTuoORPXGcJG51YYWmp8IgFWHA6jUcJo9tFdj9TMi5FdOat3WVxk0zvu1ieyF2nka0XhumpmNRLFnKseYQH5xm9/k1fM7f0X988H6g0Bmp4QdYd0HJjl7Gnah3XcKo5YIyjnSRk8D9LZvQLpGbKNWjLIPNe0254Zm4UO1gY/5ByISL6OTYJb2z9cDyRVGxuY3AGkY RxiOWzzB fFTL5OyZ0uVzs542fOFNqHZ+S8nj1BRnK+Fz4d1bJ/gSHm/w99UdO+ZUeFxQ322lWIQi4x09tW41RXix84lWJe2fzKDv+m/2yb0jUqKcaU0+noXQgYZbMt/WBflWwTTRoST7HHVdiAbL1FTlLWSUR7dvRRfxk5CXU1tE/8zxC9hBrGPFHt+jTqtY0UF6il2Vo0+JOpZirjr+RaPN6Xv97jwSGA5XXPowxcS9AJbYhB+K2PTg7ZHJbWHuOVE/f3922k/K+e+47CYFRUF0PlUV9FxUl9+f7s3LUryrNAMI9esyzhBoVfv96gdsKIwpVzJ+3TS0lrezArAxW88Qvj1H2vLiBZK+qVgZI66jn7MHmn1Cicb3gX50zvpEednUpx4t4rK6DjIVFfbPEAdnCAIET6H0lAw== 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: Filesystems should not be using folio->index not folio_index(folio) and folio->mapping, not folio_mapping() or folio_file_mapping() in filesystem code. Change this automagically with: perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/netfs/*.c perl -p -i -e 's/folio_file_mapping[(]([^)]*)[)]/\1->mapping/g' fs/netfs/*.c perl -p -i -e 's/folio_index[(]([^)]*)[)]/\1->index/g' fs/netfs/*.c Reported-by: Matthew Wilcox Signed-off-by: David Howells cc: Jeff Layton cc: linux-afs@lists.infradead.org cc: linux-cachefs@redhat.com cc: linux-cifs@vger.kernel.org cc: linux-erofs@lists.ozlabs.org cc: linux-fsdevel@vger.kernel.org --- fs/netfs/buffered_read.c | 12 ++++++------ fs/netfs/buffered_write.c | 10 +++++----- fs/netfs/io.c | 2 +- fs/netfs/misc.c | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c index a59e7b2edaac..3298c29b5548 100644 --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@ -101,7 +101,7 @@ void netfs_rreq_unlock_folios(struct netfs_io_request *rreq) } if (!test_bit(NETFS_RREQ_DONT_UNLOCK_FOLIOS, &rreq->flags)) { - if (folio_index(folio) == rreq->no_unlock_folio && + if (folio->index == rreq->no_unlock_folio && test_bit(NETFS_RREQ_NO_UNLOCK_FOLIO, &rreq->flags)) _debug("no unlock"); else @@ -246,13 +246,13 @@ EXPORT_SYMBOL(netfs_readahead); */ int netfs_read_folio(struct file *file, struct folio *folio) { - struct address_space *mapping = folio_file_mapping(folio); + struct address_space *mapping = folio->mapping; struct netfs_io_request *rreq; struct netfs_inode *ctx = netfs_inode(mapping->host); struct folio *sink = NULL; int ret; - _enter("%lx", folio_index(folio)); + _enter("%lx", folio->index); rreq = netfs_alloc_request(mapping, file, folio_file_pos(folio), folio_size(folio), @@ -460,7 +460,7 @@ int netfs_write_begin(struct netfs_inode *ctx, ret = PTR_ERR(rreq); goto error; } - rreq->no_unlock_folio = folio_index(folio); + rreq->no_unlock_folio = folio->index; __set_bit(NETFS_RREQ_NO_UNLOCK_FOLIO, &rreq->flags); ret = netfs_begin_cache_read(rreq, ctx); @@ -518,7 +518,7 @@ int netfs_prefetch_for_write(struct file *file, struct folio *folio, size_t offset, size_t len) { struct netfs_io_request *rreq; - struct address_space *mapping = folio_file_mapping(folio); + struct address_space *mapping = folio->mapping; struct netfs_inode *ctx = netfs_inode(mapping->host); unsigned long long start = folio_pos(folio); size_t flen = folio_size(folio); @@ -535,7 +535,7 @@ int netfs_prefetch_for_write(struct file *file, struct folio *folio, goto error; } - rreq->no_unlock_folio = folio_index(folio); + rreq->no_unlock_folio = folio->index; __set_bit(NETFS_RREQ_NO_UNLOCK_FOLIO, &rreq->flags); ret = netfs_begin_cache_read(rreq, ctx); if (ret == -ENOMEM || ret == -EINTR || ret == -ERESTARTSYS) diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index 93dc76f34e39..e7f9ba6fb16b 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -343,7 +343,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter, break; default: WARN(true, "Unexpected modify type %u ix=%lx\n", - howto, folio_index(folio)); + howto, folio->index); ret = -EIO; goto error_folio_unlock; } @@ -648,7 +648,7 @@ static void netfs_pages_written_back(struct netfs_io_request *wreq) xas_for_each(&xas, folio, last) { WARN(!folio_test_writeback(folio), "bad %zx @%llx page %lx %lx\n", - wreq->len, wreq->start, folio_index(folio), last); + wreq->len, wreq->start, folio->index, last); if ((finfo = netfs_folio_info(folio))) { /* Streaming writes cannot be redirtied whilst under @@ -795,7 +795,7 @@ static void netfs_extend_writeback(struct address_space *mapping, continue; if (xa_is_value(folio)) break; - if (folio_index(folio) != index) { + if (folio->index != index) { xas_reset(xas); break; } @@ -901,7 +901,7 @@ static ssize_t netfs_write_back_from_locked_folio(struct address_space *mapping, long count = wbc->nr_to_write; int ret; - _enter(",%lx,%llx-%llx,%u", folio_index(folio), start, end, caching); + _enter(",%lx,%llx-%llx,%u", folio->index, start, end, caching); wreq = netfs_alloc_request(mapping, NULL, start, folio_size(folio), NETFS_WRITEBACK); @@ -1047,7 +1047,7 @@ static ssize_t netfs_writepages_begin(struct address_space *mapping, start = folio_pos(folio); /* May regress with THPs */ - _debug("wback %lx", folio_index(folio)); + _debug("wback %lx", folio->index); /* At this point we hold neither the i_pages lock nor the page lock: * the page may be truncated or invalidated (changing page->mapping to diff --git a/fs/netfs/io.c b/fs/netfs/io.c index 4309edf33862..e8ff1e61ce79 100644 --- a/fs/netfs/io.c +++ b/fs/netfs/io.c @@ -124,7 +124,7 @@ static void netfs_rreq_unmark_after_write(struct netfs_io_request *rreq, /* We might have multiple writes from the same huge * folio, but we mustn't unlock a folio more than once. */ - if (have_unlocked && folio_index(folio) <= unlocked) + if (have_unlocked && folio->index <= unlocked) continue; unlocked = folio_next_index(folio) - 1; trace_netfs_folio(folio, netfs_folio_trace_end_copy); diff --git a/fs/netfs/misc.c b/fs/netfs/misc.c index 0e3af37fc924..90051ced8e2a 100644 --- a/fs/netfs/misc.c +++ b/fs/netfs/misc.c @@ -180,7 +180,7 @@ void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length) struct netfs_folio *finfo = NULL; size_t flen = folio_size(folio); - _enter("{%lx},%zx,%zx", folio_index(folio), offset, length); + _enter("{%lx},%zx,%zx", folio->index, offset, length); folio_wait_fscache(folio); From patchwork Mon Jan 22 12:38:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13525412 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 8C3C8C4725D for ; Mon, 22 Jan 2024 12:39:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7CF236B0087; Mon, 22 Jan 2024 07:39:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 75A8C6B0089; Mon, 22 Jan 2024 07:39:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 536286B008A; Mon, 22 Jan 2024 07:39:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3A33D6B0087 for ; Mon, 22 Jan 2024 07:39:03 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 10E97A1D52 for ; Mon, 22 Jan 2024 12:39:03 +0000 (UTC) X-FDA: 81706901766.13.5783A38 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 48427160016 for ; Mon, 22 Jan 2024 12:39:01 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Xby1Pxy0; spf=pass (imf08.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1705927141; 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=tRDq2jwLFhb5pXOHdUvfqCYrkV16pIgDVznzrFSoQl0=; b=GIeNNZK3s6VrCp0aFk7oOghJGsfmYhGeosiBTKYImYIavJr4eok9e03ZpXomi5rw5VlhQK 20QBM09wm/0xu4BW9OkrBWjvYwSi0qMOIHI8FnE5akedKdVfYy+ZId7a8ERDQUx/+sJ2z2 yjhe7fxIZXYYF1SpZFbYv0o0ZXzufts= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705927141; a=rsa-sha256; cv=none; b=JzQzB7T2B2HOz5SYbWGiok0+bGqI323a3FU2w4caVF2mqiqzBTzBvNiEZn0iiBmJA+EpPo JlhGfqaOqGyZBoTxLqKb/LwXXXqDtrQNE6wBs2GGOgvBFKlSt9bqc0qneA3idty1i5sCJT PzkYrZsF1V8lxpymJdYtoo2Yemv646c= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Xby1Pxy0; spf=pass (imf08.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705927140; 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=tRDq2jwLFhb5pXOHdUvfqCYrkV16pIgDVznzrFSoQl0=; b=Xby1Pxy0ZS/j7+j6uo2ikZuw/ipHl2qwRAsS/ipAxXzYRCTDjLFH7WDDdQQMV1Y/dnAObb QGPvDc4DOmbjxQKui8HbNAg1mtg8jM/wpC8ygDLM995nm9Clkz1/TTE17YkLraAVuFQZWq BDWVoc9eXP8En+HSO5hKwwPhZ3fPoG8= 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-357-UOC2OtDLMeOsQR0hPiJYIA-1; Mon, 22 Jan 2024 07:38:57 -0500 X-MC-Unique: UOC2OtDLMeOsQR0hPiJYIA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 840ED83106D; Mon, 22 Jan 2024 12:38:56 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0F1C2166B31; Mon, 22 Jan 2024 12:38:54 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, 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, linux-kernel@vger.kernel.org, Marc Dionne Subject: [PATCH 02/10] afs: Don't use certain internal folio_*() functions Date: Mon, 22 Jan 2024 12:38:35 +0000 Message-ID: <20240122123845.3822570-3-dhowells@redhat.com> In-Reply-To: <20240122123845.3822570-1-dhowells@redhat.com> References: <20240122123845.3822570-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Rspamd-Queue-Id: 48427160016 X-Rspam-User: X-Stat-Signature: twj7sb88rzzz8ayj86qa3j8racmcbbmp X-Rspamd-Server: rspam03 X-HE-Tag: 1705927141-757675 X-HE-Meta: U2FsdGVkX199zdye8zhgQtIF/uaaluvK711e9qh5GBGnWnRAo4JAPHc/0xg26FDd7OCaGC9UeSNdWK86uWwkjRgoxZjPhLopR1pqsHhuIZnqsI8f4LgbYNWaZ5BTB5FNY0Dj+am4vzNYF0MhkQAprkQFGpV6FVlB8BOXPNfkbrIzFtHT0DXmQptGWWGFVyfpe3P7QvepjIIQTzat8uVStVkdbKMYkNZCyRDJhzU9iS0kGHhxUfFWl9ld0UMQbnNACuuwMsSaPgafbf0uo4uGr2z9624vFBOEzoYeggbsksqGxvketbAq86zoFU9bodLuuLeKlCxKYV3ihuJhhXFGXnWgNnoJwGIah7J+dnTDcJHLj0QLAgATxLettlyj2+VzdbPJ0yGc7dNrFB2Se1MqgC1BU5nxd/oZh26iI/6EnIEVHgBalKUFsYi7Lb8ScU0pSMcKcKN2LhtxCFXaeoIJL213A7TfrrcXdQH8cRtBe7tgpbDXGMDRE2p0a+XVoFEHhFUuiiS+gr86sfhagdFIPa1uyvRN5AW4poUrdOMU1+pAOQdRmjXWCwht9ThCFbpEfDvZ5/QYWFEb6fiZCZSZRiazG4BlZBKbqXU7rpQOd8h9r93NKowavjQORjSDhmxDdyOWIox3roEg1hHZGMkgVlchroU4LYEXqaGzrkD+nix+vj6zyoNatRegp+KadRlBqoD4vo/2Wd57kWutZGpTHDypC5TZD1FPaXM+nCoZBEZio6NK+2ByUcW9hjYkn0GPCwJeYGD0sGxJKhEkZVYSZBTgDnvZPZTF41cjBKPd7im4qDFdZQcOa6UK4G+eQC2ze3nvl/iBQSet9AX8yiTXdh7dghOcwV1/AELOuhsPtNZw5Prgu3T9TUcZ0trfL9kjrDVqhqMs2c2xCfW+K2F+Q3prFTuRXDcKamdmbY1Rxwz45IlKYWjElKvbf7frq3xLzHy2762CzpxGnP2TjHY QSpTyXqA ut23GkzskcnXuyp50UCn/rpAzTUe8l7Rs7SgracZLYPbw3kU5CRINUDwaSU0w2eW5QR7H2VV0jZoJKi6UqtbSIDRJ1RAWitiCx1r5ha3ouC3EA4sVdbfC/WWVhcMVcVOfEk7pCyB2WUBwo3ywA6oJzuLxNeUwlRV93VMq7PDnutZih8mOsQzxoj9reJII1YPpVo1vq9KUcdB3YPbXTeiVlAUtrkhRmRz+K/ntgmf7fqcZwr5CgvYUtBGX2He8UdRNRysYPSxb+KMAO0rWbb6IEd8wUF+GIGHSbFeV7c1rdzIaGQ9NWzGYH5eDqzCLBAyqljpsxxPwCtJ5qAb5tTi6FxTZtL1VyvDcHjoX8+alnJJBMoog+WB9uqaE8WNM/yEDHgVv6pSKrcUURws= 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: Filesystems should not be using folio->index not folio_index(folio) and folio->mapping, not folio_mapping() or folio_file_mapping() in filesystem code. Change this automagically with: perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/afs/*.c perl -p -i -e 's/folio_file_mapping[(]([^)]*)[)]/\1->mapping/g' fs/afs/*.c perl -p -i -e 's/folio_index[(]([^)]*)[)]/\1->index/g' fs/afs/*.c Reported-by: Matthew Wilcox Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org cc: linux-fsdevel@vger.kernel.org --- fs/afs/dir.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/afs/dir.c b/fs/afs/dir.c index c14533ef108f..3f73d61f7c8a 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -124,7 +124,7 @@ static void afs_dir_read_cleanup(struct afs_read *req) if (xas_retry(&xas, folio)) continue; BUG_ON(xa_is_value(folio)); - ASSERTCMP(folio_file_mapping(folio), ==, mapping); + ASSERTCMP(folio->mapping, ==, mapping); folio_put(folio); } @@ -202,12 +202,12 @@ static void afs_dir_dump(struct afs_vnode *dvnode, struct afs_read *req) if (xas_retry(&xas, folio)) continue; - BUG_ON(folio_file_mapping(folio) != mapping); + BUG_ON(folio->mapping != mapping); size = min_t(loff_t, folio_size(folio), req->actual_len - folio_pos(folio)); for (offset = 0; offset < size; offset += sizeof(*block)) { block = kmap_local_folio(folio, offset); - pr_warn("[%02lx] %32phN\n", folio_index(folio) + offset, block); + pr_warn("[%02lx] %32phN\n", folio->index + offset, block); kunmap_local(block); } } @@ -233,7 +233,7 @@ static int afs_dir_check(struct afs_vnode *dvnode, struct afs_read *req) if (xas_retry(&xas, folio)) continue; - BUG_ON(folio_file_mapping(folio) != mapping); + BUG_ON(folio->mapping != mapping); if (!afs_dir_check_folio(dvnode, folio, req->actual_len)) { afs_dir_dump(dvnode, req); @@ -2022,7 +2022,7 @@ static bool afs_dir_release_folio(struct folio *folio, gfp_t gfp_flags) { struct afs_vnode *dvnode = AFS_FS_I(folio_inode(folio)); - _enter("{{%llx:%llu}[%lu]}", dvnode->fid.vid, dvnode->fid.vnode, folio_index(folio)); + _enter("{{%llx:%llu}[%lu]}", dvnode->fid.vid, dvnode->fid.vnode, folio->index); folio_detach_private(folio); From patchwork Mon Jan 22 12:38:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13525413 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 7F75FC47DAF for ; Mon, 22 Jan 2024 12:39:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F35E6B008A; Mon, 22 Jan 2024 07:39:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0057C6B008C; Mon, 22 Jan 2024 07:39:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9A4F6B0092; Mon, 22 Jan 2024 07:39:06 -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 C4D2A6B008A for ; Mon, 22 Jan 2024 07:39:06 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7D38E1A09A3 for ; Mon, 22 Jan 2024 12:39:06 +0000 (UTC) X-FDA: 81706901892.12.AC08E5D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf17.hostedemail.com (Postfix) with ESMTP id B054C40009 for ; Mon, 22 Jan 2024 12:39:04 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ev83hmg7; spf=pass (imf17.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1705927144; 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=QTcyfpP5bcZKRoP4ztPdz4r44FpI3I5eD9lUKEvfqoQ=; b=YKfIArm7ASSDPUZjcNsY55em5eQtPmzkYRCyq2n5XLxd+VcGC1lBAhI7FRt+TbRgHbdBur 6fgPHphAGKDtQib4gcQH2LsMsCVB1BP8zJdS1+zP2gV9ElT1GpjPHUIt2M/5kvUy1v/99r tYrYZDnUXoJJvwKcDyucpmHABBfolcg= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ev83hmg7; spf=pass (imf17.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1705927144; a=rsa-sha256; cv=none; b=laxSe0wKRsE5llZ004kyFVq+LWkGE++21N/WIRUpdFSOfulsFKAGyDAvLV6KL+JtgkNC99 8PUZDKkJqfS6TmRkTJGjo7/xhKnXLwITJdjJGaoHeWUW7xwHeYU+f3OPi7giLCfijdeH28 VIelLbpmj8dAx+GhgaBa9QdATkfwlXo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705927144; 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=QTcyfpP5bcZKRoP4ztPdz4r44FpI3I5eD9lUKEvfqoQ=; b=Ev83hmg7EeJEP6ub1Xqf66Nb+eZg/s1Utd5Bt+aZciZ2NqoQpeW+UX1HqqQRg/XLOaYQKC ySL+YXOpr4FOQViGAySvHeYgQs9BzdGIa3sJCdWa865JthA34XPd+Za/lUDdNHlXaey46s KqDhO7JYo+LaxBQnqPg2xw6B7vYYj80= 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-257-n3Heej4FNhmdGcMa83qE8w-1; Mon, 22 Jan 2024 07:39:00 -0500 X-MC-Unique: n3Heej4FNhmdGcMa83qE8w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 BA32285A588; Mon, 22 Jan 2024 12:38:59 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A95A1C060AF; Mon, 22 Jan 2024 12:38:57 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, 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, linux-kernel@vger.kernel.org, Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey Subject: [PATCH 03/10] cifs: Don't use certain internal folio_*() functions Date: Mon, 22 Jan 2024 12:38:36 +0000 Message-ID: <20240122123845.3822570-4-dhowells@redhat.com> In-Reply-To: <20240122123845.3822570-1-dhowells@redhat.com> References: <20240122123845.3822570-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Rspamd-Queue-Id: B054C40009 X-Rspam-User: X-Stat-Signature: g71hz7ti8izkgb9qtbiaffr8fuykjgts X-Rspamd-Server: rspam01 X-HE-Tag: 1705927144-491235 X-HE-Meta: U2FsdGVkX18Aw95sCOVwuSruAv5czjKwf34jkQ6GV0HuTzemqwOCe2MII7uWebIblcXPG7OMQyA/uTF8RGNGts846tWk67bJklh8jIblf8swS+P2l5Zlx8yhz1m0D/ZhnlH56WwGQVj/ksmvaK+opHTmOU3JIVuOdIUJBdmfnqPMfw4A5gOwZmMEitA3LMZFspVsmqbc6kTfEIYuijj6ofHLDB5yYepJhVYVJo81ZgKa5iCzOa6QBcxf9z31PExucfpgQcbd+lNGfrfGc6963+q4c3KnaXoWyN7wqla6kL0bhjqsqThH0kuLxhjfRjz2gNaZa4W4lJTPYP+1WsvEaKw0udBvERwKcrxfoRS640A9yJV8YAXu6dZeCQ7Xlv2zKLtN5iMUp8jRO5N4jELtW1n+zHKHM4tuzNLB/CXLK9vktc/RbG42Ol4Nu5LUfEOJfGu/4v95TPbyZ/ZQEr9y36OqLXgfIa8Q+VI6Toeqk6FzDGfJJ+WfwkcYgVp13Q/6OFv/ni/iakcI2ZEhoMuZmtzgag7ehZMEyfZaUpxEdMicMVwhwBzg+/V9k3l5qxtOsOI/LkW4BPCCAeCmxL+4ifEz2FSclq3NV7+8RcoUPL1h7j0ZRuW41WKma+6b7xI9dWBhznt2wR881aW6YVw6TGRb7d8SUnEDuVQQReFgkRHux2uhh//uiBrQap4BCrqf4Dd0GtlhvxwaXwOfGaI6zqXI8djbit1uDUHD9WlVPCjVFePn7iZ7WfMwsfliQbZNOuN1cF8DWkAffNm2pYayrvGjvbI9OBdHCWPki+nIMwQ/T9LvNRLHsbLiFLlmUW3MaJQQ809g1FBG6ufjXMJXF95AIu4C54vBcD73kS6c65eSY2ztJ/8ormgs5SskfVgcaj4RFb8rfDw+t/aK78EK6YH+un+CRuVaXgPosOy3KbtrWI5o0+NLqTJJHuhuNowXR17sS6pcWZ10i00aCVd B1XqWANX Fk4l97IQxxhmR1oVOnyPwdZf9TgtWe1Fvw1MTz+puyc4by4LkpGlbUEt6iAdAbrdpWdlHIcF/nngSSzvWI/v2jKJ7u0qlmS6LFWZQUJEkT5Cxp+lCKLqCcoCW67vwoUmWwzCYq+ytEqlm8I5EztX0MSQMOvOjqWeHF7dYnOH/+PALSb/dW1CJDalZNmmLBYy28zqKTuYHfxpD/QNy+Ma7HgUcBZ/xOKcGof/hJZE9JFG8z7ryEvwm41ho0uiWZfgFZmu//jlmE1A94HS+s0RYNmTLoGOp6lXXfUHmnHyydhMhNnm2Y22HbHOD9CfRWSyCRIHCB+gZNCL7wJIO1jiCRSpvzi6Nrk2RUFHeX+xDlX1TWXQhs6JzmYZ3G+azFmAgos5DtfX5hZlSx58eZDwOhyRrY67+VQN0DPZqQGzwbDMGHPwtNg8qC7EIVpNxgSu0XkSeVX7Af8kX8d5iTrCcOfXnv391ZI8Nhofpj/QAJNDpA0SCQJ0T17nQKwkSRGOqmBUy/sPXWfApkn2rH4mZbOYDv9A8HNJY0IW4 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: Filesystems should not be using folio->index not folio_index(folio) and folio->mapping, not folio_mapping() or folio_file_mapping() in filesystem code. Change this automagically with: perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/smb/client/*.c perl -p -i -e 's/folio_file_mapping[(]([^)]*)[)]/\1->mapping/g' fs/smb/client/*.c perl -p -i -e 's/folio_index[(]([^)]*)[)]/\1->index/g' fs/smb/client/*.c Reported-by: Matthew Wilcox Signed-off-by: David Howells cc: Jeff Layton cc: Steve French cc: Paulo Alcantara cc: Ronnie Sahlberg cc: Shyam Prasad N cc: Tom Talpey cc: linux-cifs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org --- fs/smb/client/file.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index 3a213432775b..90da81d0372a 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -87,7 +87,7 @@ void cifs_pages_written_back(struct inode *inode, loff_t start, unsigned int len continue; if (!folio_test_writeback(folio)) { WARN_ONCE(1, "bad %x @%llx page %lx %lx\n", - len, start, folio_index(folio), end); + len, start, folio->index, end); continue; } @@ -120,7 +120,7 @@ void cifs_pages_write_failed(struct inode *inode, loff_t start, unsigned int len continue; if (!folio_test_writeback(folio)) { WARN_ONCE(1, "bad %x @%llx page %lx %lx\n", - len, start, folio_index(folio), end); + len, start, folio->index, end); continue; } @@ -151,7 +151,7 @@ void cifs_pages_write_redirty(struct inode *inode, loff_t start, unsigned int le xas_for_each(&xas, folio, end) { if (!folio_test_writeback(folio)) { WARN_ONCE(1, "bad %x @%llx page %lx %lx\n", - len, start, folio_index(folio), end); + len, start, folio->index, end); continue; } @@ -2651,7 +2651,7 @@ static void cifs_extend_writeback(struct address_space *mapping, continue; if (xa_is_value(folio)) break; - if (folio_index(folio) != index) + if (folio->index != index) break; if (!folio_try_get_rcu(folio)) { xas_reset(&xas); @@ -2899,7 +2899,7 @@ static int cifs_writepages_region(struct address_space *mapping, goto skip_write; } - if (folio_mapping(folio) != mapping || + if (folio->mapping != mapping || !folio_test_dirty(folio)) { start += folio_size(folio); folio_unlock(folio); From patchwork Mon Jan 22 12:38:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13525414 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 68A70C47DAF for ; Mon, 22 Jan 2024 12:39:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0081C6B0092; Mon, 22 Jan 2024 07:39:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ED2906B0093; Mon, 22 Jan 2024 07:39:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4C2A6B0095; Mon, 22 Jan 2024 07:39:09 -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 B9A926B0092 for ; Mon, 22 Jan 2024 07:39:09 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 74E381A099F for ; Mon, 22 Jan 2024 12:39:09 +0000 (UTC) X-FDA: 81706902018.16.4ECBF30 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf28.hostedemail.com (Postfix) with ESMTP id D1DC5C000B for ; Mon, 22 Jan 2024 12:39:07 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aa05kvtt; spf=pass (imf28.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1705927147; 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=8CJ3I/7LDGs8hexTud6zRTfvlS0atGDHH81M3ADEHcQ=; b=NotVkabpmm46vrRwTWuvAzbjQuVHZKYItpgmlFdMmOqVeZIDSCC8xNVtmXH/yjJyDxLmBu fl+aVPUDiNnlRAWd5jkR+HrjK7ILCsiPqSXrJ8FZvtpTsp92ooGQEaVu6YYzy5eD9AvT0L h9f56FKoelbp/fpsVjUawU99TVFRIAY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705927147; a=rsa-sha256; cv=none; b=8j2YQIwpOTq1BVKH/lIOkKZNximFD8IZaURv5tJo1Q4WtJx+1LjvR9p+2hY8lQECKpLBYN UHUrSLTre9MO2LUAidAa/YoOcaeJPceCCoRdBwHNyJO3mJFL+aIoIAy2Z6zrxiOt8eNb6g k5O1OsiHsEhHr2YpUJeZNCMjXjReERI= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aa05kvtt; spf=pass (imf28.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705927147; 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=8CJ3I/7LDGs8hexTud6zRTfvlS0atGDHH81M3ADEHcQ=; b=aa05kvtt3HsTXHgovh9UtJ8kY/gRoDeW3PRBhkPLmL/HDWEN3FasUoBg78tnCGeJxNb5LY MU8fyureIawjyzoVd7nLqdTkSOixUvViX4RUS8rMRnGEld03yMoKrKzZfdtdi64KQNYCZM hpeT65/vk8E0huiGp3slLgBlt6GvxKo= 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-277-IYJ33U9IOce8J_5Yad4F5w-1; Mon, 22 Jan 2024 07:39:03 -0500 X-MC-Unique: IYJ33U9IOce8J_5Yad4F5w-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 6003885A58B; Mon, 22 Jan 2024 12:39:02 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DE802026D66; Mon, 22 Jan 2024 12:39:00 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, 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, linux-kernel@vger.kernel.org, Dan Carpenter Subject: [PATCH 04/10] netfs, fscache: Prevent Oops in fscache_put_cache() Date: Mon, 22 Jan 2024 12:38:37 +0000 Message-ID: <20240122123845.3822570-5-dhowells@redhat.com> In-Reply-To: <20240122123845.3822570-1-dhowells@redhat.com> References: <20240122123845.3822570-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Rspamd-Queue-Id: D1DC5C000B X-Rspam-User: X-Stat-Signature: 4kr3hzsx8cxxpmygu8ge1bbimcxrrgqp X-Rspamd-Server: rspam03 X-HE-Tag: 1705927147-778788 X-HE-Meta: U2FsdGVkX18uP4DWswZT1t/d8dFcW0p7ZGc/Tgb26BY3O6kPved13IRm2Lh2+eoevQ4t4DwdSMDrk8Im0OvX5PCC6eA0ZqNCrBLMs2SrCYtpZjTo8xsmjOnahmtGkaUl5D8eu85IzjZsB2Jc2Zx4KmwTsIRFetlTjArbQ4DU+V7laVkFTIwom2dTtwTjMvIygmG+W3ON4OUug16mRlvsLTUeSYuERpperRrZ01FnZ0SoCLZYMrTKku3kicOW8yP96iXSqyCj7/PDTe2Op3sCEkr5f96yMQhz12kOERR5moIgcBBKOohHhsaqibaMPAscMO9yAg3UVgm9DCSb6HKIO4JnRtCNmC+FjsZnQhakJ7cyX68rOXRwk7sHUnL/YkGjLgFpPKVEiC8lmOISdgkgnnRWJ2vCFldgtan1LBxftYN1YB1k47bdgMTdGX1IagjGpSt4XGeY41YTTjZI5u9jEmju7hzv9KiA4fIWD1Ke7NeYu9ZsOUWd5KzVC8enbBO5KvAekDIfgvNFvjB9dTEq4YapZhzCKAZ85UIve6oySeLaphB8M/QZ8akS2pQI4jzanrWmkVO+6WTUB/bYsDC9MVJLbSrM62vdDz+RDDS5ZBNqJ+c2+xR76Smn7OdnKNexICLyRR/8PDyFO+NBeY3vIIqidQxaDn8268uYesw1RwiJpnbexhFaQMobJb5EyAo5PFb03MUUXJsiGkZFBEs21KpnQhNN1tkikUHhmK4X5GLPYkY+yPMTelRMy5VSZMCSaLS73PD52MJevi/ZCsKx+t59gS8RY6PuLPApfUH0oQSqyihQ3o3teDn3OovPjuj7DSaQA1oaHoMeDDJQVwFZT10A/Sx5UhjNiA661YQKncVJgTCykaJKBTtrxFoB56e3NqugApzSHH9UGlrGslLNIxHnYYxV04fcPWQRP6TB+5FYEdNkmqhI+cIXXLxXhntU4jJKwDnNVV98o5fAwuu N9H2y0fU 3gw8Y8GfBx4Fj3gUNG+rOKpZfzYQB1rpRexUgVheUCqyoS+P0+/EAiSZxRUFSt8QvEpcoe+4A7FYZUSCTtSF2e6Ha3XhIpkUirHKK6QDCQFfSrr/XfXwBfLY+8kGMvRxpEmhvJy/Q6G+wc0ZztD0tIVRudToGttXhBt/Hqb69e45HLPSUxtyC9DeRUUoS09CpuQEeTo1ZZzneKfNNkVO42OHSCihlLAw/t4IX1TIHF9tWyyBoACrNWlQZ2/y8u+uaM9rq2nJf9nz9gLsZ2LuDkWHF2yao/orgSo5snFWPpvkMpC6JnpH5aUioPlJs7bYZK0Wl7ubwFNIZKsWKbbSnTwofVg== 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: From: Dan Carpenter This function dereferences "cache" and then checks if it's IS_ERR_OR_NULL(). Check first, then dereference. Fixes: 9549332df4ed ("fscache: Implement cache registration") Signed-off-by: Dan Carpenter Signed-off-by: David Howells Link: https://lore.kernel.org/r/e84bc740-3502-4f16-982a-a40d5676615c@moroto.mountain/ # v2 --- fs/netfs/fscache_cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/netfs/fscache_cache.c b/fs/netfs/fscache_cache.c index d645f8b302a2..9397ed39b0b4 100644 --- a/fs/netfs/fscache_cache.c +++ b/fs/netfs/fscache_cache.c @@ -179,13 +179,14 @@ EXPORT_SYMBOL(fscache_acquire_cache); void fscache_put_cache(struct fscache_cache *cache, enum fscache_cache_trace where) { - unsigned int debug_id = cache->debug_id; + unsigned int debug_id; bool zero; int ref; if (IS_ERR_OR_NULL(cache)) return; + debug_id = cache->debug_id; zero = __refcount_dec_and_test(&cache->ref, &ref); trace_fscache_cache(debug_id, ref - 1, where); From patchwork Mon Jan 22 12:38:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13525415 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 D2102C47DDB for ; Mon, 22 Jan 2024 12:39:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6BF7E6B0098; Mon, 22 Jan 2024 07:39:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 647786B0096; Mon, 22 Jan 2024 07:39:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44BB76B0098; Mon, 22 Jan 2024 07:39:12 -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 2964F6B0095 for ; Mon, 22 Jan 2024 07:39:12 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AD5F01609B9 for ; Mon, 22 Jan 2024 12:39:11 +0000 (UTC) X-FDA: 81706902102.28.B0C2ED5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 88AD780009 for ; Mon, 22 Jan 2024 12:39:09 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TEvMj8HX; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.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=1705927149; 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=dTDK7i2Q4hPQnzfb2SdByLYJyeMyokMSiVdAUDeKcK0=; b=DC+e9PAb1Uer/WgjJ/hHBNHRsaD/Paue+DIRm3O8dB8Q3VI1m1vKk5ZXdrApIgeFz39Fvy UQ4wnTO89k8loFEAY1BN+k+V/AQCnUzczVhs/FVa2tzUsxHXgZ6a1CWYnDfAvp1QM7IHsq N5yxeKf2wTdiQtop2fHTaMtbjz2Dkhc= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=TEvMj8HX; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.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=1705927149; a=rsa-sha256; cv=none; b=dugba5IOPokDPrPfSRERgkvoQj63lZl0geQcswPpcgVCHBsOBz2LtojRS/TCXsDh2jkq80 i4/EFnuQ856DzR2uADvXs/r3jXAZ7jsiMCz00U27SjJnGWIZJ0pLX7r+eS/Ps3QEL+NrhU pyMbK+oQs4k6Rx9M2DanKfiCzbTpHQI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705927148; 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=dTDK7i2Q4hPQnzfb2SdByLYJyeMyokMSiVdAUDeKcK0=; b=TEvMj8HXj/L8//b6jjhQO5Lbs7kyxFqCc5qECJqWXGxL10zzuuUU+3B/Ga7z9lT4CRKvks nxeOlk5zuO/oGMqv709sTMLETlJ9Hr6j1xjaQfX2riK1IGp28eHnlH5iGEzI1b6LmtBGEa m28t4p8ApP/i8JOkN8ibU49yF9Tgc9g= 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-413-_plndR-FP8mhZbkTFUOBNw-1; Mon, 22 Jan 2024 07:39:05 -0500 X-MC-Unique: _plndR-FP8mhZbkTFUOBNw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 DC08E1064DA3; Mon, 22 Jan 2024 12:39:04 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D2471C060B1; Mon, 22 Jan 2024 12:39:02 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, 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, linux-kernel@vger.kernel.org, Dan Carpenter Subject: [PATCH 05/10] netfs: Fix a NULL vs IS_ERR() check in netfs_perform_write() Date: Mon, 22 Jan 2024 12:38:38 +0000 Message-ID: <20240122123845.3822570-6-dhowells@redhat.com> In-Reply-To: <20240122123845.3822570-1-dhowells@redhat.com> References: <20240122123845.3822570-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Rspamd-Queue-Id: 88AD780009 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: m91dnqypa3ygmdcjii6skhzppu1kxrfs X-HE-Tag: 1705927149-2978 X-HE-Meta: U2FsdGVkX192H8gYaUxAwjjCGyx1MtxYg2PZiVSXmNFX4EKNPOmMAH/d6y+7EzeZhCZ4gvtoWfsQzTlFhB4qGH4J9oyAisI0OU1m/rP/GWZEMg8sJ9rFeJxcvYH98CmacVItO8VnZwJ+LuqtQ/9rCyFnbH4FPgagkoakPvKeIVb7ykn8w+AhMRT89wMu1hHm+Q2kKiecFgWmGzIWTkzYlo0YTq3NZEJ/u1yoA9EMQ4wX7WppHeApvJfh1HSSvrIVE66rGgYIzyze1ciT3LtO9Gms1Ktdy4M8KzXjLyTzxMSkUT3xhrf1di24TZeSj1QCxhSAClSMRyTmLF/gjtbCQnjZ9MkodbVzKidaQ2N7uVyYSY2j/Vnk9xrqqkMCI/c9kHaS0d6FJ+yQ7XQvHVhFW/SfWMOg5UEKmv7lIQC/F3qNPUFmpSq4j4KQr886s3RCGtzpJMARgE4HLyueC41W/qDMDdUT+U3iuiDv04hpB9KU/luTqzB0VzczdXBdeF2vieS4pRdV7tshkTnNKA2WC/zr4YiD+ZGyZMDKMa35wteaAKBWzocOhJbN4hgsoXrL1Kb51JWq7egsCVATjwhuF4cxeMWs+MdXRcckkmdr9eTmiU1iYCKIjnAZfzOIAQAN5eRYq7/6U/0Q7HfMRPw0JtLusuwszLBuRbUppmno4V1llyja2H1cTYeUWMe47qUz9rZfG9L7TYZ6A1m5hjO2+OxBzWrKdfuRdrbfDxe1TB6fvOokUcn6LF/NicXSlq5xvEN+fMNETIFQwOiB6IcOjJwYZSzkFg2+w47LW0GXeT4rw2zwgahHo1KJImmippTo6l8BHxH+cZXDHaYGE9zrtFLCNZrd7AHGTsyhGd8uM4e+mESC1k+fQOmAntAdrK8EnsceJ49jEPyic4OKGLIDbVjJHH/8eb2ULpEkbgTt/WENQ8IU32p8Ez/pPkuDSP8YKEyjKhPXvm0O2Jlv2Tk vtD7sj3U t/aARvYAiiRxQuPcMehB/K4S8AqmWo8mYd3JwdTcQtsrTSM9ZMQmNPP8XWRXXvRNxGMmxdq54HKiooUmZ8tMnL0sdHXrlVOszipn1aOlUdZRUEZBC3AL5A8dQ3amE4bn7AEEvSvmOVF65OVcfdyJY1ZTWZyTlgRM+Vb48pkzgK2jXU4w6wxNPGoQb0afwLyfsuXFlPODum8XVRvCTKR0ztQ5/xA4woMMe9784GPqoYdGO/OA2aTSeEZrRlCyAtybufb/0LKI5ksJJmNOxqUJRW7O/cULT1X/Af58JWRHm6Z4v6zqjjr786YhSsUNG738M90kfU5f0gXSSvoN6kmWEKQnaTq9Hv0V8qgHV514GnLRVTuA= 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: From: Dan Carpenter The netfs_grab_folio_for_write() function doesn't return NULL, it returns error pointers. Update the check accordingly. Fixes: c38f4e96e605 ("netfs: Provide func to copy data to pagecache for buffered write") Signed-off-by: Dan Carpenter Signed-off-by: David Howells Link: https://lore.kernel.org/r/29fb1310-8e2d-47ba-b68d-40354eb7b896@moroto.mountain/ --- fs/netfs/buffered_write.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index e7f9ba6fb16b..a3059b3168fd 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -221,10 +221,11 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter, if (unlikely(fault_in_iov_iter_readable(iter, part) == part)) break; - ret = -ENOMEM; folio = netfs_grab_folio_for_write(mapping, pos, part); - if (!folio) + if (IS_ERR(folio)) { + ret = PTR_ERR(folio); break; + } flen = folio_size(folio); offset = pos & (flen - 1); From patchwork Mon Jan 22 12:38: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: 13525416 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 1A49DC4725D for ; Mon, 22 Jan 2024 12:39:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 515876B0096; Mon, 22 Jan 2024 07:39:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B0866B0099; Mon, 22 Jan 2024 07:39:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DC136B009A; Mon, 22 Jan 2024 07:39:13 -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 F15596B0096 for ; Mon, 22 Jan 2024 07:39:12 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D1E51A09C2 for ; Mon, 22 Jan 2024 12:39:12 +0000 (UTC) X-FDA: 81706902144.21.18FB0F5 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 277D1A0004 for ; Mon, 22 Jan 2024 12:39:10 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=AWT7NrTb; 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=1705927151; 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=iici4CcialH0lyfTdSLWnoYWTya5IEpmfmLuwHkca5Y=; b=z88qebsF/R5TYYtzF1T8GdjRH+MafvYVlWaM4ajO/+k//kZg/BRG4ooKCDYXeHzw35ZFme 7C30HVFtDgLUC66BHdMoViXKs1pEAaz165C54qRwli1TD2uoNR8yLuIX5IIqNm40MTrFVC zTp0qsWkctSbYngSg2sXg8kjp8BrxYc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705927151; a=rsa-sha256; cv=none; b=1hhOhgHEIIPqHoZakBlArhq4nYDJ0jpmPcpzdq3QzLJrFNB9k1W2350CKhh0DR7Bual82V lwYlt9xhoEWZS67eaOPRXsgXinHrWKajcjRA/yedc0YKa4oIBJiSWvdDxCt0RZhtgVvFkk f5dX7eE6kmu4v/uEXlCO9mkKbj4+r9o= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=AWT7NrTb; 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705927150; 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=iici4CcialH0lyfTdSLWnoYWTya5IEpmfmLuwHkca5Y=; b=AWT7NrTbsZhWKdq1S/kzf2gIRsFA2virrEQU9NGA7D9eWHVtRsK6dCIj4eVJLH0EJ07YO7 UPNY792Bo41wB/FdMirOd+N91cohAIZ8+ggDYF2BPjLq9ZgC1wiTejC61OB2UZzAQzFBxO j2M8vei0EsLhkLsigj+h2kMTEl6VueU= 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-304-nqfuXrHZNCS78rn85yiyNQ-1; Mon, 22 Jan 2024 07:39:09 -0500 X-MC-Unique: nqfuXrHZNCS78rn85yiyNQ-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 0A9D51C05ABA; Mon, 22 Jan 2024 12:39:08 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CA3E2026D66; Mon, 22 Jan 2024 12:39:05 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, 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, linux-kernel@vger.kernel.org, Marc Dionne , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu Subject: [PATCH 06/10] cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode Date: Mon, 22 Jan 2024 12:38:39 +0000 Message-ID: <20240122123845.3822570-7-dhowells@redhat.com> In-Reply-To: <20240122123845.3822570-1-dhowells@redhat.com> References: <20240122123845.3822570-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Rspamd-Queue-Id: 277D1A0004 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: scb5fa3t9atk53h3876hfca4heuquexc X-HE-Tag: 1705927150-190071 X-HE-Meta: U2FsdGVkX1+2Qm3n3YgCdlv3Bal/yM5aVQdwRin0EmLE/RhzEPeDOz55rZfEBuSp8cB1tp2XxfVoK6F92J02ZfqeAV0rktFaaAWsGyvVvg+ZrKVcepaaPU4SptmDNL6yUwLINtzrddkMjcD7SlqmGJLs52iZpwoUk3zUXiy8+lEhzUYtZxC66ZnJSc7CIFJFsP3tpyF04u4dDj1jBUaBSWOCCq6vmF80ecordsFLJZn4rWaTcFNUdArRZRbSn2taTwIWSf9d3Y4IvionokGvyoZgPDFbbF11O9L9D7/TT46qHziV6FiGBDzxgahzgSUEBVaWbjjjeWHAjn5xtFiTTlxYQRZ3Cs3sLoJ55jnX/o5bym1/uP32haH1OsqLRtZoLZaQ6qi+RIe7ynFX3DmSAESShI1AVYF9gUVGNXVulkjZyBLaANiDVcdDP94Y85+vnapHk0AwaKUSMBix6xRBSLqYv6cqoc0ihOsept87b7Vk1ZILBN5HaO13t3ENBSG/KvATyeT07kNLdBg+vlI+bGj3BzvQx5Zf9fMytSbo8IQU/2r8LO2giy1r5N1DntpbVZ/NzFNhk8xYOh0QNJECRAEkAnk8UvQd4TX/8aefa/glL1FdBr1Hcrk6YRj9+XN7PlFBb+3rw96cQQpM5Ys329O3xgia4DHvjZpxJ/PcgJxFIKDWizq31YaIlh7P4hHabr0G88f6LsesEOH+S4pyvF4mR6dsLyF6oKQXAAQAfOq/YLs5f3W1W/LRZDpKFXLTid6wBjUGXGMEAS+jSKnMFTbYRYu3uVzuBgKxmNq5YSS/2agsc5NssgYTxo6zfdCRA/64sDzgbl3Vh0d44EXBMW+oPLvWFOxOmliyxs4GPGFt/8UyjbslGEC+OIQaG9tNls13MjABJlLP9cRLdxKxx6JljrwfsUwPJMnklIjh4kZEPULhPIAIHX1eKPIHfvJLkg30dZrTgM9YJ/KZ1+w yIVYx5F+ T4+sLNXozbWx7GxQMaXxZkEFWWFaHI8BAIDV9ba3V93VxzBdAdmW+u84EnJ8XXhGZHqfQnjZ4W72pZasPBCbYrkvh5QhdjyjZS+AR5ICPD8pPGjEtng5J7xGhrvMjdB8nS1HxrlhVA+YWi0uwJiWLQGRQFVTh8RONz4qCt7x7OtpWKt64TMGc6S070FZsJz65kq3q1faV3VL473BzLBrSC8rVPh43a7dbrY6pgvLBQQbvXSBjtt8qbTgnUu0lasA+6kCiJTLol7pn/i8ZyxrZ/xsu7H419oZlYadKrD04Esha+r1B8dd08W1hNxWTAArbDNzm06iSTpyJCuo9qPiF36YTTJ4VYYLQvOR1/03VrvyjE8y+Z9UYflbu3FrA1rv1LeVo8MtwLgsMfHHpBO77Aa6bFRahcroBjeUB8DBbEZjG8QkcC86DRhvh1g== 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: cachefiles_ondemand_init_object() as called from cachefiles_open_file() and cachefiles_create_tmpfile() does not check if object->ondemand is set before dereferencing it, leading to an oops something like: RIP: 0010:cachefiles_ondemand_init_object+0x9/0x41 ... Call Trace: cachefiles_open_file+0xc9/0x187 cachefiles_lookup_cookie+0x122/0x2be fscache_cookie_state_machine+0xbe/0x32b fscache_cookie_worker+0x1f/0x2d process_one_work+0x136/0x208 process_scheduled_works+0x3a/0x41 worker_thread+0x1a2/0x1f6 kthread+0xca/0xd2 ret_from_fork+0x21/0x33 Fix this by making the calls to cachefiles_ondemand_init_object() conditional. Fixes: 3c5ecfe16e76 ("cachefiles: extract ondemand info field from cachefiles_object") Reported-by: Marc Dionne Signed-off-by: David Howells cc: Gao Xiang cc: Chao Yu cc: Yue Hu cc: Jeffle Xu cc: linux-erofs@lists.ozlabs.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org Reviewed-by: Jingbo Xu Reviewed-by: Gao Xiang --- fs/cachefiles/namei.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 7ade836beb58..180594d24c44 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c @@ -473,9 +473,11 @@ struct file *cachefiles_create_tmpfile(struct cachefiles_object *object) if (!cachefiles_mark_inode_in_use(object, file_inode(file))) WARN_ON(1); - ret = cachefiles_ondemand_init_object(object); - if (ret < 0) - goto err_unuse; + if (object->ondemand) { + ret = cachefiles_ondemand_init_object(object); + if (ret < 0) + goto err_unuse; + } ni_size = object->cookie->object_size; ni_size = round_up(ni_size, CACHEFILES_DIO_BLOCK_SIZE); @@ -579,9 +581,11 @@ static bool cachefiles_open_file(struct cachefiles_object *object, } _debug("file -> %pd positive", dentry); - ret = cachefiles_ondemand_init_object(object); - if (ret < 0) - goto error_fput; + if (object->ondemand) { + ret = cachefiles_ondemand_init_object(object); + if (ret < 0) + goto error_fput; + } ret = cachefiles_check_auxdata(object, file); if (ret < 0) From patchwork Mon Jan 22 12:38:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13525417 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 D5566C47DD9 for ; Mon, 22 Jan 2024 12:39:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 671636B0099; Mon, 22 Jan 2024 07:39:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D4496B009A; Mon, 22 Jan 2024 07:39:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B04A6B009B; Mon, 22 Jan 2024 07:39:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 227286B0099 for ; Mon, 22 Jan 2024 07:39:17 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id F3CAE401DD for ; Mon, 22 Jan 2024 12:39:16 +0000 (UTC) X-FDA: 81706902312.15.4124BF0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 423301C0019 for ; Mon, 22 Jan 2024 12:39:15 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=H9SPVxQH; spf=pass (imf18.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=1705927155; 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=AQmuqxaeIGZelSODTss8gWd4P9SrQf4vDlsO0SnTpdE=; b=P6nVjuqP2GEq4CVqpJzwywlSwi+z3P8KvZ9HaYhX059aQ6L0jTfXoeVe3AUM9q0Fh3IuXA tmLXedObSmTCJf57OoMlEmwkH45tZyph8bkT46AXgQ/jT0vkH1BmFyAXv+L+Vlr4x7tF5X JtrNQYZ5b2SRFtl3FMWQ3+TO26LQ25I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705927155; a=rsa-sha256; cv=none; b=JaQhIhQXzltTFeJNzXO4KPR0Bcmzxr+JpuKMZr/2pnGHbQQe0A7FW16cPUh4OTtcYP4RUX R3LsD+aVklRzB2sLTYI5bFBUNH1eYF4JkYjcI+RwYN+pCcz6/Gz1pc5zOEj/TCph8BfFi9 UovZTGEvyncFqmN0Vy3MsJI1RM/OkGw= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=H9SPVxQH; spf=pass (imf18.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705927154; 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=AQmuqxaeIGZelSODTss8gWd4P9SrQf4vDlsO0SnTpdE=; b=H9SPVxQHF/T8m/Xg+PL+h0/sOVy8oYrsGttidz3Hq+ydhxd/iAAaPizagU+DhHRnlhL7jc SekqssKcun8UCdkE0f49aI+qkRItTxyeFNy5tbZnZAHBA0HLrOxKh5xIWmmUzkAwC2Yv89 S8fLxaRKhTZnvioTzhz1blhnFRME3Us= 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-494-LKHoZoERMie5-61Ndg59yw-1; Mon, 22 Jan 2024 07:39:11 -0500 X-MC-Unique: LKHoZoERMie5-61Ndg59yw-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 958913C000A4; Mon, 22 Jan 2024 12:39:10 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id A65D8492BC6; Mon, 22 Jan 2024 12:39:08 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, 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, linux-kernel@vger.kernel.org, Marc Dionne Subject: [PATCH 07/10] afs: Hide silly-rename files from userspace Date: Mon, 22 Jan 2024 12:38:40 +0000 Message-ID: <20240122123845.3822570-8-dhowells@redhat.com> In-Reply-To: <20240122123845.3822570-1-dhowells@redhat.com> References: <20240122123845.3822570-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Rspamd-Queue-Id: 423301C0019 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: yaqpj9idpccqnpb6dbwbz8kuy1f5iffo X-HE-Tag: 1705927155-512709 X-HE-Meta: U2FsdGVkX19qGaRyGRcpFqiE582uLqhO3zFaNBeaajwzRkl/98XwY9FKPcdFVDFrNUT+OZhKIEjqfn3g+uXs38afDxuKh5/0SBHWwNdlCXaaCr0z2HbiK9Zroby8YopyNaGtV7oLJbXCbIvj8+yG929m+2WwJqMU7u3jvVbqBayv158yYEYb9QFJOraJSBVRQ+VL94hNDI0M8QeR8oRjcSOVe4f2kjvMf6NmdUAL8iSAroL0scByk1ZYCYBZc1gvupjNpS7aD/DjQv6DD91pwWMWlHJW4Hlsy2i571JfLmGH7w7MKFfV6TruPOCZxxjjVWlIck9uPaJMjAqG2zzsCMYBXadWS57z7/rFvGrE5QqsaS15YkyFW+6JMSDjT7S4jloxukNHF3l1qEXUaWLhVmvjBlp2kmeJlwGcQVJjL9RMjx5MWf7/R9Va0pc9x1U5EZL4k3h+V0yOMDzJh7f6qCkNNDbdPIlKs2ziqC9cZAYLJ1cK7cUNnF2t2bIaDJYvJDEDOaTqs7zV9Wkxti/e8nyySm4qTRL3alLoRwAmmzGc9VTY5dz3bwMTEe3YqiGWaFR70cSGL7AN58UUvr1rjX/gP7B9Jv+i34cvxircc9jGDQkJ7T5e+1ypVDB05ezuIulVToWGhp/crCwN8zZNzSfu9R+5/P5SCk+Wthc8BfpqoMjcTombb5f1PgsvnD8MDixbG36ATQebnerPbpfyxiAOPF1wYBnx2AIpgcc1tj/+hvr2x3gEEK0tliQQqrTt3FESwK8pKBR6GROYwaCIclJaTUZa4LBRQ1XREGxElY138RMUvgdl8swgm8vu5QMbKgDldnB9W/Wovbu2OHtSAl0fSphaZ1d7HPoByvzuL3E3s9IHwXKlw3LG/R6dtGNxHvnszF8HVNuZ0gXSIOvFIk1blzJj4RJaRezbD9BXUk/UDzAh3yyQ0i1sWT7zBcsOpbrRRZ8kGexsIpHqvdP fHdOgYTj /HJZnH2p4wYXzZBfIKsu5CzyW7PXwRAYaJDJs1XHS3iiRFTPmkJHpKxRISPmVNLXjcWYZrIcCpbGRjWQr94oLZBiIpkm6ZRoROyBeKJAGVQwEiqvkkSjcQMCeLWiqSRR00t0WDRQ/ZB1nZqHMFtytDtEnPN4kp4UzreZp1EgzUy/hryhUyWHgzPM55EtF1FanZUAo+Q3Fa9fJcZwqTnQ9aG2uX2OchkmgX+SHvGjnfwo7OwqTd0qNd6KfzcCgLB5lyedT+lWkpI7/6K9FBes71UY9wXs+Afsi3lDbjbpQv9ogO/g= 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: There appears to be a race between silly-rename files being created/removed and various userspace tools iterating over the contents of a directory, leading to such errors as: find: './kernel/.tmp_cpio_dir/include/dt-bindings/reset/.__afs2080': No such file or directory tar: ./include/linux/greybus/.__afs3C95: File removed before we read it when building a kernel. Fix afs_readdir() so that it doesn't return .__afsXXXX silly-rename files to userspace. This doesn't stop them being looked up directly by name as we need to be able to look them up from within the kernel as part of the silly-rename algorithm. Fixes: 79ddbfa500b3 ("afs: Implement sillyrename for unlink and rename") Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org --- fs/afs/dir.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 3f73d61f7c8a..eface67ccc06 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -474,6 +474,14 @@ static int afs_dir_iterate_block(struct afs_vnode *dvnode, continue; } + /* Don't expose silly rename entries to userspace. */ + if (nlen > 6 && + dire->u.name[0] == '.' && + ctx->actor != afs_lookup_filldir && + ctx->actor != afs_lookup_one_filldir && + memcmp(dire->u.name, ".__afs", 6) == 0) + continue; + /* found the next entry */ if (!dir_emit(ctx, dire->u.name, nlen, ntohl(dire->u.vnode), From patchwork Mon Jan 22 12:38:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13525418 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 9A247C4725D for ; Mon, 22 Jan 2024 12:39:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A0E58D0007; Mon, 22 Jan 2024 07:39:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 22A1C8D0001; Mon, 22 Jan 2024 07:39:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 07C6E8D0007; Mon, 22 Jan 2024 07:39: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 E34A38D0001 for ; Mon, 22 Jan 2024 07:39:23 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C29CAA1D52 for ; Mon, 22 Jan 2024 12:39:23 +0000 (UTC) X-FDA: 81706902606.17.1FFA70F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 2145F20006 for ; Mon, 22 Jan 2024 12:39:21 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PA9gAr7O; spf=pass (imf13.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=1705927162; a=rsa-sha256; cv=none; b=481RvSQAeO7qND4NmA9Durw8ZVDdoT0uSoBVrhoDXPm8Xil2+xdl+wHvLeQycrOFaggi+b PqsiyI4cEZZuwfvKVlSgxFqrhvNs/rl6iFcyoVxmZNe4ynQof1LcpeCS+g/g3C5uT3Rc90 HLEUuWiLCtE4XZ8VbnDQF4/uRjbF2L4= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=PA9gAr7O; spf=pass (imf13.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=1705927162; 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=+FTT++75kJXAyd2owaIPHDCXA7EuMAyWq5EQhzAnWG4=; b=gCSpCAcXqTu7Tmt4GLjVkNWvUeveC29wMY1gQxuBJteQSmlccSQvlfBHZrbI++ur8WEDtY jMW/JWMeFo9zXBvoU1AiBym6Kszta7c0wiKOM9PEsPIqnRzu+wciznBZxDjCfDmsq/MmxU nXiNKkbKi/DPGoA0O0bwV/ivddENPsc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705927161; 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=+FTT++75kJXAyd2owaIPHDCXA7EuMAyWq5EQhzAnWG4=; b=PA9gAr7OIuqAcEmhuv1QfIt9rGov33qqGffitUiqNyb+CNuWs3dLbFbySdhkKui7IgGL0g sPZT+XPKEp4wp5yY1LzjJAjiYYEmCHbnvHXjcQdPWt9fbXl0NsS6/y0J9vXCHKuNi6VJjN HEw4r7CwdF4SlKgX4xIAobOU617jtCg= 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-500-DdMXm9N_PYeHTA5eKTR1gw-1; Mon, 22 Jan 2024 07:39:14 -0500 X-MC-Unique: DdMXm9N_PYeHTA5eKTR1gw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 47D1F88D286; Mon, 22 Jan 2024 12:39:13 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 573461C060B1; Mon, 22 Jan 2024 12:39:11 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, 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, linux-kernel@vger.kernel.org, Jeffrey Altman , Marc Dionne Subject: [PATCH 08/10] afs: Fix error handling with lookup via FS.InlineBulkStatus Date: Mon, 22 Jan 2024 12:38:41 +0000 Message-ID: <20240122123845.3822570-9-dhowells@redhat.com> In-Reply-To: <20240122123845.3822570-1-dhowells@redhat.com> References: <20240122123845.3822570-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2145F20006 X-Stat-Signature: 5fd4tjqqor4gtguaeui9xcyxcbfo54qa X-Rspam-User: X-HE-Tag: 1705927161-49940 X-HE-Meta: U2FsdGVkX18wCBS7Rtk7VVkBPn4102/ZvxczfiXbXaKuT5cRnr+M45ZMhZ5aF97ymbWmvUuB2a5AW4QBaYC9fqECMNaATZ2furfB1hQRIUApMfMGtCqZJqiKV+j3s1SFDKRXyH67AFl5+SRFtzaIjfK7cv8sXH4JKNkSRpoNLpK3yfv5Kuozc29akRaX1f6Qi09l+7ye6cBiuNZGPV14PTE7I3gOdvKrPx1//Tw+Cw4mjXTxm4vSLsdhjyvnOHyTU4n3Ms+8d4+9g83Azl5dqVywEAs8jeqzvAiQ/hbwYcUt11E7iNfu6OaM7QFo34tUjMFYl5s6vsrAy3uqB6xWMGdbrmwM5LPNIXVJhvAJvckRLcZScNUiAB3MIc7B03U7Jn7aoDZv6LkOZoHDhRoX+9j4JtZpPS/1ctg9TKXdlbHGIEU9qlUmXUvFhnYAlRQ8h+okoFyn5CwYOPH3Mr/UU3wIxcqyLkjqYuk1pxVYqbJiLAbwlqvW03AquSUIQBdTGTDlWmwUisL+j3fr+72kPoFCQeHzEfK9s+uVcNO5YFifNQV1vCbbfAXikK+HuIvyDDkJ+Y92ji7b3caJ+VJujsSC05JpedNCHKBG9TTXNOk+J+xkEkWh1FRUzVCjIVr80iQljEMRMG2ixnlFL35acQnasHZ9QlfEjBEtLxDb2qwnE8uedg73PB3VrSDO2XHmDqJo9EpRcXIeEhENeUmtwDCvJNsnBfIeBFVYEC57BBJJSPBcIRSEjeyow8Ce58wByrYW1qs9M4bnZUCWoLSQoTc78PndPGnw5v3HrqiT3MmoeWq62Rxj0lccHUGGkdNKuf16yx+eJTXeTvoZwC6scU6Anvk+daV3XzgGHJxJ+dWkzwDvL4q0TgOEbRFDDQaClzmBF4k4AqD0eriUjsShXwt53BcvLDr3s/ti3zXQJGVqkuN+4LqbIrU0aMLY3jFN0IsdRNZUJrUAXUxmTyl 49/yoHAa PokijzHb1G2/ZepvfPwlTqdZ+RALmMkHLN2CVEvp9N8ZYqXf3CpQBrawzG7QN0M1cxzSSLo6wKQFsjRZiv9Hb908nuQHedcC7Xkz94dKU946KLs+QKOBoa8FsR+hpgU3GROG7UG+zVm8BpwMtszUsJyO2zjLKrM9i5hosg8KL14RPpGrj7aII7OeBC+HXSmr0Y6wrWqCcg1025b0X9E6kzIekhbb/ysAR+84fUq2yvHuwk5Mp+sEjEtkXseJw75O84J6DD/TgIwqiyfoZJVMXNXUcP87Niyb9hU4gTL2SRRRbthw= 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: When afs does a lookup, it tries to use FS.InlineBulkStatus to preemptively look up a bunch of files in the parent directory and cache this locally, on the basis that we might want to look at them too (for example if someone does an ls on a directory, they may want want to then stat every file listed). FS.InlineBulkStatus can be considered a compound op with the normal abort code applying to the compound as a whole. Each status fetch within the compound is then given its own individual abort code - but assuming no error that prevents the bulk fetch from returning the compound result will be 0, even if all the constituent status fetches failed. At the conclusion of afs_do_lookup(), we should use the abort code from the appropriate status to determine the error to return, if any - but instead it is assumed that we were successful if the op as a whole succeeded and we return an incompletely initialised inode, resulting in ENOENT, no matter the actual reason. In the particular instance reported, a vnode with no permission granted to be accessed is being given a UAEACCES abort code which should be reported as EACCES, but is instead being reported as ENOENT. Fix this by abandoning the inode (which will be cleaned up with the op) if file[1] has an abort code indicated and turn that abort code into an error instead. Whilst we're at it, add a tracepoint so that the abort codes of the individual subrequests of FS.InlineBulkStatus can be logged. At the moment only the container abort code can be 0. Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" concept") Reported-by: Jeffrey Altman Signed-off-by: David Howells Reviewed-by: Marc Dionne cc: linux-afs@lists.infradead.org --- fs/afs/dir.c | 12 +++++++++--- include/trace/events/afs.h | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/fs/afs/dir.c b/fs/afs/dir.c index eface67ccc06..b5b8de521f99 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -716,6 +716,8 @@ static void afs_do_lookup_success(struct afs_operation *op) break; } + if (vp->scb.status.abort_code) + trace_afs_bulkstat_error(op, &vp->fid, i, vp->scb.status.abort_code); if (!vp->scb.have_status && !vp->scb.have_error) continue; @@ -905,12 +907,16 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry, afs_begin_vnode_operation(op); afs_wait_for_operation(op); } - inode = ERR_PTR(afs_op_error(op)); out_op: if (!afs_op_error(op)) { - inode = &op->file[1].vnode->netfs.inode; - op->file[1].vnode = NULL; + if (op->file[1].scb.status.abort_code) { + afs_op_accumulate_error(op, -ECONNABORTED, + op->file[1].scb.status.abort_code); + } else { + inode = &op->file[1].vnode->netfs.inode; + op->file[1].vnode = NULL; + } } if (op->file[0].scb.have_status) diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h index 8d73171cb9f0..08f2c93d6b16 100644 --- a/include/trace/events/afs.h +++ b/include/trace/events/afs.h @@ -1071,6 +1071,31 @@ TRACE_EVENT(afs_file_error, __print_symbolic(__entry->where, afs_file_errors)) ); +TRACE_EVENT(afs_bulkstat_error, + TP_PROTO(struct afs_operation *op, struct afs_fid *fid, unsigned int index, s32 abort), + + TP_ARGS(op, fid, index, abort), + + TP_STRUCT__entry( + __field_struct(struct afs_fid, fid) + __field(unsigned int, op) + __field(unsigned int, index) + __field(s32, abort) + ), + + TP_fast_assign( + __entry->op = op->debug_id; + __entry->fid = *fid; + __entry->index = index; + __entry->abort = abort; + ), + + TP_printk("OP=%08x[%02x] %llx:%llx:%x a=%d", + __entry->op, __entry->index, + __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique, + __entry->abort) + ); + TRACE_EVENT(afs_cm_no_server, TP_PROTO(struct afs_call *call, struct sockaddr_rxrpc *srx), From patchwork Mon Jan 22 12:38:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13525419 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 801ECC47DD9 for ; Mon, 22 Jan 2024 12:39:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 38CC28D0008; Mon, 22 Jan 2024 07:39:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 315F98D0001; Mon, 22 Jan 2024 07:39:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A1718D0008; Mon, 22 Jan 2024 07:39:24 -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 E07AE8D0001 for ; Mon, 22 Jan 2024 07:39:24 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 87020A09C2 for ; Mon, 22 Jan 2024 12:39:24 +0000 (UTC) X-FDA: 81706902648.13.149D87F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf24.hostedemail.com (Postfix) with ESMTP id DDE54180012 for ; Mon, 22 Jan 2024 12:39:22 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MDyTlcBL; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1705927162; a=rsa-sha256; cv=none; b=oa8t4VKIPUYJOPTDeWb1GBumGk6u6kure1Z9bOvD25gakFh5pz4gm/uAvrTs4QojlCe5uG +CAN0hlst5CqkOodjSJBCqmJhOR0eIalpZjYNrnpHVasoO4D+2j1eaTMObDhoud9mzgm1t U5f2wTvlEpXacQ5QAK0Qbi0RAkVtnrc= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MDyTlcBL; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1705927162; 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=4H/QyaTEJT6yM0W34T+DHhl8mPiadWYAfCey1J2x+wk=; b=yp0OApetbmNLh9gkaSV9BBuuMDEGUsgub8T/EpOhTpqOzEjK6JEoo3e+2AxgV8wrftPCbM ORJqLHiGMdPzZ3P9r71CEuRO7QQ61QENExTRfVqMwQoVjXGICg2JEne+ltcCObObxPSCz6 i+i6zEFTeV5++63h0rO7HGewCWEX9fU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705927162; 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=4H/QyaTEJT6yM0W34T+DHhl8mPiadWYAfCey1J2x+wk=; b=MDyTlcBLUFvLxJRMaRRUJ5yHQz9ZrXZzz5n6ya0KBa3H2ripCdbArJhztVtj8/dM1oDgyf 0FJ/fSq4NIuHTDFyJpQqCWKbt2QkSFAHLMwXpc+7+uiQatXnc41i7Vmum4qTuh9S9PwBVk 05jT4kAPHFWp8zjaUhaeBqqXuKuLimQ= 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-491-8WwqpJQRMMC-Y1cHcAnhdA-1; Mon, 22 Jan 2024 07:39:17 -0500 X-MC-Unique: 8WwqpJQRMMC-Y1cHcAnhdA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 2CE6688D286; Mon, 22 Jan 2024 12:39:16 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7049C0FDCC; Mon, 22 Jan 2024 12:39:13 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, 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, linux-kernel@vger.kernel.org, Alexander Viro , Marc Dionne Subject: [PATCH 09/10] afs: Remove afs_dynroot_d_revalidate() as it is redundant Date: Mon, 22 Jan 2024 12:38:42 +0000 Message-ID: <20240122123845.3822570-10-dhowells@redhat.com> In-Reply-To: <20240122123845.3822570-1-dhowells@redhat.com> References: <20240122123845.3822570-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DDE54180012 X-Stat-Signature: 6eedca36yebg8zcjcz38q5zxh3meefk8 X-Rspam-User: X-HE-Tag: 1705927162-718681 X-HE-Meta: U2FsdGVkX1/3oldB7kS2KINOa+v+zCFxZFGw5NtpuaSCiBftybCNee025zUmSyQyxGPRiGmradWhMaJL0djzgEYbqDVSinOSqqomDzyr6y6pmW5G3ez0p2CDvg9/o5qFlZX2QfNEGXETCOwZM2CdduNXFKkbNYtDMtepcswlwQXX4hlsPVoraxCksCslk376RmXWvzGmqwTg8Sq5spdD0vmvNqXRlSEjtfNYGCIFrdxYwjx5NGkqe7EjhrT8J4GsafpBxHBdjn9yahLYxGK6UcHEjrXzOTef+NL30EMN2rJ9CrBohlQRJVEgLgCvVWlqIra3HjSKQ2LPrfixb8lkQbIj4lVYd/ELcWtj9o/gJtGjRwFaKYDPGEr47q9z1pkq7V4Le+0o3Vqld1pLhzzP1fE6rzZgV+9kyEP6eY8WEp0feRhSqqq6XEeNrDv3lcrtjuc9JbBznimgjxR6XbdbsFMPHpIjgrdpIjSwpNgVYcyn/QtnWPGwY3fzsKaqidXZwFz31SEokqc/1k7OcDvuSpFd1EuLLxVWlfhWVTeu2aS0d70jLNX4FSlUF4ppUT5OqReT81S7bruULt49HA+34LCZbp9EWmaGmnRj5W7yNDi0H8n9HDdcfIVzHTSczYa5SzJF2Lu9ESmC4xHo1F47XM+k0g6kuajsaIDfP17xW6ZNkSw7yHrkUk36FGwbb7j6fEoEcVDNy7c9MCe2mgAVsBXeaRa+pTFHxw14m6ghxkpsNvTQ+O75l2wJ7P/+UaC4rIatjqV9JwMjF5tPcKEn7o8Tu8nGQ66me0NmiJy3CaqhQWAjFOd26vGsqrgfpiVY+xI9z6nJFT8rozEpZlDBnD3JvPP8dG//zNjjsfxyEv8e4A89OT9dRMY16Psu+eVQB7yo97PEHiYwQIexPEJh73Iimkb3HVF6Fzbddg0hL0cnm9PrKnOwOP/FP0twNysa1Uru1NxfIsIxKI7SjOc x8CO2N70 8tK1mkd4VuvBd+8yKqkR3h7kBPxi7wnl3IbPHJLz7RQU+UY24eTXjRkoOtXvEtJTfqyftpRB8/egcQLI0xf0cyuswtioXcjgWesYI1uB0Nht3c7WjUD9YnJhavCdu8OoYeea2G887XodfUuj+wrZvH62bI+of772MUMaOb+jKpMwuwMNNRQwkI6csvhLehC256xwxhTueGM+fimxSAEehqTSRsfsh6jtGuIyhGxJZ+HyZ+bHQvaBpE0utn49rqgnn1+URKTV8JlbJT/mOfQU3k0ZCi5bx38LFVGnsUoKOfVpV6loBszh5ABhLxg61eHXhva/fLKshA2GD0aA22HEuQzydxB9S6AWTGRY+WaJ5BTxtVj2twcNZics7uvfcC9/rnZPCcbZSHxSnOLbMzwqGmSnIM0TsdzEU2mNz9Y6RmafYQL7MrfJCIv6pa5D1hTJrUH/dSak5NCZOB+8= 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: Remove afs_dynroot_d_revalidate() as it is redundant as all it does is return 1 and the caller assumes that if the op is not given. Suggested-by: Alexander Viro Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org cc: linux-fsdevel@vger.kernel.org --- fs/afs/dynroot.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c index d3bc4a2d7085..c4d2711e20ad 100644 --- a/fs/afs/dynroot.c +++ b/fs/afs/dynroot.c @@ -258,16 +258,7 @@ const struct inode_operations afs_dynroot_inode_operations = { .lookup = afs_dynroot_lookup, }; -/* - * Dirs in the dynamic root don't need revalidation. - */ -static int afs_dynroot_d_revalidate(struct dentry *dentry, unsigned int flags) -{ - return 1; -} - const struct dentry_operations afs_dynroot_dentry_operations = { - .d_revalidate = afs_dynroot_d_revalidate, .d_delete = always_delete_dentry, .d_release = afs_d_release, .d_automount = afs_d_automount, From patchwork Mon Jan 22 12:38: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: 13525420 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 EFF01C47DD9 for ; Mon, 22 Jan 2024 12:39:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 804778D0009; Mon, 22 Jan 2024 07:39:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 759338D0001; Mon, 22 Jan 2024 07:39:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D2928D0009; Mon, 22 Jan 2024 07:39:27 -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 465E58D0001 for ; Mon, 22 Jan 2024 07:39:27 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 264C312093C for ; Mon, 22 Jan 2024 12:39:27 +0000 (UTC) X-FDA: 81706902774.23.2D00C09 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 96829100012 for ; Mon, 22 Jan 2024 12:39:25 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=I7A7wpnF; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.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=1705927165; 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=2EbxtrFCFvcK5IiuVsAPW/KUPjjRaC8uqKzNdD5mRDM=; b=L91FCdt3+NduAyRphm60SdxpSqCf1U7PKnNoIf0w30k3Jq5F3ZJXB/LKgiwkUTe1i8u77G DAwjyb2FmMwyG1TOWn/VKLXIWJVwsPESR6KfKPGLME7tZHHgicjiYZ021/Q6bKtKzFUihm uQKvUskAFXYQIp1aGThTa7O3oRNVV10= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=I7A7wpnF; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.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=1705927165; a=rsa-sha256; cv=none; b=54SF0CslYjnldcStneJob1pncoIUPphbZ4f7M5m/FHVApWMABUdsyop3bSVZ9XTA6nX8lA aPjdNcTY+uCWfuIaYB0/9KcXtM/5UqVr8+qjIGey618mkv7BLD6fZJDkp3iHzwt+Lafjfi hA6+A7iZSnVZPSw3RgGV/fzzyCHixZQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705927164; 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=2EbxtrFCFvcK5IiuVsAPW/KUPjjRaC8uqKzNdD5mRDM=; b=I7A7wpnF9PS6V0kWAppp1OcOMFrANO2dUfeKcZPrQZ+U/ZKau5YCqUDy7dzzROs/Agu9pe mLenogfO9tYutVcTrb3copza0yzavWwd9A0xB2nc85tzzch1ENsgAJNC4d8aQypUK15Xco B03A4im6EOjxGw9ExlgOU8IWE5XC2Qw= 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-515-cT5bUUrvOPuNd97vS-GVBg-1; Mon, 22 Jan 2024 07:39:19 -0500 X-MC-Unique: cT5bUUrvOPuNd97vS-GVBg-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 C9CAD88D283; Mon, 22 Jan 2024 12:39:18 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id E643B492BE2; Mon, 22 Jan 2024 12:39:16 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, 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, linux-kernel@vger.kernel.org, kernel test robot Subject: [PATCH 10/10] afs: Fix missing/incorrect unlocking of RCU read lock Date: Mon, 22 Jan 2024 12:38:43 +0000 Message-ID: <20240122123845.3822570-11-dhowells@redhat.com> In-Reply-To: <20240122123845.3822570-1-dhowells@redhat.com> References: <20240122123845.3822570-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 96829100012 X-Stat-Signature: e9hw33s6tptgbe3m7oassnjwhxy19paw X-Rspam-User: X-HE-Tag: 1705927165-62586 X-HE-Meta: U2FsdGVkX1/ljcBPP9zhrvgfYUjGGK5Ltdnpi38ZsotwpQ3xPCO4Kldgx4RSe8xa3YqDQacsGfZL6HtlUHGQAhIPEK8xEeWEdK3v5zHsut1MuR3916gu3xv1w8TMYeqhA7VgfgLiBPGKaXICSK3zhRJlSsPGEVPc0aP11Yax2Q0MopSfgPfiP13ku54fWkQSVRSFNRdguKlD1HEVyt7pTe9wafBsKKPGUPAqTMWBBqmj2UNhAN/CSi1O9pDNAz4JuPzRCNrbvtVWqEiFFUP+iXGnD4zYVbKKx8sNVfVNr6IVakH5aooA/TS6nvylBoPNAbNi7w41n7XlGnH6YywtNpVYumACQO42bd8QGL9xog7o9uOxfr0SdT7SLHlhzyd2DYhCeLa1CSX+6x4OthePnMR0JdYp2dPKJUQEVRsPSEViRticxwlvvVqus0Lt5vWYxFQJWiLNYDP0V9EZ0zyI/JIOTq6vwq9VgC9WFG6a9fiQKcUdsxCtlHXNruTPsSZV9iowEQWm/v68XAM6nXM5hoe6svV8ZSljYUgNJaNntvZP4HgQ9ca4svXoUvvrPzXxLuVsrbZuaA2d+MhkgtFl7zCTJymcKWRKnseqV5ZlYF4UYWmTb0GpZqW2T8QWarVK6FrZ+RdN25HnCYdvhd3eDIOOIoBav7neEDkiCaVruIk23Wcsf4rC6tGjoQopyhKjlv1FzBWu/5JEzQ0MXbYd1HWvpXDWv3JwK4nTJnzPeUoqPqA2LsMiw66nBnb2pC6HUx+kX8LVCSGZO4Vfd+g2gLqgHhNfVG3MYS6aG5SLfN8Ve7PNmy5ubDT+LUAtGMcCYLiIYYXKCVawtV7yXWb/7VWjZZe4quoP9/Dc4CI5LJCNPEVMtuUEjVbpCPT6DFYR8OAfiw/PcGdGbbrEaWGJ8Q== 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 afs_proc_addr_prefs_show(), we need to unlock the RCU read lock in both places before returning (and not lock it again). Fixes: f94f70d39cc2 ("afs: Provide a way to configure address priorities") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202401172243.cd53d5f6-oliver.sang@intel.com Signed-off-by: David Howells cc: linux-afs@lists.infradead.org cc: linux-fsdevel@vger.kernel.org --- fs/afs/proc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/afs/proc.c b/fs/afs/proc.c index 3bd02571f30d..15eab053af6d 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c @@ -166,7 +166,7 @@ static int afs_proc_addr_prefs_show(struct seq_file *m, void *v) if (!preflist) { seq_puts(m, "NO PREFS\n"); - return 0; + goto out; } seq_printf(m, "PROT SUBNET PRIOR (v=%u n=%u/%u/%u)\n", @@ -191,7 +191,8 @@ static int afs_proc_addr_prefs_show(struct seq_file *m, void *v) } } - rcu_read_lock(); +out: + rcu_read_unlock(); return 0; }