]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
fs/fuse: Fix for correct number of numa nodes
authorBabu Moger <babu.moger@oracle.com>
Wed, 21 Jun 2017 23:22:09 +0000 (17:22 -0600)
committerAllen Pais <allen.pais@oracle.com>
Thu, 29 Jun 2017 08:09:44 +0000 (13:39 +0530)
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>
fs/fuse/inode.c

index 7be291a5ef4e09801e758a2fefa538309cb62227..1d814cdade1685f6b8c0199a6c8639fc90f714f4 100644 (file)
@@ -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;