public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Max Kellermann <max.kellermann@ionos.com>
Cc: dhowells@redhat.com, Jeff Layton <jlayton@kernel.org>,
	netfs@lists.linux.dev,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] netfs: Fix ceph copy to cache on write-begin
Date: Thu, 12 Dec 2024 16:00:32 +0000	[thread overview]
Message-ID: <2787700.1734019232@warthog.procyon.org.uk> (raw)
In-Reply-To: <CAKPOu+-Bpds7-Ocb-tBMs1==YzVhhx01+FaiokiGR3A-W9t_gQ@mail.gmail.com>

How about if you add the attached?

For convenience, I've put the outstanding fix patches I have here:

	https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=netfs-fixes

David
---
commit d0bc2ecca996105f55da22e8867905ca1dad7c8f
Author: David Howells <dhowells@redhat.com>
Date:   Thu Dec 12 15:26:24 2024 +0000

    netfs: Fix the (non-)cancellation of copy when cache is temporarily disabled
    
    When the caching for a cookie is temporarily disabled (e.g. due to a DIO
    write on that file), future copying to the cache for that file is disabled
    until all fds open on that file are closed.  However, if netfslib is using
    the deprecated PG_private_2 method (such as is currently used by ceph), and
    decides it wants to copy to the cache, netfs_advance_write() will just bail
    at the first check seeing that the cache stream is unavailable, and
    indicate that it dealt with all the content.
    
    This means that we have no subrequests to provide notifications to drive
    the state machine or even to pin the request and the request just gets
    discarded, leaving the folios with PG_private_2 set.
    
    Fix this by jumping directly to cancel the request if the cache is not
    available.  That way, we don't remove mark3 from the folio_queue list and
    netfs_pgpriv2_cancel() will clean up the folios.
    
    This was found by running the generic/013 xfstest against ceph with an active
    cache and the "-o fsc" option passed to ceph.  That would usually hang
    
    Fixes: ee4cdf7ba857 ("netfs: Speed up buffered reading")
    Reported-by: Max Kellermann <max.kellermann@ionos.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Jeff Layton <jlayton@kernel.org>
    cc: Ilya Dryomov <idryomov@gmail.com>
    cc: Xiubo Li <xiubli@redhat.com>
    cc: netfs@lists.linux.dev
    cc: ceph-devel@vger.kernel.org
    cc: linux-fsdevel@vger.kernel.org

diff --git a/fs/netfs/read_pgpriv2.c b/fs/netfs/read_pgpriv2.c
index ba5af89d37fa..54d5004fec18 100644
--- a/fs/netfs/read_pgpriv2.c
+++ b/fs/netfs/read_pgpriv2.c
@@ -170,6 +170,10 @@ void netfs_pgpriv2_write_to_the_cache(struct netfs_io_request *rreq)
 
 	trace_netfs_write(wreq, netfs_write_trace_copy_to_cache);
 	netfs_stat(&netfs_n_wh_copy_to_cache);
+	if (!wreq->io_streams[1].avail) {
+		netfs_put_request(wreq, false, netfs_rreq_trace_put_return);
+		goto couldnt_start;
+	}
 
 	for (;;) {
 		error = netfs_pgpriv2_copy_folio(wreq, folio);


  reply	other threads:[~2024-12-12 16:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18 23:04 6.12 WARNING in netfs_consume_read_data() Max Kellermann
2024-11-29 12:41 ` David Howells
2024-11-29 21:06   ` Max Kellermann
2024-11-29 22:29   ` Max Kellermann
2024-12-06 15:08     ` Max Kellermann
2024-12-06 15:13       ` Max Kellermann
2024-12-06 16:29       ` Max Kellermann
2024-12-06 21:13         ` David Howells
2024-12-07 18:39           ` Max Kellermann
2024-12-08 10:20             ` Max Kellermann
2024-12-09 13:14               ` [PATCH] netfs: Fix ceph copy to cache on write-begin David Howells
2024-12-09 13:31                 ` Max Kellermann
2024-12-12 16:00                   ` David Howells [this message]
2025-01-07 10:58                     ` Max Kellermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2787700.1734019232@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max.kellermann@ionos.com \
    --cc=netfs@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox