Re: kernel 6.10

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

 




On 8/3/2024 7:22 AM, Hristo Venev wrote:
On Wed, 2024-07-31 at 15:27 +0000, Trond Myklebust wrote:
On Sun, 2024-07-28 at 11:33 +0300, Dan Aloni wrote:
On 2024-07-28 02:57:42, Hristo Venev wrote:

... and 0x356 happens to be NETFS_FOLIO_COPY_TO_CACHE. Maybe the
NETFS_RREQ_USE_PGPRIV2 flag is lost somehow?
Why is netfs setting folio->private at all when it is running on top
of
NFS? It doesn't own that field.
As I mentioned previously, there is something going on with the
`NETFS_RREQ_USE_PGPRIV2` flag. In particular, it appears that it isn't
always set in `netfs_alloc_request()`. This may happen when
`netfs_is_cache_enabled()` returns false on a cache-enabled filesystem.
Maybe the inode cache state is not yet fully initialized?

The patch below seems to fix the issue, in the sense that reading from
the filesystem is no longer a guaranteed crash.


diff --git a/fs/netfs/objects.c b/fs/netfs/objects.c
index f4a6427274792..a74ca90c86c9b 100644
--- a/fs/netfs/objects.c
+++ b/fs/netfs/objects.c
@@ -27,7 +27,6 @@ struct netfs_io_request *netfs_alloc_request(struct address_space *mapping,
  	bool is_unbuffered = (origin == NETFS_UNBUFFERED_WRITE ||
  			      origin == NETFS_DIO_READ ||
  			      origin == NETFS_DIO_WRITE);
-	bool cached = !is_unbuffered && netfs_is_cache_enabled(ctx);
  	int ret;
for (;;) {
@@ -56,8 +55,9 @@ struct netfs_io_request *netfs_alloc_request(struct address_space *mapping,
  	refcount_set(&rreq->ref, 1);
__set_bit(NETFS_RREQ_IN_PROGRESS, &rreq->flags);
-	if (cached) {
-		__set_bit(NETFS_RREQ_WRITE_TO_CACHE, &rreq->flags);
+	if (!is_unbuffered && fscache_cookie_valid(netfs_i_cookie(ctx))) {
+		if (netfs_is_cache_enabled(ctx))
+			__set_bit(NETFS_RREQ_WRITE_TO_CACHE, &rreq->flags);
  		if (test_bit(NETFS_ICTX_USE_PGPRIV2, &ctx->flags))
  			/* Filesystem uses deprecated PG_private_2 marking. */
  			__set_bit(NETFS_RREQ_USE_PGPRIV2, &rreq->flags);


However, there is still another issue: Unmounting deadlocks on
`folio_wait_private_2`:

    [root@localhost ~]# cat /proc/489/stack
    [<0>] folio_wait_private_2+0xc7/0x130
    [<0>] truncate_cleanup_folio+0x4a/0x80
    [<0>] truncate_inode_pages_range+0xe1/0x3c0
    [<0>] nfs4_evict_inode+0x10/0x70
    [<0>] evict+0xbd/0x160
    [<0>] evict_inodes+0x15e/0x1e0
    [<0>] generic_shutdown_super+0x34/0x160
    [<0>] kill_anon_super+0xd/0x40
    [<0>] nfs_kill_super+0x1c/0x30
    [<0>] deactivate_locked_super+0x27/0xa0
    [<0>] cleanup_mnt+0xb5/0x150
    [<0>] task_work_run+0x52/0x80
    [<0>] syscall_exit_to_user_mode+0xef/0x100
    [<0>] do_syscall_64+0x53/0x870
    [<0>] entry_SYSCALL_64_after_hwframe+0x76/0x7e
In 6.9 the `NETFS_RREQ_COPY_TO_CACHE` flag used to be considered by
`netfs_rreq_assess`. Now it no longer appears to be checked anywhere.
With the new netfs cache implementation, how/when is the `PG_private_2`
flag cleared and when is data written to cache?
I don't know if it can help, but I noticed this issue growing when the responsive time of the NFS server (or cachefilesd?) is longer because of the network or a busy server doing other tasks.




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux