From: Babu Moger <babu.moger@oracle.com> Date: Wed, 21 Jun 2017 23:22:09 +0000 (-0600) Subject: fs/fuse: Fix for correct number of numa nodes X-Git-Tag: v4.1.12-105.0.20170705_2000~14 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2d61151b83624d4b64909fe808a416875f85e58e;p=users%2Fjedix%2Flinux-maple.git fs/fuse: Fix for correct number of numa nodes When fuse filesystem is mounted it sets up data structure for all the available numa nodes(with -o numa). However, it uses nr_node_ids which is set to MAX_NUMNODES(16). This causes following panic when kmalloc_node is called. Call Trace: [00000000005cb0bc] allocate_slab+0x9c/0x2e0 [00000000005cb48c] new_slab+0x2c/0x220 [00000000005cc84c] __slab_alloc+0x2ec/0x3c0 [00000000005cec60] kmem_cache_alloc_node_trace+0xa0/0x2c0 [0000000010608870] fuse_conn_init+0x150/0x2a0 [fuse] [0000000010609128] fuse_fill_super+0x128/0x440 [fuse] [00000000005e6040] mount_nodev+0x40/0xa0 [00000000106074fc] fuse_mount+0x1c/0x40 [fuse] [00000000005e5e14] mount_fs+0x34/0x160 [0000000000606c04] vfs_kern_mount+0x44/0xe0 [0000000000606ec8] do_new_mount+0x1e8/0x300 [00000000006071a4] do_mount+0x1c4/0x220 [0000000000607260] SyS_mount+0x60/0xa0 [00000000004062d4] linux_sparc_syscall+0x34/0x44 Fix it by setting it to only online node(nr_online_nodes). Also fix the case with FUSE_CPU with num_present_cpus. This started happening only after we moved to SLUB allocation. Slab allocation uses fallback_alloc method when node is not valid. This panic happens only on SPARC. In x86, nr_node_ids is set to only available nodes. Orabug: 25947102 Signed-off-by: Babu Moger <babu.moger@oracle.com> Reviewed-by: Ashish Samant <ashish.samant@oracle.com> Reviewed-by: Jane Chu <jane.chu@oracle.com> Signed-off-by: Allen Pais <allen.pais@oracle.com> --- diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 7be291a5ef4e..1d814cdade16 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -618,10 +618,10 @@ int fuse_conn_init(struct fuse_conn *fc, int affinity) if (affinity == FUSE_CPU) { fc->affinity = FUSE_CPU; - fc->nr_nodes = num_possible_cpus(); + fc->nr_nodes = num_present_cpus(); } else if (affinity == FUSE_NUMA) { fc->affinity = FUSE_NUMA; - fc->nr_nodes = nr_node_ids; + fc->nr_nodes = nr_online_nodes; } else { fc->affinity = FUSE_NONE; fc->nr_nodes = 1;