Message ID | a702d42c922737c4f8278617db69ce2b6d813c5f.1714409084.git.john@groves.net |
---|---|
State | New, archived |
Headers | show |
Series | Introduce the famfs shared-memory file system | expand |
On Mon, Apr 29, 2024 at 12:04:23PM -0500, John Groves wrote: > Famfs needs a slightly different kill_super variant than already existed. > Putting it local to famfs would require exporting d_genocide(); this > seemed a bit cleaner. What's wrong with kill_litter_super()?
On 24/05/02 07:17PM, Al Viro wrote: > On Mon, Apr 29, 2024 at 12:04:23PM -0500, John Groves wrote: > > Famfs needs a slightly different kill_super variant than already existed. > > Putting it local to famfs would require exporting d_genocide(); this > > seemed a bit cleaner. > > What's wrong with kill_litter_super()? I struggled with that, I don't have my head fully around the superblock handling code. But when I replace kill_char_super() with kill_litter_super()... - first mount works - first umount works - second mount works - second umount does this (which I don't properly understand): May 02 17:21:58 f39-dev1 kernel: ------------[ cut here ]------------ May 02 17:21:58 f39-dev1 kernel: ida_free called for id=1 which is not allocated. May 02 17:21:58 f39-dev1 kernel: WARNING: CPU: 1 PID: 1173 at lib/idr.c:525 ida_free+0xe3/0x140 May 02 17:21:58 f39-dev1 kernel: Modules linked in: famfs rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace netfs qrtr rfkill snd_hda_codec_generic intel_rapl_msr sunrpc snd_hda_intel snd_intel_dspcfg intel_rapl_common snd_intel_sdw_acpi snd_hda_codec kmem snd_hda_core device_dax kvm_intel snd_hwdep iTCO_wdt kvm intel_pmc_bxt snd_seq iTCO_vendor_support dax_hmem snd_seq_device cxl_acpi cxl_core rapl snd_pcm snd_timer snd einj pcspkr soundcore i2c_i801 lpc_ich i2c_smbus vfat fat virtio_balloon joydev fuse loop zram xfs crct10dif_pclmul crc32_pclmul crc32c_intel polyval_clmulni polyval_generic ghash_clmulni_intel sha512_ssse3 sha256_ssse3 sha1_ssse3 virtio_net virtio_console net_failover virtio_gpu failover virtio_blk virtio_dma_buf serio_raw scsi_dh_rdac scsi_dh_emc scsi_dh_alua dm_multipath qemu_fw_cfg May 02 17:21:58 f39-dev1 kernel: CPU: 1 PID: 1173 Comm: umount Tainted: G W 6.9.0-rc5+ #266 May 02 17:21:58 f39-dev1 kernel: Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS edk2-20230301gitf80f052277c8-26.fc38 03/01/2023 May 02 17:21:58 f39-dev1 kernel: RIP: 0010:ida_free+0xe3/0x140 May 02 17:21:58 f39-dev1 kernel: Code: 8d 7d a0 e8 9f 2e 02 00 eb 62 41 83 fe 3e 76 3c 48 8b 7d a0 4c 89 ee e8 5b 73 04 00 89 de 48 c7 c7 60 51 be 82 e8 3d 03 0b ff <0f> 0b 48 8b 45 d8 65 48 2b 04 25 28 00 00 00 75 3f 48 83 c4 40 5b May 02 17:21:58 f39-dev1 kernel: RSP: 0018:ffffc90000c37c50 EFLAGS: 00010286 May 02 17:21:58 f39-dev1 kernel: RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000 May 02 17:21:58 f39-dev1 kernel: RDX: 0000000000000002 RSI: 0000000000000027 RDI: 00000000ffffffff May 02 17:21:58 f39-dev1 kernel: RBP: ffffc90000c37cb0 R08: 0000000000000000 R09: 0000000000000003 May 02 17:21:58 f39-dev1 kernel: R10: ffffc90000c37aa0 R11: ffffffff82f3c3a8 R12: 00c7fffffffffffc May 02 17:21:58 f39-dev1 kernel: R13: 0000000000000202 R14: 0000000000000001 R15: 0000000000000000 May 02 17:21:58 f39-dev1 kernel: FS: 00007f0ff81c0800(0000) GS:ffff88886fc80000(0000) knlGS:0000000000000000 May 02 17:21:58 f39-dev1 kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 May 02 17:21:58 f39-dev1 kernel: CR2: 00007f6b841c95a8 CR3: 00000001254c8001 CR4: 0000000000170ef0 May 02 17:21:58 f39-dev1 kernel: Call Trace: May 02 17:21:58 f39-dev1 kernel: <TASK> May 02 17:21:58 f39-dev1 kernel: ? show_regs+0x64/0x70 May 02 17:21:58 f39-dev1 kernel: ? __warn+0x88/0x130 May 02 17:21:58 f39-dev1 kernel: ? ida_free+0xe3/0x140 May 02 17:21:58 f39-dev1 kernel: ? report_bug+0x192/0x1c0 May 02 17:21:58 f39-dev1 kernel: ? handle_bug+0x44/0x90 May 02 17:21:58 f39-dev1 kernel: ? exc_invalid_op+0x18/0x70 May 02 17:21:58 f39-dev1 kernel: ? asm_exc_invalid_op+0x1b/0x20 May 02 17:21:58 f39-dev1 kernel: ? ida_free+0xe3/0x140 May 02 17:21:58 f39-dev1 kernel: kill_litter_super+0x4c/0x60 May 02 17:21:58 f39-dev1 kernel: famfs_kill_sb+0x57/0x60 [famfs] May 02 17:21:58 f39-dev1 kernel: deactivate_locked_super+0x35/0xb0 May 02 17:21:58 f39-dev1 kernel: deactivate_super+0x40/0x50 May 02 17:21:58 f39-dev1 kernel: cleanup_mnt+0xc3/0x160 May 02 17:21:58 f39-dev1 kernel: __cleanup_mnt+0x12/0x20 May 02 17:21:58 f39-dev1 kernel: task_work_run+0x60/0x90 May 02 17:21:58 f39-dev1 kernel: syscall_exit_to_user_mode+0x21a/0x220 May 02 17:21:58 f39-dev1 kernel: do_syscall_64+0x8d/0x180 May 02 17:21:58 f39-dev1 kernel: ? do_faccessat+0x1b8/0x2e0 May 02 17:21:58 f39-dev1 kernel: ? syscall_exit_to_user_mode+0x7c/0x220 May 02 17:21:58 f39-dev1 kernel: ? do_syscall_64+0x8d/0x180 May 02 17:21:58 f39-dev1 kernel: ? syscall_exit_to_user_mode+0x7c/0x220 May 02 17:21:58 f39-dev1 kernel: ? do_syscall_64+0x8d/0x180 May 02 17:21:58 f39-dev1 kernel: ? do_syscall_64+0x8d/0x180 May 02 17:21:58 f39-dev1 kernel: ? do_user_addr_fault+0x315/0x6e0 May 02 17:21:58 f39-dev1 kernel: ? irqentry_exit_to_user_mode+0x71/0x220 May 02 17:21:58 f39-dev1 kernel: ? irqentry_exit+0x3b/0x50 May 02 17:21:58 f39-dev1 kernel: ? exc_page_fault+0x90/0x190 May 02 17:21:58 f39-dev1 kernel: entry_SYSCALL_64_after_hwframe+0x76/0x7e May 02 17:21:58 f39-dev1 kernel: RIP: 0033:0x7f0ff83df41b May 02 17:21:58 f39-dev1 kernel: Code: c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 f3 0f 1e fa 31 f6 e9 05 00 00 00 0f 1f 44 00 00 f3 0f 1e fa b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 8b 15 e1 19 0c 00 f7 d8 May 02 17:21:58 f39-dev1 kernel: RSP: 002b:00007fffe039cfd8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 May 02 17:21:58 f39-dev1 kernel: RAX: 0000000000000000 RBX: 0000555ad6c2fb90 RCX: 00007f0ff83df41b May 02 17:21:58 f39-dev1 kernel: RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000555ad6c34ba0 May 02 17:21:58 f39-dev1 kernel: RBP: 00007fffe039d0b0 R08: 0000000000000020 R09: 0000000000000001 May 02 17:21:58 f39-dev1 kernel: R10: 0000000000000004 R11: 0000000000000246 R12: 0000555ad6c2fc90 May 02 17:21:58 f39-dev1 kernel: R13: 0000000000000000 R14: 0000555ad6c34ba0 R15: 0000555ad6c2ffa0 May 02 17:21:58 f39-dev1 kernel: </TASK> May 02 17:21:58 f39-dev1 kernel: ---[ end trace 0000000000000000 ]--- With kill_char_super(), it can mount and dismount for days with no issues that I have seen. Thanks, John
On Thu, May 02, 2024 at 05:25:33PM -0500, John Groves wrote: > On 24/05/02 07:17PM, Al Viro wrote: > > On Mon, Apr 29, 2024 at 12:04:23PM -0500, John Groves wrote: > > > Famfs needs a slightly different kill_super variant than already existed. > > > Putting it local to famfs would require exporting d_genocide(); this > > > seemed a bit cleaner. > > > > What's wrong with kill_litter_super()? > > I struggled with that, I don't have my head fully around the superblock > handling code. Fyi, see my other mail where I point out what's wrong and one way to fix it.
On 24/05/03 11:04AM, Christian Brauner wrote: > On Thu, May 02, 2024 at 05:25:33PM -0500, John Groves wrote: > > On 24/05/02 07:17PM, Al Viro wrote: > > > On Mon, Apr 29, 2024 at 12:04:23PM -0500, John Groves wrote: > > > > Famfs needs a slightly different kill_super variant than already existed. > > > > Putting it local to famfs would require exporting d_genocide(); this > > > > seemed a bit cleaner. > > > > > > What's wrong with kill_litter_super()? > > > > I struggled with that, I don't have my head fully around the superblock > > handling code. > > Fyi, see my other mail where I point out what's wrong and one way to fix it. No luck with that, but please let me know if I did it wrong. https://lore.kernel.org/linux-fsdevel/cover.1714409084.git.john@groves.net/T/#m98890d9b46d9c83d2d144c07e6de7ae7f64a595d Thank you,, John
diff --git a/fs/super.c b/fs/super.c index 69ce6c600968..cd276d30b522 100644 --- a/fs/super.c +++ b/fs/super.c @@ -1236,6 +1236,15 @@ void kill_litter_super(struct super_block *sb) } EXPORT_SYMBOL(kill_litter_super); +void kill_char_super(struct super_block *sb) +{ + if (sb->s_root) + d_genocide(sb->s_root); + generic_shutdown_super(sb); + kill_super_notify(sb); +} +EXPORT_SYMBOL(kill_char_super); + int set_anon_super_fc(struct super_block *sb, struct fs_context *fc) { return set_anon_super(sb, NULL); diff --git a/include/linux/fs.h b/include/linux/fs.h index 8dfd53b52744..cc586f30397d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2511,6 +2511,7 @@ void generic_shutdown_super(struct super_block *sb); void kill_block_super(struct super_block *sb); void kill_anon_super(struct super_block *sb); void kill_litter_super(struct super_block *sb); +void kill_char_super(struct super_block *sb); void deactivate_super(struct super_block *sb); void deactivate_locked_super(struct super_block *sb); int set_anon_super(struct super_block *s, void *data);
Famfs needs a slightly different kill_super variant than already existed. Putting it local to famfs would require exporting d_genocide(); this seemed a bit cleaner. Signed-off-by: John Groves <john@groves.net> --- fs/super.c | 9 +++++++++ include/linux/fs.h | 1 + 2 files changed, 10 insertions(+)