Re: [PATCH] nfs: fix nfs_swap_rw for large-folio swap

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

 



On Mon, Jun 17, 2024 at 5:32 PM Christoph Hellwig <hch@xxxxxx> wrote:
>
> On Sun, Jun 16, 2024 at 06:23:16PM +0800, Barry Song wrote:
> > This is quite unusual. Could you share your setup and backtrace?
>
> Do this in an x86 kvm vm with 1G of memory:
>
> mkfs.xfs -f /dev/vdb
>
> mount /dev/vdb /mnt/nfs1
>
> # this requires the following line in /etc/exports to actually export the
> # file system: "/mnt/nfs2       localhost(rw,no_root_squash)"
> systemctl restart nfs-kernel-server
>
> mount -t nfs 127.0.0.1:/mnt/nfs1/ /mnt/test/
>
> cd /mnt/test
> dd if=/dev/zero of=swapfile bs=1024 count=524288
> mkswap swapfile
> chmod 0600 swapfile
> swapon swapfile

I did everything the same as above,
but always got failure at the last step to swapon:
/mnt/test # swapon swapfile
swapon: /mnt/test/swapfile: swapon failed: Invalid argument

the mount status:
/dev/vdb on /mnt/nfs1 type xfs
(rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
127.0.0.1:/mnt/nfs1 on /mnt/test type nfs4
(rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=127.0.0.1,local_lock=none,addr=127.0.0.1)

As long as the swapfile is not on nfs, I am ok to swapon:
/mnt # swapon swapfile
[ 1150.302641] Adding 65532k swap on /mnt/swapfile.  Priority:-2
extents:1 across:65532k

Anything I am missing?

>
> # xfstests-dev is a checked out and built xfstests repo
> ~/xfstests-dev/src/usemem 1024
>
> The backtrace is at the end of the mail.
>
> > I'd
> > like to reproduce the issue, as the mm code only supports mTHP
> > swapout on block devices. What is your swap device or swap file?
>
> The above swap fіle on NFS is the only swap in the system
>
> > Additionally, on what kind of filesystem is the executable file built
> > from usemem.c located?
>
> Doesn't matter.  I've tried xfs, ext4 and nfs itself.
>
> root@testvm:~# ./xfstests-dev/src/usemem 1024
> [   65.065292] ------------[ cut here ]------------
> [   65.065528] kernel BUG at fs/nfs/direct.c:144!
> [   65.065724] Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
> [   65.065988] CPU: 0 PID: 71 Comm: kswapd0 Not tainted 6.10.0-rc3+ #2587
> [   65.066270] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
> [   65.066683] RIP: 0010:nfs_swap_rw+0x3f/0x50
> [   65.066893] Code: 00 00 74 13 e8 e2 fb ff ff 31 d2 48 85 c0 48 0f 4f c2 c3 cc cc cc cc e8 9f f8 ff ff 31 0
> [   65.067698] RSP: 0018:ffffc900001b79c8 EFLAGS: 00010206
> [   65.067949] RAX: ffffffff8162afc0 RBX: ffff88800ca24c00 RCX: 0000000000000004
> [   65.068274] RDX: ffff88800ca24c30 RSI: ffffc900001b79d0 RDI: ffff88800ca24c00
> [   65.068588] RBP: ffff88800dd710e8 R08: 0000000000004000 R09: 0000000000000010
> [   65.068911] R10: 0000000000035a40 R11: 000000000000001d R12: ffffc900001b7a78
> [   65.069225] R13: ffffc900001b7db0 R14: ffffc900001b7a68 R15: ffffea00003f1c40
> [   65.069542] FS:  0000000000000000(0000) GS:ffff88803ec00000(0000) knlGS:0000000000000000
> [   65.069904] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [   65.070157] CR2: 00005606ddec4dd0 CR3: 000000000365a003 CR4: 0000000000770ef0
> [   65.070472] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [   65.070784] DR3: 0000000000000000 DR6: 00000000ffff07f0 DR7: 0000000000000400
> [   65.071282] PKRU: 55555554
> [   65.071407] Call Trace:
> [   65.071519]  <TASK>
> [   65.071619]  ? die+0x31/0x80
> [   65.071754]  ? do_trap+0xd7/0x100
> [   65.071915]  ? do_error_trap+0x65/0x90
> [   65.072084]  ? nfs_swap_rw+0x3f/0x50
> [   65.072247]  ? exc_invalid_op+0x50/0x70
> [   65.072420]  ? nfs_swap_rw+0x3f/0x50
> [   65.072581]  ? asm_exc_invalid_op+0x1a/0x20
> [   65.072770]  ? __pfx_nfs_swap_rw+0x10/0x10
> [   65.072966]  ? nfs_swap_rw+0x3f/0x50
> [   65.073125]  swap_write_unplug+0x57/0x90
> [   65.073307]  shrink_folio_list+0x3a1/0xed0
> [   65.073500]  ? __mod_zone_page_state+0x61/0xa0
> [   65.073700]  ? isolate_lru_folios+0x2f3/0x400
> [   65.073902]  shrink_lruvec+0x587/0xb60
> [   65.074071]  ? shrink_slab+0x3ad/0x3c0
> [   65.074239]  ? shrink_slab+0x3ad/0x3c0
> [   65.074408]  shrink_node+0x2b7/0x7e0
> [   65.074569]  balance_pgdat+0x291/0x6f0





[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