Patch "netfs: Fix ceph copy to cache on write-begin" has been added to the 6.12-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    netfs: Fix ceph copy to cache on write-begin

to the 6.12-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     netfs-fix-ceph-copy-to-cache-on-write-begin.patch
and it can be found in the queue-6.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5a499cd36c28f96ffffe9d6e5cb5b6ac734b5e8e
Author: David Howells <dhowells@xxxxxxxxxx>
Date:   Fri Dec 13 13:50:09 2024 +0000

    netfs: Fix ceph copy to cache on write-begin
    
    [ Upstream commit 38cf8e945721ffe708fa675507465da7f4f2a9f7 ]
    
    At the end of netfs_unlock_read_folio() in which folios are marked
    appropriately for copying to the cache (either with by being marked dirty
    and having their private data set or by having PG_private_2 set) and then
    unlocked, the folio_queue struct has the entry pointing to the folio
    cleared.  This presents a problem for netfs_pgpriv2_write_to_the_cache(),
    which is used to write folios marked with PG_private_2 to the cache as it
    expects to be able to trawl the folio_queue list thereafter to find the
    relevant folios, leading to a hang.
    
    Fix this by not clearing the folio_queue entry if we're going to do the
    deprecated copy-to-cache.  The clearance will be done instead as the folios
    are written to the cache.
    
    This can be reproduced by starting cachefiles, mounting a ceph filesystem
    with "-o fsc" and writing to it.
    
    Fixes: 796a4049640b ("netfs: In readahead, put the folio refs as soon extracted")
    Reported-by: Max Kellermann <max.kellermann@xxxxxxxxx>
    Closes: https://lore.kernel.org/r/CAKPOu+_4m80thNy5_fvROoxBm689YtA0dZ-=gcmkzwYSY4syqw@xxxxxxxxxxxxxx/
    Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241213135013.2964079-10-dhowells@xxxxxxxxxx
    Fixes: ee4cdf7ba857 ("netfs: Speed up buffered reading")
    cc: Jeff Layton <jlayton@xxxxxxxxxx>
    cc: Ilya Dryomov <idryomov@xxxxxxxxx>
    cc: Xiubo Li <xiubli@xxxxxxxxxx>
    cc: netfs@xxxxxxxxxxxxxxx
    cc: ceph-devel@xxxxxxxxxxxxxxx
    cc: linux-fsdevel@xxxxxxxxxxxxxxx
    Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/netfs/read_collect.c b/fs/netfs/read_collect.c
index d86fa02f68fb..e70eb4ea21c0 100644
--- a/fs/netfs/read_collect.c
+++ b/fs/netfs/read_collect.c
@@ -62,10 +62,14 @@ static void netfs_unlock_read_folio(struct netfs_io_subrequest *subreq,
 		} else {
 			trace_netfs_folio(folio, netfs_folio_trace_read_done);
 		}
+
+		folioq_clear(folioq, slot);
 	} else {
 		// TODO: Use of PG_private_2 is deprecated.
 		if (test_bit(NETFS_SREQ_COPY_TO_CACHE, &subreq->flags))
 			netfs_pgpriv2_mark_copy_to_cache(subreq, rreq, folioq, slot);
+		else
+			folioq_clear(folioq, slot);
 	}
 
 	if (!test_bit(NETFS_RREQ_DONT_UNLOCK_FOLIOS, &rreq->flags)) {
@@ -77,8 +81,6 @@ static void netfs_unlock_read_folio(struct netfs_io_subrequest *subreq,
 			folio_unlock(folio);
 		}
 	}
-
-	folioq_clear(folioq, slot);
 }
 
 /*




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux