kernel panic / NULL pointer dereference
Hi all,
I'm just playing with an SRP connected NetApp system and just got an XFS related kernel panic. I guess it is due to large IO (32MiB). At least it just came up after enabling 32MiB device max_sectors. As the tests are running in a RHEL6 image and as I needed at least 2.6.39 to get a large srp_tablsize with SRP, I simply installed the lasted oracle uek kernel. If needed I'm going to update to a vanilla version.
Quoted 56 lines
May 10 17:31:49 sgi01 kernel: XFS (sdb): Mounting Filesystem May 10 17:31:49 sgi01 kernel: XFS (sdb): Ending clean mount May 10 17:33:00 sgi01 kernel: BUG: unable to handle kernel NULL pointer dereference at (null) May 10 17:33:00 sgi01 kernel: IP: [<ffffffffa07f5483>] xfs_alloc_ioend_bio+0x33/0x50 [xfs] May 10 17:33:00 sgi01 kernel: PGD 0 May 10 17:33:00 sgi01 kernel: Oops: 0002 [#1] SMP May 10 17:33:00 sgi01 kernel: CPU 16 May 10 17:33:00 sgi01 kernel: Modules linked in: xfs ib_srp scsi_dh_rdac scsi_transport_srp ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
ip6table_filterip6_tablesib_ucmiw_cxgb4iw_cxgb3rdma_ucmrdma_cmiw_cmib_addrib_ipoibib_cmib_saib_uverbsib_umadmlx4_ibmlx4_enmlx4_coreib_mthcaib_madib_coredm_round_robinisci libsas sg microcode qla2xxxscsi_transport_fcscsi_tgtpcspkr ghes hed wmii2c_i801i2c_coreiTCO_wdtiTCO_vendor_supportqla3xxx cciss e1000emegaraid_sasaacraid aic79xx aic7xxxata_piixmptspiscsi_transport_spimptsas mptscsih mptbase arcmsrsata_nvsata_svw3w_9xxx3w_xxxx bnx2 forcedeth ext4 jbd2 ext3 jbd mbcachesata_siltg3 e1000 nfs lockd fscacheauth_rpcgssnfs_aclsunrpcsd_modcrc_t10difmpt2sasscsi_transport_sasraid_classahci libahci igb dcadm_multipathdm_mirrordm_region_hashdm_logdm_modbe2iscsi bnx2i cnic uio ipv6 cxgb4i cxgb4 cxgb3i libcxgbi c xgb3 mdiolibiscsi_tcpqla4xxxiscsi_boot_sysfslibiscsiscsi_transport_iscsi[last unloaded:ib_srp]May 10 17:33:00 sgi01 kernel: May 10 17:33:00 sgi01 kernel: Pid: 76245, comm: flush-8:16 Not tainted 2.6.39-100.6.1.el6uek.x86_64 #1 SGI.COM SUMMIT/S2600GZ May 10 17:33:00 sgi01 kernel: RIP: 0010:[<ffffffffa07f5483>] [<ffffffffa07f5483>] xfs_alloc_ioend_bio+0x33/0x50 [xfs] May 10 17:33:00 sgi01 kernel: RSP: 0018:ffff8806687ff8b0 EFLAGS: 00010206 May 10 17:33:00 sgi01 kernel: RAX: 0000000000000000 RBX: ffff8807a9e3b5a8 RCX: ffff88080ed51b80 May 10 17:33:00 sgi01 kernel: RDX: 00000000006c6800 RSI: ffff880669c34780 RDI: 0000000000000282 May 10 17:33:00 sgi01 kernel: RBP: ffff8806687ff8c0 R08: 1e00000000000000 R09: 0000000000000002 May 10 17:33:00 sgi01 kernel: R10: ffff88083ffece00 R11: 000000000000006c R12: 0000000000000000 May 10 17:33:00 sgi01 kernel: R13: ffff88080b422f28 R14: ffff8806687ffd20 R15: 0000000000000000 May 10 17:33:00 sgi01 kernel: FS: 0000000000000000(0000) GS:ffff88083f700000(0000) knlGS:0000000000000000 May 10 17:33:00 sgi01 kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b May 10 17:33:00 sgi01 kernel: CR2: 0000000000000000 CR3: 0000000001761000 CR4: 00000000000406e0 May 10 17:33:00 sgi01 kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 May 10 17:33:00 sgi01 kernel: DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 May 10 17:33:00 sgi01 kernel: Process flush-8:16 (pid: 76245, threadinfo ffff8806687fe000, task ffff8806687d2400) May 10 17:33:00 sgi01 kernel: Stack: May 10 17:33:00 sgi01 kernel: ffffea00133f70f0 ffff8807a9e3b5a8 ffff8806687ff910 ffffffffa07f561e May 10 17:33:00 sgi01 kernel: ffffea00133f69f0 ffffea00133f5d78 0000000000000000 ffff8807a9e3b5a8 May 10 17:33:00 sgi01 kernel: ffffea0012ba90a8 ffff8806e0137190 0000000000000000 ffff88080b422f28 May 10 17:33:00 sgi01 kernel: Call Trace: May 10 17:33:00 sgi01 kernel: [<ffffffffa07f561e>] xfs_submit_ioend+0xfe/0x110 [xfs] May 10 17:33:00 sgi01 kernel: [<ffffffffa07f696b>] xfs_vm_writepage+0x26b/0x510 [xfs] May 10 17:33:00 sgi01 kernel: [<ffffffff81112377>] __writepage+0x17/0x40 May 10 17:33:00 sgi01 kernel: [<ffffffff81113696>] write_cache_pages+0x246/0x520 May 10 17:33:00 sgi01 kernel: [<ffffffff81112360>] ? set_page_dirty+0x70/0x70 May 10 17:33:00 sgi01 kernel: [<ffffffff811139c1>] generic_writepages+0x51/0x80 May 10 17:33:00 sgi01 kernel: [<ffffffffa07f537d>] xfs_vm_writepages+0x5d/0x80 [xfs] May 10 17:33:00 sgi01 kernel: [<ffffffff81113a11>] do_writepages+0x21/0x40 May 10 17:33:00 sgi01 kernel: [<ffffffff8118df2e>] writeback_single_inode+0x10e/0x270 May 10 17:33:00 sgi01 kernel: [<ffffffff8118e333>] writeback_sb_inodes+0xe3/0x1b0 May 10 17:33:00 sgi01 kernel: [<ffffffff8118e4a4>] writeback_inodes_wb+0xa4/0x170 May 10 17:33:00 sgi01 kernel: [<ffffffff8118e863>] wb_writeback+0x2f3/0x430 May 10 17:33:00 sgi01 kernel: [<ffffffff814fb28f>] ? _raw_spin_lock_irqsave+0x2f/0x40 May 10 17:33:00 sgi01 kernel: [<ffffffff811129ba>] ? determine_dirtyable_memory+0x1a/0x30 May 10 17:33:00 sgi01 kernel: [<ffffffff8118eafb>] wb_do_writeback+0x15b/0x280 May 10 17:33:00 sgi01 kernel: [<ffffffff8118ecca>] bdi_writeback_thread+0xaa/0x270 May 10 17:33:00 sgi01 kernel: [<ffffffff8118ec20>] ? wb_do_writeback+0x280/0x280 May 10 17:33:00 sgi01 kernel: [<ffffffff81089ef6>] kthread+0x96/0xa0 May 10 17:33:00 sgi01 kernel: [<ffffffff815046a4>] kernel_thread_helper+0x4/0x10 May 10 17:33:00 sgi01 kernel: [<ffffffff81089e60>] ? kthread_worker_fn+0x1a0/0x1a0 May 10 17:33:00 sgi01 kernel: [<ffffffff815046a0>] ? gs_change+0x13/0x13 May 10 17:33:00 sgi01 kernel: Code: 08 66 66 66 66 90 48 89 fb 48 8b 7f 30 e8 56 3a 9a e0 bf 10 00 00 00 89 c6 e8 ca 56 9a e0 48 8b 53 20 48 c1 ea 09 48 0f af 53 18
Quoted 8 lines
May 10 17:33:00 sgi01 kernel: RIP [<ffffffffa07f5483>] xfs_alloc_ioend_bio+0x33/0x50 [xfs] May 10 17:33:00 sgi01 kernel: RSP <ffff8806687ff8b0> May 10 17:33:00 sgi01 kernel: CR2: 0000000000000000 May 10 17:33:00 sgi01 kernel: ---[ end trace e6b492c98aa66902 ]--- May 10 17:33:00 sgi01 kernel: Kernel panic - not syncing: Fatal exception May 10 17:33:00 sgi01 kernel: Pid: 76245, comm: flush-8:16 Tainted: G D 2.6.39-100.6.1.el6uek.x86_64 #1 May 10 17:33:00 sgi01 kernel: Call Trace: May 10 17:33:00 sgi01 kernel: [<ffffffff814f83c6>] panic+0x91/0x1a8
Any idea or do I need to dig myself?
Thanks,
Bernd
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 10 lines · Bernd Schubert
Hi all,
I'm just playing with an SRP connected NetApp system and just got an XFS related kernel panic. I guess it is due to large IO (32MiB). At least it just came up after enabling 32MiB device
max_sectors. As the tests are running in a RHEL6 image and as I needed at least 2.6.39 to get a largesrp_tablsizewith SRP, I simply installed the lasted oracle uek kernel. If needed I'm going to update to a vanilla version.Quoted 4 lines
May 10 17:31:49 sgi01 kernel: XFS (sdb): Mounting Filesystem May 10 17:31:49 sgi01 kernel: XFS (sdb): Ending clean mount May 10 17:33:00 sgi01 kernel: BUG: unable to handle kernel NULL pointer dereference at (null) May 10 17:33:00 sgi01 kernel: IP: [<ffffffffa07f5483>] xfs_alloc_ioend_bio+0x33/0x50 [xfs]
You'll probably need to disassemble that yourself to be sure where it blew up, but I'm guessing bio_alloc() failed. Upstream,with GFP_NOIO, it's not supposed to happen thanks to mempools:
* If %__GFP_WAIT is set, then bio_alloc will always be able to allocate * a bio. This is due to the mempool guarantees. To make this work, callers * must never allocate more than 1 bio at a time from this pool. Callers * that need to allocate more than 1 bio must always submit the previously * allocated bio for IO before attempting to allocate a new one. Failure to * do so can cause livelocks under memory pressure.
But, I don't know what's in your oracle kernel... can you hit it upstream?
-Eric
Quoted 65 lines
Quoted 52 lines
May 10 17:33:00 sgi01 kernel: PGD 0 May 10 17:33:00 sgi01 kernel: Oops: 0002 [#1] SMP May 10 17:33:00 sgi01 kernel: CPU 16 May 10 17:33:00 sgi01 kernel: Modules linked in: xfs ib_srp scsi_dh_rdac scsi_transport_srp ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
ip6table_filterip6_tablesib_ucmiw_cxgb4iw_cxgb3rdma_ucmrdma_cmiw_cmib_addrib_ipoibib_cmib_saib_uverbsib_umadmlx4_ibmlx4_enmlx4_coreib_mthcaib_madib_coredm_round_robinisci libsas sg microcode qla2xxxscsi_transport_fcscsi_tgtpcspkr ghes hed wmii2c_i801i2c_coreiTCO_wdtiTCO_vendor_supportqla3xxx cciss e1000emegaraid_sasaacraid aic79xx aic7xxxata_piixmptspiscsi_transport_spimptsas mptscsih mptbase arcmsrsata_nvsata_svw3w_9xxx3w_xxxx bnx2 forcedeth ext4 jbd2 ext3 jbd mbcachesata_siltg3 e1000 nfs lockd fscacheauth_rpcgssnfs_aclsunrpcsd_modcrc_t10difmpt2sasscsi_transport_sasraid_classahci libahci igb dcadm_multipathdm_mirrordm_region_hashdm_logdm_modbe2iscsi bnx2i cnic uio ipv6 cxgb4i cxgb4 cxgb3i libcxgbi c xgb3 mdiolibiscsi_tcpqla4xxxiscsi_boot_sysfslibiscsiscsi_transport_iscsi[last unloaded:ib_srp]May 10 17:33:00 sgi01 kernel: May 10 17:33:00 sgi01 kernel: Pid: 76245, comm: flush-8:16 Not tainted 2.6.39-100.6.1.el6uek.x86_64 #1 SGI.COM SUMMIT/S2600GZ May 10 17:33:00 sgi01 kernel: RIP: 0010:[<ffffffffa07f5483>] [<ffffffffa07f5483>] xfs_alloc_ioend_bio+0x33/0x50 [xfs] May 10 17:33:00 sgi01 kernel: RSP: 0018:ffff8806687ff8b0 EFLAGS: 00010206 May 10 17:33:00 sgi01 kernel: RAX: 0000000000000000 RBX: ffff8807a9e3b5a8 RCX: ffff88080ed51b80 May 10 17:33:00 sgi01 kernel: RDX: 00000000006c6800 RSI: ffff880669c34780 RDI: 0000000000000282 May 10 17:33:00 sgi01 kernel: RBP: ffff8806687ff8c0 R08: 1e00000000000000 R09: 0000000000000002 May 10 17:33:00 sgi01 kernel: R10: ffff88083ffece00 R11: 000000000000006c R12: 0000000000000000 May 10 17:33:00 sgi01 kernel: R13: ffff88080b422f28 R14: ffff8806687ffd20 R15: 0000000000000000 May 10 17:33:00 sgi01 kernel: FS: 0000000000000000(0000) GS:ffff88083f700000(0000) knlGS:0000000000000000 May 10 17:33:00 sgi01 kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b May 10 17:33:00 sgi01 kernel: CR2: 0000000000000000 CR3: 0000000001761000 CR4: 00000000000406e0 May 10 17:33:00 sgi01 kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 May 10 17:33:00 sgi01 kernel: DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 May 10 17:33:00 sgi01 kernel: Process flush-8:16 (pid: 76245, threadinfo ffff8806687fe000, task ffff8806687d2400) May 10 17:33:00 sgi01 kernel: Stack: May 10 17:33:00 sgi01 kernel: ffffea00133f70f0 ffff8807a9e3b5a8 ffff8806687ff910 ffffffffa07f561e May 10 17:33:00 sgi01 kernel: ffffea00133f69f0 ffffea00133f5d78 0000000000000000 ffff8807a9e3b5a8 May 10 17:33:00 sgi01 kernel: ffffea0012ba90a8 ffff8806e0137190 0000000000000000 ffff88080b422f28 May 10 17:33:00 sgi01 kernel: Call Trace: May 10 17:33:00 sgi01 kernel: [<ffffffffa07f561e>] xfs_submit_ioend+0xfe/0x110 [xfs] May 10 17:33:00 sgi01 kernel: [<ffffffffa07f696b>] xfs_vm_writepage+0x26b/0x510 [xfs] May 10 17:33:00 sgi01 kernel: [<ffffffff81112377>] __writepage+0x17/0x40 May 10 17:33:00 sgi01 kernel: [<ffffffff81113696>] write_cache_pages+0x246/0x520 May 10 17:33:00 sgi01 kernel: [<ffffffff81112360>] ? set_page_dirty+0x70/0x70 May 10 17:33:00 sgi01 kernel: [<ffffffff811139c1>] generic_writepages+0x51/0x80 May 10 17:33:00 sgi01 kernel: [<ffffffffa07f537d>] xfs_vm_writepages+0x5d/0x80 [xfs] May 10 17:33:00 sgi01 kernel: [<ffffffff81113a11>] do_writepages+0x21/0x40 May 10 17:33:00 sgi01 kernel: [<ffffffff8118df2e>] writeback_single_inode+0x10e/0x270 May 10 17:33:00 sgi01 kernel: [<ffffffff8118e333>] writeback_sb_inodes+0xe3/0x1b0 May 10 17:33:00 sgi01 kernel: [<ffffffff8118e4a4>] writeback_inodes_wb+0xa4/0x170 May 10 17:33:00 sgi01 kernel: [<ffffffff8118e863>] wb_writeback+0x2f3/0x430 May 10 17:33:00 sgi01 kernel: [<ffffffff814fb28f>] ? _raw_spin_lock_irqsave+0x2f/0x40 May 10 17:33:00 sgi01 kernel: [<ffffffff811129ba>] ? determine_dirtyable_memory+0x1a/0x30 May 10 17:33:00 sgi01 kernel: [<ffffffff8118eafb>] wb_do_writeback+0x15b/0x280 May 10 17:33:00 sgi01 kernel: [<ffffffff8118ecca>] bdi_writeback_thread+0xaa/0x270 May 10 17:33:00 sgi01 kernel: [<ffffffff8118ec20>] ? wb_do_writeback+0x280/0x280 May 10 17:33:00 sgi01 kernel: [<ffffffff81089ef6>] kthread+0x96/0xa0 May 10 17:33:00 sgi01 kernel: [<ffffffff815046a4>] kernel_thread_helper+0x4/0x10 May 10 17:33:00 sgi01 kernel: [<ffffffff81089e60>] ? kthread_worker_fn+0x1a0/0x1a0 May 10 17:33:00 sgi01 kernel: [<ffffffff815046a0>] ? gs_change+0x13/0x13 May 10 17:33:00 sgi01 kernel: Code: 08 66 66 66 66 90 48 89 fb 48 8b 7f 30 e8 56 3a 9a e0 bf 10 00 00 00 89 c6 e8 ca 56 9a e0 48 8b 53 20 48 c1 ea 09 48 0f af 53 18Quoted 8 lines
May 10 17:33:00 sgi01 kernel: RIP [<ffffffffa07f5483>] xfs_alloc_ioend_bio+0x33/0x50 [xfs] May 10 17:33:00 sgi01 kernel: RSP <ffff8806687ff8b0> May 10 17:33:00 sgi01 kernel: CR2: 0000000000000000 May 10 17:33:00 sgi01 kernel: ---[ end trace e6b492c98aa66902 ]--- May 10 17:33:00 sgi01 kernel: Kernel panic - not syncing: Fatal exception May 10 17:33:00 sgi01 kernel: Pid: 76245, comm: flush-8:16 Tainted: G D 2.6.39-100.6.1.el6uek.x86_64 #1 May 10 17:33:00 sgi01 kernel: Call Trace: May 10 17:33:00 sgi01 kernel: [<ffffffff814f83c6>] panic+0x91/0x1a8Any idea or do I need to dig myself?
Quoted 8 lines
Thanks,
Bernd_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 17 lines · Bernd Schubert
Hi all,
I'm just playing with an SRP connected NetApp system and just got an XFS related kernel panic. I guess it is due to large IO (32MiB). At least it just came up after enabling 32MiB device
max_sectors.
As the tests are running in a RHEL6 image and as I needed at least 2.6.39 to get a largesrp_tablsizewith SRP, I simply installed the lasted oracle uek kernel. If needed I'm going to update to a vanilla version.Quoted 6 lines
May 10 17:31:49 sgi01 kernel: XFS (sdb): Mounting Filesystem May 10 17:31:49 sgi01 kernel: XFS (sdb): Ending clean mount May 10 17:33:00 sgi01 kernel: BUG: unable to handle kernel NULL pointer dereference at (null) May 10 17:33:00 sgi01 kernel: IP: [<ffffffffa07f5483>]
xfs_alloc_ioend_bio+0x33/0x50[xfs]
Oh, there is a bio allocation path to return NULL:
bvec_alloc_bs(gfp_mask, nr_iovecs, ) => NULL when nr_iovecs > BIO_MAX_PAGES bio_alloc_bioset(gfp_mask, nr_iovecs, ...)bio_alloc(GFP_NOIO, nvecs)xfs_alloc_ioend_bio()
And nvecs/nr_iovecs is obtained by bio_get_nr_vecs(), which does not check for BIO_MAX_PAGES. Of course, all of that only happens with large IO sizes, which is exactly what I'm doing.
As xfs_alloc_ioend_bio() is using GFP_NOIO it does not expect bio_alloc to fail, but as I'm trying to send large IOs I guess that is exactly what happens here.
Quoted 9 lines
May 10 17:33:00 sgi01 kernel: [<ffffffffa07f561e>] xfs_submit_ioend+0xfe/0x110 [xfs] May 10 17:33:00 sgi01 kernel: [<ffffffffa07f696b>] xfs_vm_writepage+0x26b/0x510 [xfs] May 10 17:33:00 sgi01 kernel: [<ffffffff81112377>] __writepage+0x17/0x40 May 10 17:33:00 sgi01 kernel: [<ffffffff81113696>] write_cache_pages+0x246/0x520 May 10 17:33:00 sgi01 kernel: [<ffffffff81112360>] ? set_page_dirty+0x70/0x70 May 10 17:33:00 sgi01 kernel: [<ffffffff811139c1>] generic_writepages+0x51/0x80 May 10 17:33:00 sgi01 kernel: [<ffffffffa07f537d>] xfs_vm_writepages+0x5d/0x80 [xfs] May 10 17:33:00 sgi01 kernel: [<ffffffff81113a11>] do_writepages+0x21/0x40 May 10 17:33:00 sgi01 kernel: [<ffffffff8118df2e>] writeback_single_inode+0x10e/0x270
PATCH 1/1 bio allocation failure due to bio_get_nr_vecs()
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
May 10 17:31:49 sgi01 kernel: XFS (sdb): Mounting Filesystem May 10 17:31:49 sgi01 kernel: XFS (sdb): Ending clean mount May 10 17:33:00 sgi01 kernel: BUG: unable to handle kernel NULL pointer dereference at (null) May 10 17:33:00 sgi01 kernel: IP: [<ffffffffa07f5483>]
xfs_alloc_ioend_bio+0x33/0x50[xfs]Oh, there is a bio allocation path to return NULL:
bvec_alloc_bs(gfp_mask, nr_iovecs, )=> NULL whennr_iovecs>BIO_MAX_PAGESbio_alloc_bioset(gfp_mask, nr_iovecs, ...)bio_alloc(GFP_NOIO, nvecs)xfs_alloc_ioend_bio()
Quoted 5 lines
And nvecs/nr_iovecs is obtained by
bio_get_nr_vecs(), which does not check forBIO_MAX_PAGES. Of course, all of that only happens with large IO sizes, which is exactly what I'm doing.
Asxfs_alloc_ioend_bio()is usingGFP_NOIOit does not expectbio_allocto fail, but as I'm trying to send large IOs I guess that is exactly what happens here.
I see that Kent already fixed an overflow issue
in commit 5abebfdd02450fa1349daacf242e70b3736581e3. But even with this commit, bio_get_nr_vecs() still only checks for queue_max_segments(). As we have a maximum of 2048 segments, that does not help much here.
After cherry-picking 5abebfdd02450fa1349daacf242e70b3736581e3 and applying the patch below, I didn't run into panics / NULL pointer dereferences anymore.
bio: bio_get_nr_vecs() must not return more than BIO_MAX_PAGES
From: Bernd Schubert <[email protected]>
The number of bio_get_nr_vecs() is passed down via bio_alloc() to bvec_alloc_bs(), which fails the bio allocation if nr_iovecs > BIO_MAX_PAGES. For the underlying caller this causes an unexpected bio allocation failure.
Limiting to queue_max_segments() is not sufficient, as max_segments also might be very large.
bvec_alloc_bs(gfp_mask, nr_iovecs, ) => NULL when nr_iovecs > BIO_MAX_PAGES bio_alloc_bioset(gfp_mask, nr_iovecs, ...)bio_alloc(GFP_NOIO, nvecs)xfs_alloc_ioend_bio()
--- fs/bio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/bio.c +6 -1
@@ -505,9 +505,14 @@ EXPORT_SYMBOL(bio_clone);int bio_get_nr_vecs (struct block_device *bdev) {struct request_queue *q =bdev_get_queue (bdev); -return min_t (unsigned, +int nr_pages; + + nr_pages =min_t (unsigned,queue_max_segments (q),queue_max_sectors (q) / (PAGE_SIZE >>9 ) +1 ); + +return min_t (unsigned, nr_pages,BIO_MAX_PAGES ); + }EXPORT_SYMBOL (bio_get_nr_vecs);
Re: [PATCH] bio allocation failure due to bio_get_nr_vecs()
fs/bio.c EXPORT_SYMBOL(bio_clone); · line 508
Quoted 10 lines · Bernd Schubert
fs/bio.c +1
-1@@ -505,9 +505,14 @@ EXPORT_SYMBOL(bio_clone);int bio_get_nr_vecs (struct block_device *bdev) {struct request_queue *q =bdev_get_queue (bdev); - return min_t(unsigned, +int nr_pages;
Looks like a corrupt patch.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH] bio allocation failure due to bio_get_nr_vecs()
Quoted 14 lines · Jeff Moyer
fs/bio.c EXPORT_SYMBOL(bio_clone); · line 508
Quoted 10 lines · Bernd Schubert
fs/bio.c +1
-1@@ -505,9 +505,14 @@ EXPORT_SYMBOL(bio_clone);int bio_get_nr_vecs (struct block_device *bdev) {struct request_queue *q =bdev_get_queue (bdev); - return min_t(unsigned, +int nr_pages;Looks like a corrupt patch.
What do you actually mean? Issue by thunderbird? I just saved the mail in my sent folder and it looks? Just to be sure, patch attached.
Thanks,
Bernd
bio: bio_get_nr_vecs() must not return more than BIO_MAX_PAGES
From: Bernd Schubert <[email protected]>
The number of bio_get_nr_vecs() is passed down via bio_alloc() to bvec_alloc_bs(), which fails the bio allocation if nr_iovecs > BIO_MAX_PAGES. For the underlying caller this causes an unexpected bio allocation failure.
Limiting to queue_max_segments() is not sufficiet, as max_segments also might be very large.
bvec_alloc_bs(gfp_mask, nr_iovecs, ) => NULL when nr_iovecs > BIO_MAX_PAGES bio_alloc_bioset(gfp_mask, nr_iovecs, ...)bio_alloc(GFP_NOIO, nvecs)xfs_alloc_ioend_bio()
--- fs/bio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/bio.c +6 -1
@@ -505,9 +505,14 @@ EXPORT_SYMBOL(bio_clone);int bio_get_nr_vecs (struct block_device *bdev) {struct request_queue *q =bdev_get_queue (bdev); -return min_t (unsigned, +int nr_pages; + + nr_pages =min_t (unsigned,queue_max_segments (q),queue_max_sectors (q) / (PAGE_SIZE >>9 ) +1 ); + +return min_t (unsigned, nr_pages,BIO_MAX_PAGES ); + }EXPORT_SYMBOL (bio_get_nr_vecs);
Re: [PATCH] bio allocation failure due to bio_get_nr_vecs()
In reply to Jeff MoyerQuoted 14 lines · Jeff Moyer
fs/bio.c EXPORT_SYMBOL(bio_clone); · line 508
Quoted 10 lines · Bernd Schubert
fs/bio.c +1
-1@@ -505,9 +505,14 @@ EXPORT_SYMBOL(bio_clone);int bio_get_nr_vecs (struct block_device *bdev) {struct request_queue *q =bdev_get_queue (bdev); - return min_t(unsigned, +int nr_pages;Looks like a corrupt patch.
It's fine, I think you are misreading the added and removed lines :-)
Signature · 6 lines
Jens Axboe _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH] bio allocation failure due to bio_get_nr_vecs()
Quoted 16 lines · Jens Axboe
Quoted 14 lines · Jeff Moyer
fs/bio.c EXPORT_SYMBOL(bio_clone); · line 508
Quoted 10 lines · Bernd Schubert
fs/bio.c +1
-1@@ -505,9 +505,14 @@ EXPORT_SYMBOL(bio_clone);int bio_get_nr_vecs (struct block_device *bdev) {struct request_queue *q =bdev_get_queue (bdev); - return min_t(unsigned, +int nr_pages;Looks like a corrupt patch.
Quoted 1 line
It's fine, I think you are misreading the added and removed lines :-)
Whoops, sorry!
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH] bio allocation failure due to bio_get_nr_vecs()
In reply to Bernd SchubertQuoted 11 lines · Bernd Schubert
The number of
bio_get_nr_vecs()is passed down viabio_alloc()tobvec_alloc_bs(), which fails the bio allocation ifnr_iovecs>BIO_MAX_PAGES. For the underlying caller this causes an unexpected bio allocation failure.
Limiting toqueue_max_segments()is not sufficient, asmax_segmentsalso might be very large.
bvec_alloc_bs(gfp_mask, nr_iovecs, )=> NULL whennr_iovecs>BIO_MAX_PAGESbio_alloc_bioset(gfp_mask, nr_iovecs, ...)bio_alloc(GFP_NOIO, nvecs)xfs_alloc_ioend_bio()
Thanks, looks sane. Applied.
Signature · 6 lines
Jens Axboe _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH] bio allocation failure due to bio_get_nr_vecs()
Quoted 8 lines · Jens Axboe
Quoted 7 lines · Bernd Schubert
The number of
bio_get_nr_vecs()is passed down viabio_alloc()tobvec_alloc_bs(), which fails the bio allocation ifnr_iovecs>BIO_MAX_PAGES. For the underlying caller this causes an unexpected bio allocation failure.
Limiting toqueue_max_segments()is not sufficient, asmax_segmentsalso might be very large.
Quoted 7 lines
Quoted 4 lines
bvec_alloc_bs(gfp_mask, nr_iovecs, )=> NULL whennr_iovecs>BIO_MAX_PAGESbio_alloc_bioset(gfp_mask, nr_iovecs, ...)bio_alloc(GFP_NOIO, nvecs)xfs_alloc_ioend_bio()Thanks, looks sane. Applied.
Great, thanks! Should we CC linux-stable for commit 5abebfdd02450fa1349daacf242e70b3736581e3 and this one, as I got a hard kernel panic?
Thanks,
Bernd
Re: [PATCH] bio allocation failure due to bio_get_nr_vecs()
Quoted 14 lines · Bernd Schubert
Quoted 13 lines · Jens Axboe
Quoted 11 lines · Bernd Schubert
The number of
bio_get_nr_vecs()is passed down viabio_alloc()tobvec_alloc_bs(), which fails the bio allocation ifnr_iovecs>BIO_MAX_PAGES. For the underlying caller this causes an unexpected bio allocation failure.
Limiting toqueue_max_segments()is not sufficient, asmax_segmentsalso might be very large.
bvec_alloc_bs(gfp_mask, nr_iovecs, )=> NULL whennr_iovecs>BIO_MAX_PAGESbio_alloc_bioset(gfp_mask, nr_iovecs, ...)bio_alloc(GFP_NOIO, nvecs)xfs_alloc_ioend_bio()
Quoted 6 lines
Quoted 2 lines
Thanks, looks sane. Applied.
Great, thanks! Should we CC linux-stable for commit
5abebfdd02450fa1349daacf242e70b3736581e3and this one, as I got a hard kernel panic?
Yes, that's a good idea. I've ammended the commit now to include stable.
Signature · 1 line
Jens Axboe