4.9.3-stable review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 187/206 xfs: use new extent lookup helpers xfs_file_iomap_begin_delay
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
commit 656152e552e5cbe0c11ad261b524376217c2fb13 upstream.
And only lookup the previous extent inside xfs_iomap_prealloc_size if we actually need it.
--- fs/xfs/xfs_iomap.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
fs/xfs/xfs_iomap.c +9 -11
@@ -395,11 +395,12 @@ xfs_iomap_prealloc_size(struct xfs_inode *ip, loff_t offset, loff_t count, - xfs_extnum_t idx, - struct xfs_bmbt_irec *prev) + xfs_extnum_t idx) { struct xfs_mount *mp = ip->i_mount; +struct xfs_ifork *ifp =XFS_IFORK_PTR (ip,XFS_DATA_FORK );xfs_fileoff_t offset_fsb =XFS_B_TO_FSBT (mp, offset); +struct xfs_bmbt_irec prev;int shift =0 ;int64_t freesp;xfs_fsblock_t qblocks;
@@ -419,8 +420,8 @@ xfs_iomap_prealloc_size(*/ if ((mp->m_flags &XFS_MOUNT_DFLT_IOSIZE ) ||XFS_ISIZE (ip) <XFS_FSB_TO_B (mp, mp->m_dalign) || - idx ==0 || - prev->br_startoff + prev->br_blockcount < offset_fsb) + !xfs_iext_get_extent (ifp, idx -1 , &prev) || + prev.br_startoff + prev.br_blockcount < offset_fsb)return mp->m_writeio_blocks;/*
@@ -439,8 +440,8 @@ xfs_iomap_prealloc_size(* always extends to MAXEXTLEN rather than falling short due to things * like stripe unit/width alignment of real extents. */ -if (prev->br_blockcount <= (MAXEXTLEN >>1 )) - alloc_blocks = prev->br_blockcount <<1 ; +if (prev.br_blockcount <= (MAXEXTLEN >>1 )) + alloc_blocks = prev.br_blockcount <<1 ;else alloc_blocks =XFS_B_TO_FSB (mp, offset);if (!alloc_blocks)
@@ -538,7 +539,6 @@ xfs_file_iomap_begin_delay(xfs_fileoff_t end_fsb, orig_end_fsb;int error =0 , eof =0 ;struct xfs_bmbt_irec got; -struct xfs_bmbt_irec prev;xfs_extnum_t idx;ASSERT (!XFS_IS_REALTIME_INODE (ip));
@@ -563,8 +563,7 @@ xfs_file_iomap_begin_delay( goto out_unlock; } -xfs_bmap_search_extents (ip, offset_fsb,XFS_DATA_FORK , &eof, &idx, - &got, &prev); + eof = !xfs_iext_lookup_extent (ip, ifp, offset_fsb, &idx, &got);if (!eof && got.br_startoff <= offset_fsb) {if (xfs_is_reflink_inode (ip)) {bool shared;
@@ -601,8 +600,7 @@ xfs_file_iomap_begin_delay(if (eof) {xfs_fsblock_t prealloc_blocks; - prealloc_blocks = -xfs_iomap_prealloc_size (ip, offset, count, idx, &prev); + prealloc_blocks =xfs_iomap_prealloc_size (ip, offset, count, idx);if (prealloc_blocks) {xfs_extlen_t align;xfs_off_t end_offset;
Greg Kroah-Hartman
maintainerPATCH 189/206 xfs: Move AGI buffer type setting to xfs_read_agi
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <[email protected]>
commit 200237d6746faaeaf7f4ff4abbf13f3917cee60a upstream.
We've missed properly setting the buffer type for an AGI transaction in 3 spots now, so just move it into xfs_read_agi() and set it if we are in a transaction to avoid the problem in the future.
This is similar to how it is done in i.e. the dir3 and attr3 read functions.
--- fs/xfs/libxfs/xfs_ialloc.c | 4 ++-- fs/xfs/xfs_inode.c | 2 -- fs/xfs/xfs_log_recover.c | 1 - 3 files changed, 2 insertions(+), 5 deletions(-)
fs/xfs/libxfs/xfs_ialloc.c +2 -2
@@ -2450,8 +2450,6 @@ xfs_ialloc_log_agi(ASSERT (agi->agi_magicnum ==cpu_to_be32 (XFS_AGI_MAGIC ));#endif -xfs_trans_buf_set_type (tp, bp,XFS_BLFT_AGI_BUF ); -/* * Compute byte offsets for the first and last fields in the first * region and log the agi buffer. This only logs up through
@@ -2592,6 +2590,8 @@ xfs_read_agi( XFS_FSS_TO_BB(mp, 1), 0, bpp, &xfs_agi_buf_ops);if (error)return error; +if (tp) +xfs_trans_buf_set_type (tp, *bpp,XFS_BLFT_AGI_BUF );xfs_buf_set_ref (*bpp,XFS_AGI_REF );return 0 ;
fs/xfs/xfs_inode.c +0 -2
@@ -2041,7 +2041,6 @@ xfs_iunlink( agi->agi_unlinked[bucket_index] =cpu_to_be32 (agino); offset = offsetof(xfs_agi_t , agi_unlinked) + (sizeof (xfs_agino_t) * bucket_index); -xfs_trans_buf_set_type (tp, agibp,XFS_BLFT_AGI_BUF );xfs_trans_log_buf (tp, agibp, offset, (offset +sizeof (xfs_agino_t) -1 ));return 0 ;
@@ -2133,7 +2132,6 @@ xfs_iunlink_remove( agi->agi_unlinked[bucket_index] =cpu_to_be32 (next_agino); offset = offsetof(xfs_agi_t , agi_unlinked) + (sizeof (xfs_agino_t) * bucket_index); -xfs_trans_buf_set_type (tp, agibp,XFS_BLFT_AGI_BUF );xfs_trans_log_buf (tp, agibp, offset, (offset +sizeof (xfs_agino_t) -1 )); }else {
fs/xfs/xfs_log_recover.c +0 -1
@@ -4929,7 +4929,6 @@ xlog_recover_clear_agi_bucket( agi->agi_unlinked[bucket] =cpu_to_be32 (NULLAGINO ); offset = offsetof(xfs_agi_t , agi_unlinked) + (sizeof (xfs_agino_t) * bucket); -xfs_trans_buf_set_type (tp, agibp,XFS_BLFT_AGI_BUF );xfs_trans_log_buf (tp, agibp, offset, (offset +sizeof (xfs_agino_t) -1 ));
Greg Kroah-Hartman
maintainerPATCH 190/206 xfs: pass state not whichfork to trace_xfs_extlist
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <[email protected]>
commit 7710517fc37b1899722707883b54694ea710b3c0 upstream.
When xfs_bmap_trace_exlist called trace_xfs_extlist, it sent in the "whichfork" var instead of the bmap "state" as expected (even though state was already set up for this purpose).
As a result, the xfs_bmap_class in tracing code used "whichfork" not state in xfs_iext_state_to_fork(), and got the wrong ifork pointer. It all goes downhill from there, including an ASSERT when ifp_bytes is empty by the time it reaches xfs_iext_get_ext():
XFS: Assertion failed: idx < ifp->if_bytes / sizeof(xfs_bmbt_rec_t)
--- fs/xfs/libxfs/xfs_bmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_bmap.c +1 -1
@@ -531,7 +531,7 @@ xfs_bmap_trace_exlist( ifp =XFS_IFORK_PTR (ip, whichfork);ASSERT (cnt ==xfs_iext_count (ifp));for (idx =0 ; idx < cnt; idx++) -trace_xfs_extlist (ip, idx, whichfork, caller_ip); +trace_xfs_extlist (ip, idx, state, caller_ip); }/*
Greg Kroah-Hartman
maintainerPATCH 191/206 xfs: handle cow fork in xfs_bmap_trace_exlist
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <[email protected]>
commit c44a1f22626c153976289e1cd67bdcdfefc16e1f upstream.
By inspection, xfs_bmap_trace_exlist isn't handling cow forks, and will trace the data fork instead.
Fix this by setting state appropriately if whichfork == XFS_COW_FORK.
()___()
< @ @ >
| |
{o_o}
(|)
--- fs/xfs/libxfs/xfs_bmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_bmap.c +3 -1
@@ -518,7 +518,7 @@ voidxfs_bmap_trace_exlist ( xfs_inode_t *ip,/* incore inode pointer */ xfs_extnum_t cnt, /* count of entries in the list */ - int whichfork, /* data or attr fork */ + int whichfork, /* data or attr or cow fork */ unsigned long caller_ip) {xfs_extnum_t idx;/* extent record index */
@@ -527,6 +527,8 @@ xfs_bmap_trace_exlist(if (whichfork ==XFS_ATTR_FORK ) state |=BMAP_ATTRFORK ; +else if (whichfork ==XFS_COW_FORK ) + state |=BMAP_COWFORK ; ifp =XFS_IFORK_PTR (ip, whichfork);ASSERT (cnt ==xfs_iext_count (ifp));
Greg Kroah-Hartman
maintainerPATCH 192/206 xfs: forbid AG btrees with level == 0
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit d2a047f31e86941fa896e0e3271536d50aba415e upstream.
There is no such thing as a zero-level AG btree since even a single-node zero-records btree has one level. Btree cursor constructors read cur_nlevels straight from disk and then access things like cur_bufs[cur_nlevels - 1] which is /really/ bad if cur_nlevels is zero! Therefore, strengthen the verifiers to prevent this possibility.
--- fs/xfs/libxfs/xfs_alloc.c | 10 +++++++--- fs/xfs/libxfs/xfs_ialloc.c | 9 ++++++++- 2 files changed, 15 insertions(+), 4 deletions(-)
fs/xfs/libxfs/xfs_alloc.c +7 -3
@@ -2455,12 +2455,15 @@ xfs_agf_verify( be32_to_cpu(agf->agf_flcount) <= XFS_AGFL_SIZE(mp)))return false; -if (be32_to_cpu (agf->agf_levels[XFS_BTNUM_BNO ]) >XFS_BTREE_MAXLEVELS || +if (be32_to_cpu (agf->agf_levels[XFS_BTNUM_BNO ]) <1 || +be32_to_cpu (agf->agf_levels[XFS_BTNUM_CNT ]) <1 || +be32_to_cpu (agf->agf_levels[XFS_BTNUM_BNO ]) >XFS_BTREE_MAXLEVELS ||be32_to_cpu (agf->agf_levels[XFS_BTNUM_CNT ]) >XFS_BTREE_MAXLEVELS )return false;if (xfs_sb_version_hasrmapbt (&mp->m_sb) && -be32_to_cpu (agf->agf_levels[XFS_BTNUM_RMAP ]) >XFS_BTREE_MAXLEVELS ) + (be32_to_cpu (agf->agf_levels[XFS_BTNUM_RMAP ]) <1 || +be32_to_cpu (agf->agf_levels[XFS_BTNUM_RMAP ]) >XFS_BTREE_MAXLEVELS ))return false;/*
@@ -2477,7 +2480,8 @@ xfs_agf_verify(return false;if (xfs_sb_version_hasreflink (&mp->m_sb) && -be32_to_cpu (agf->agf_refcount_level) >XFS_BTREE_MAXLEVELS ) + (be32_to_cpu (agf->agf_refcount_level) <1 || +be32_to_cpu (agf->agf_refcount_level) >XFS_BTREE_MAXLEVELS ))return false;return true;;
fs/xfs/libxfs/xfs_ialloc.c +8 -1
@@ -2510,8 +2510,15 @@ xfs_agi_verify(if (!XFS_AGI_GOOD_VERSION (be32_to_cpu (agi->agi_versionnum)))return false; -if (be32_to_cpu (agi->agi_level) >XFS_BTREE_MAXLEVELS ) +if (be32_to_cpu (agi->agi_level) <1 || +be32_to_cpu (agi->agi_level) >XFS_BTREE_MAXLEVELS )return false; + +if (xfs_sb_version_hasfinobt (&mp->m_sb) && + (be32_to_cpu (agi->agi_free_level) <1 || +be32_to_cpu (agi->agi_free_level) >XFS_BTREE_MAXLEVELS )) +return false; +/* * during growfs operations, the perag is not fully initialised, * so we can't use it for any useful checking. growfs ensures we can't
Greg Kroah-Hartman
maintainerPATCH 158/206 PCI: rockchip: Fix negotiated lanes calculation
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <[email protected]>
commit 45e9320f3a4ef9588ee50a2eb1891c4bfdbb07df upstream.
The calculation of negotiated lanes is wrong: it should be shifted by PCIE_CORE_PL_CONF_LANE_SHIFT, but it is shifted by PCIE_CORE_PL_CONF_LANE_MASK instead. Let's fix it.
--- drivers/pci/host/pcie-rockchip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/host/pcie-rockchip.c +2 -2
@@ -590,8 +590,8 @@ static int rockchip_pcie_init_port(struc/* Check the final link width from negotiated lane counter from MGMT */ status =rockchip_pcie_read (rockchip,PCIE_CORE_CTRL ); - status =0x1 << ((status &PCIE_CORE_PL_CONF_LANE_MASK ) >> -PCIE_CORE_PL_CONF_LANE_MASK ); + status =0x1 << ((status &PCIE_CORE_PL_CONF_LANE_MASK ) >> +PCIE_CORE_PL_CONF_LANE_SHIFT );dev_dbg (dev,"current link width is x%d\n" , status); rockchip_pcie_write(rockchip, ROCKCHIP_VENDOR_ID,
Greg Kroah-Hartman
maintainerPATCH 194/206 xfs: complain if we dont get nextents bmap records
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit 356a3225222e5bc4df88aef3419fb6424f18ab69 upstream.
When reading into memory all extents of a btree-format inode fork, complain if the number of extents we find is not the same as the number of extents reported in the inode core. This is needed to stop an IO action from accessing the garbage areas of the in-core fork.
[dchinner: removed redundant assert]
--- fs/xfs/libxfs/xfs_bmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_bmap.c +2 -1
@@ -1377,8 +1377,9 @@ xfs_bmap_read_extents(return error; block =XFS_BUF_TO_BLOCK (bp); } +if (i !=XFS_IFORK_NEXTENTS (ip, whichfork)) +return -EFSCORRUPTED ;ASSERT (i ==xfs_iext_count (ifp)); -ASSERT (i ==XFS_IFORK_NEXTENTS (ip, whichfork));XFS_BMAP_TRACE_EXLIST (ip, i, whichfork);return 0 ; error0:
Greg Kroah-Hartman
maintainerPATCH 195/206 xfs: dont crash if reading a directory results in an unexpected hole
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit 96a3aefb8ffde23180130460b0b2407b328eb727 upstream.
In xfs_dir3_data_read, we can encounter the situation where err == 0 and *bpp == NULL if the given bno offset happens to be a hole; this leads to a crash if we try to set the buffer type after the _da_read_buf call. Holes can happen due to corrupt or malicious entries in the bmbt data, so be a little more careful when we're handling buffers.
--- fs/xfs/libxfs/xfs_dir2_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_dir2_data.c +1 -1
@@ -329,7 +329,7 @@ xfs_dir3_data_read( err =xfs_da_read_buf (tp, dp, bno, mapped_bno, bpp,XFS_DATA_FORK , &xfs_dir3_data_buf_ops); -if (!err && tp) +if (!err && tp && *bpp)xfs_trans_buf_set_type (tp, *bpp,XFS_BLFT_DIR_DATA_BUF );return err; }
Greg Kroah-Hartman
maintainerPATCH 159/206 PCI: rockchip: Correct the use of FTS mask
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Norris <[email protected]>
commit a45e2611b9bbd81288d97d02ce7e74a60a698d43 upstream.
We're trying to mask out bits[23:8] while retaining [32:24, 7:0], but we're doing the inverse. That doesn't have too much effect, since we're setting all the [23:8] bits to 1, and the other bits are only relevant for modes we're currently not using. But we should get this right.
--- drivers/pci/host/pcie-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pcie-rockchip.c +1 -1
@@ -533,7 +533,7 @@ static int rockchip_pcie_init_port(struc/* Fix the transmitted FTS count desired to exit from L0s. */ status =rockchip_pcie_read (rockchip,PCIE_CORE_CTRL_PLC1 ); - status = (status &PCIE_CORE_CTRL_PLC1_FTS_MASK ) | + status = (status & ~PCIE_CORE_CTRL_PLC1_FTS_MASK ) | (PCIE_CORE_CTRL_PLC1_FTS_CNT <<PCIE_CORE_CTRL_PLC1_FTS_SHIFT );rockchip_pcie_write (rockchip, status,PCIE_CORE_CTRL_PLC1 );
Greg Kroah-Hartman
maintainerPATCH 160/206 PCI: Add Mellanox device IDs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Noa Osherovich <[email protected]>
commit 7254383341bc6e1a61996accd836009f0c922b21 upstream.
Add Mellanox device IDs for use by the mlx4 driver and INTx quirks.
[bhelgaas: sorted and adapted from
http://lkml.kernel.org/r/[email protected]]
--- include/linux/pci_ids.h | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
include/linux/pci_ids.h +22 -5
@@ -2256,12 +2256,29 @@#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0#define PCI_VENDOR_ID_MELLANOX 0x15b3 -#define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44 +#define PCI_DEVICE_ID_MELLANOX_CONNECTX3 0x1003 +#define PCI_DEVICE_ID_MELLANOX_CONNECTX3_PRO 0x1007 +#define PCI_DEVICE_ID_MELLANOX_CONNECTIB 0x1011 +#define PCI_DEVICE_ID_MELLANOX_CONNECTX4 0x1013 +#define PCI_DEVICE_ID_MELLANOX_CONNECTX4_LX 0x1015 +#define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44#define PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE 0x5a46 -#define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278 -#define PCI_DEVICE_ID_MELLANOX_ARBEL 0x6282 -#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c -#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274 +#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c +#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274 +#define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278 +#define PCI_DEVICE_ID_MELLANOX_ARBEL 0x6282 +#define PCI_DEVICE_ID_MELLANOX_HERMON_SDR 0x6340 +#define PCI_DEVICE_ID_MELLANOX_HERMON_DDR 0x634a +#define PCI_DEVICE_ID_MELLANOX_HERMON_QDR 0x6354 +#define PCI_DEVICE_ID_MELLANOX_HERMON_EN 0x6368 +#define PCI_DEVICE_ID_MELLANOX_CONNECTX_EN 0x6372 +#define PCI_DEVICE_ID_MELLANOX_HERMON_DDR_GEN2 0x6732 +#define PCI_DEVICE_ID_MELLANOX_HERMON_QDR_GEN2 0x673c +#define PCI_DEVICE_ID_MELLANOX_CONNECTX_EN_5_GEN2 0x6746 +#define PCI_DEVICE_ID_MELLANOX_HERMON_EN_GEN2 0x6750 +#define PCI_DEVICE_ID_MELLANOX_CONNECTX_EN_T_GEN2 0x675a +#define PCI_DEVICE_ID_MELLANOX_CONNECTX_EN_GEN2 0x6764 +#define PCI_DEVICE_ID_MELLANOX_CONNECTX2 0x676e#define PCI_VENDOR_ID_DFI 0x15bd
Greg Kroah-Hartman
maintainerPATCH 161/206 PCI: Convert broken INTx masking quirks from HEADER to FINAL
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Noa Osherovich <[email protected]>
commit b88214ce4d7064992452765028bd50702414f15f upstream.
Convert all quirk_broken_intx_masking() quirks from HEADER to FINAL.
The quirk sets dev->broken_intx_masking, which is only used by pci_intx_mask_supported(), which is not needed until after FINAL quirks have been run.
--- drivers/pci/quirks.c | 72 +++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-)
drivers/pci/quirks.c +36 -36
@@ -3146,53 +3146,53 @@ static void quirk_broken_intx_masking(st { dev->broken_intx_masking =1 ; } -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_CHELSIO ,0x0030 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (0x1814 ,0x0601 ,/* Ralink RT2800 802.11n PCI */ - quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_CHELSIO ,0x0030 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (0x1814 ,0x0601 ,/* Ralink RT2800 802.11n PCI */ + quirk_broken_intx_masking);/* * Realtek RTL8169 PCI Gigabit Ethernet Controller (rev 10) * Subsystem: Realtek RTL8169/8110 Family PCI Gigabit Ethernet NIC * * RTL8110SC - Fails under PCI device assignment using DisINTx masking. */ -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_REALTEK ,0x8169 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MELLANOX ,PCI_ANY_ID , - quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_REALTEK ,0x8169 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_MELLANOX ,PCI_ANY_ID , + quirk_broken_intx_masking);/* * Intel i40e (XL710/X710) 10/20/40GbE NICs all have broken INTx masking, * DisINTx can be set but the interrupt status bit is non-functional. */ -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1572 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1574 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1580 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1581 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1583 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1584 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1585 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1586 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1587 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1588 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1589 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x37d0 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x37d1 , - quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x37d2 , - quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1572 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1574 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1580 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1581 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1583 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1584 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1585 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1586 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1587 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1588 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1589 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x37d0 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x37d1 , + quirk_broken_intx_masking); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x37d2 , + quirk_broken_intx_masking);static void quirk_no_bus_reset (struct pci_dev *dev) {
Greg Kroah-Hartman
maintainerPATCH 162/206 PCI: Convert Mellanox broken INTx quirks to be for listed devices only
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Noa Osherovich <[email protected]>
commit d76d2fe05fd93673d184af77255bbbc63780f4ea upstream.
Change Mellanox's broken_intx_masking() quirk from an "all Mellanox devices" to a quirk for listed devices only.
--- drivers/pci/quirks.c | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-)
drivers/pci/quirks.c +37 -3
@@ -3137,8 +3137,9 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INDECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x22b7 , quirk_remove_d3_delay);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x2298 , quirk_remove_d3_delay);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x229c , quirk_remove_d3_delay); +/* -* Some devices may pass our check in pci_intx_mask_supported if +* Some devices may pass our check in pci_intx_mask_supported() if * PCI_COMMAND_INTX_DISABLE works though they actually do not properly * support this feature. */
@@ -3150,6 +3151,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CH quirk_broken_intx_masking);DECLARE_PCI_FIXUP_FINAL (0x1814 ,0x0601 ,/* Ralink RT2800 802.11n PCI */ quirk_broken_intx_masking); +/* * Realtek RTL8169 PCI Gigabit Ethernet Controller (rev 10) * Subsystem: Realtek RTL8169/8110 Family PCI Gigabit Ethernet NIC
@@ -3158,8 +3160,6 @@ DECLARE_PCI_FIXUP_FINAL(0x1814, 0x0601,*/ DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_REALTEK ,0x8169 , quirk_broken_intx_masking); -DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_MELLANOX ,PCI_ANY_ID , - quirk_broken_intx_masking);/* * Intel i40e (XL710/X710) 10/20/40GbE NICs all have broken INTx masking,
@@ -3194,6 +3194,40 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INDECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x37d2 , quirk_broken_intx_masking); +static u16 mellanox_broken_intx_devs[] = { +PCI_DEVICE_ID_MELLANOX_HERMON_SDR , +PCI_DEVICE_ID_MELLANOX_HERMON_DDR , +PCI_DEVICE_ID_MELLANOX_HERMON_QDR , +PCI_DEVICE_ID_MELLANOX_HERMON_DDR_GEN2 , +PCI_DEVICE_ID_MELLANOX_HERMON_QDR_GEN2 , +PCI_DEVICE_ID_MELLANOX_HERMON_EN , +PCI_DEVICE_ID_MELLANOX_HERMON_EN_GEN2 , +PCI_DEVICE_ID_MELLANOX_CONNECTX_EN , +PCI_DEVICE_ID_MELLANOX_CONNECTX_EN_T_GEN2 , +PCI_DEVICE_ID_MELLANOX_CONNECTX_EN_GEN2 , +PCI_DEVICE_ID_MELLANOX_CONNECTX_EN_5_GEN2 , +PCI_DEVICE_ID_MELLANOX_CONNECTX2 , +PCI_DEVICE_ID_MELLANOX_CONNECTX3 , +PCI_DEVICE_ID_MELLANOX_CONNECTX3_PRO , +PCI_DEVICE_ID_MELLANOX_CONNECTIB , +PCI_DEVICE_ID_MELLANOX_CONNECTX4 , +PCI_DEVICE_ID_MELLANOX_CONNECTX4_LX , +}; + +static void mellanox_check_broken_intx_masking (struct pci_dev *pdev) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (mellanox_broken_intx_devs); i++) { +if (pdev->device == mellanox_broken_intx_devs[i]) { + pdev->broken_intx_masking =1 ; +return ; + } + } +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_MELLANOX ,PCI_ANY_ID , + mellanox_check_broken_intx_masking); +static void quirk_no_bus_reset (struct pci_dev *dev) { dev->dev_flags |=PCI_DEV_FLAGS_NO_BUS_RESET ;
Greg Kroah-Hartman
maintainerPATCH 163/206 PCI: Support INTx masking on ConnectX-4 with firmware x.14.1100+
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Noa Osherovich <[email protected]>
commit 1600f62534b7b3da7978b43b52231a54c24df287 upstream.
Mellanox devices were marked as having INTx masking ability broken. As a result, the VFIO driver fails to start when more than one device function is passed-through to a VM if both have the same INTx pin.
Prior to Connect-IB, Mellanox devices exposed to the operating system one PCI function per all ports. Starting from Connect-IB, the devices are function-per-port. When passing the second function to a VM, VFIO will fail to start.
Exclude ConnectX-4, ConnectX4-Lx and Connect-IB from the list of Mellanox devices marked as having broken INTx masking:
- ConnectX-4 and ConnectX4-LX firmware version is checked. If INTx masking is supported, we unmark the broken INTx masking.
- Connect-IB does not support INTx currently so will not cause any problem.
--- drivers/pci/quirks.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-)
drivers/pci/quirks.c +56 -3
@@ -3209,13 +3209,25 @@ static u16 mellanox_broken_intx_devs[] =PCI_DEVICE_ID_MELLANOX_CONNECTX2 ,PCI_DEVICE_ID_MELLANOX_CONNECTX3 , PCI_DEVICE_ID_MELLANOX_CONNECTX3_PRO, -PCI_DEVICE_ID_MELLANOX_CONNECTIB , -PCI_DEVICE_ID_MELLANOX_CONNECTX4 , - PCI_DEVICE_ID_MELLANOX_CONNECTX4_LX, }; +#define CONNECTX_4_CURR_MAX_MINOR 99 +#define CONNECTX_4_INTX_SUPPORT_MINOR 14 + +/* +* Check ConnectX-4/LX FW version to see if it supports legacy interrupts. +* If so, don't mark it as broken. +* FW minor > 99 means older FW version format and no INTx masking support. +* FW minor < 14 means new FW version format and no INTx masking support. +*/ static void mellanox_check_broken_intx_masking (struct pci_dev *pdev) { +__be32 __iomem *fw_ver; +u16 fw_major; +u16 fw_minor; +u16 fw_subminor; +u32 fw_maj_min; +u32 fw_sub_min;int i;for (i =0 ; i <ARRAY_SIZE (mellanox_broken_intx_devs); i++) {
@@ -3224,6 +3236,47 @@ static void mellanox_check_broken_intx_mreturn ; } } + +/* Getting here means Connect-IB cards and up. Connect-IB has no INTx +* support so shouldn't be checked further +*/ +if (pdev->device ==PCI_DEVICE_ID_MELLANOX_CONNECTIB ) +return ; + +if (pdev->device !=PCI_DEVICE_ID_MELLANOX_CONNECTX4 && + pdev->device !=PCI_DEVICE_ID_MELLANOX_CONNECTX4_LX ) +return ; + +/* For ConnectX-4 and ConnectX-4LX, need to check FW support */ +if (pci_enable_device_mem (pdev)) { +dev_warn (&pdev->dev,"Can't enable device memory\n" ); +return ; + } + + fw_ver =ioremap (pci_resource_start (pdev,0 ),4 ); +if (!fw_ver) { +dev_warn (&pdev->dev,"Can't map ConnectX-4 initialization segment\n" ); + goto out; + } + +/* Reading from resource space should be 32b aligned */ + fw_maj_min =ioread32be (fw_ver); + fw_sub_min =ioread32be (fw_ver +1 ); + fw_major = fw_maj_min &0xffff ; + fw_minor = fw_maj_min >>16 ; + fw_subminor = fw_sub_min &0xffff ; +if (fw_minor >CONNECTX_4_CURR_MAX_MINOR || + fw_minor <CONNECTX_4_INTX_SUPPORT_MINOR ) { +dev_warn (&pdev->dev,"ConnectX-4: FW %u.%u.%u doesn't support INTx masking, disabling. Please upgrade FW to %d.14.1100 and up for INTx support\n" , + fw_major, fw_minor, fw_subminor, pdev->device == +PCI_DEVICE_ID_MELLANOX_CONNECTX4 ?12 :14 ); + pdev->broken_intx_masking =1 ; + } + +iounmap (fw_ver); + +out: +pci_disable_device (pdev); }DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_MELLANOX ,PCI_ANY_ID , mellanox_check_broken_intx_masking);
Greg Kroah-Hartman
maintainerPATCH 154/206 md: fix refcount problem on mddev when stopping array.
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit e2342ca832726a840ca6bd196dd2cc073815b08a upstream.
md_open() gets a counted reference on an mddev using mddev_find(). If it ends up returning an error, it must drop this reference.
There are two error paths where the reference is not dropped. One only happens if the process is signalled and an awkward time, which is quite unlikely.
The other was introduced recently in commit af8d8e6f0.
Change the code to ensure the drop the reference when returning an error, and make it harded to re-introduce this sort of bug in the future.
--- drivers/md/md.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/md/md.c +4 -1
@@ -7092,7 +7092,8 @@ static int md_open(struct block_device *if (test_bit (MD_CLOSING , &mddev->flags)) {mutex_unlock (&mddev->open_mutex); -return -ENODEV ; + err = -ENODEV ; + goto out; } err =0 ;
@@ -7101,6 +7102,8 @@ static int md_open(struct block_device *check_disk_change (bdev); out: +if (err) +mddev_put (mddev);return err; }
Greg Kroah-Hartman
maintainerPATCH 197/206 xfs: dont allow di_size with high bit set
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit ef388e2054feedaeb05399ed654bdb06f385d294 upstream.
The on-disk field di_size is used to set i_size, which is a signed integer of loff_t. If the high bit of di_size is set, we'll end up with a negative i_size, which will cause all sorts of problems. Since the VFS won't let us create a file with such length, we should catch them here in the verifier too.
--- fs/xfs/libxfs/xfs_inode_buf.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/xfs/libxfs/xfs_inode_buf.c +8 -0
@@ -392,6 +392,14 @@ xfs_dinode_verify(if (dip->di_magic !=cpu_to_be16 (XFS_DINODE_MAGIC ))return false; +/* don't allow invalid i_size */ +if (be64_to_cpu (dip->di_size) & (1ULL <<63 )) +return false; + +/* No zero-length symlinks. */ +if (S_ISLNK (be16_to_cpu (dip->di_mode)) && dip->di_size ==0 ) +return false; +/* only version 3 or greater inodes are extensively verified here */ if (dip->di_version <3 )return true;
Greg Kroah-Hartman
maintainerPATCH 206/206 tick/broadcast: Prevent NULL pointer dereference
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit c1a9eeb938b5433947e5ea22f89baff3182e7075 upstream.
When a disfunctional timer, e.g. dummy timer, is installed, the tick core tries to setup the broadcast timer.
If no broadcast device is installed, the kernel crashes with a NULL pointer dereference in tick_broadcast_setup_oneshot() because the function has no sanity check.
--- kernel/time/tick-broadcast.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/time/tick-broadcast.c +3 -0
@@ -871,6 +871,9 @@ void tick_broadcast_setup_oneshot(struct {int cpu =smp_processor_id (); +if (!bc) +return ; +/* Set it up only once ! */ if (bc->event_handler != tick_handle_oneshot_broadcast) {int was_periodic =clockevent_state_periodic (bc);
Greg Kroah-Hartman
maintainerPATCH 198/206 xfs: dont cap maximum dedupe request length
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit 1bb33a98702d8360947f18a44349df75ba555d5d upstream.
After various discussions on linux-fsdevel, it has been decided that it is not necessary to cap the length of a dedupe request, and that correctly-written userspace client programs will be able to absorb the change. Therefore, remove the length clamping behavior.
--- fs/xfs/xfs_file.c | 9 --------- 1 file changed, 9 deletions(-)
fs/xfs/xfs_file.c +0 -9
@@ -939,7 +939,6 @@ xfs_file_clone_range( len, false); } -#define XFS_MAX_DEDUPE_LEN (16 * 1024 * 1024) STATIC ssize_t xfs_file_dedupe_range( struct file *src_file,
@@ -950,14 +949,6 @@ xfs_file_dedupe_range( {int error; -/* -* Limit the total length we will dedupe for each operation. -* This is intended to bound the total time spent in this -* ioctl to something sane. -*/ -if (len >XFS_MAX_DEDUPE_LEN ) - len =XFS_MAX_DEDUPE_LEN ; - error =xfs_reflink_remap_range (src_file, loff, dst_file, dst_loff, len, true);if (error)
Greg Kroah-Hartman
maintainerPATCH 199/206 xfs: ignore leaf attr ichdr.count in verifier during log replay
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Sandeen <[email protected]>
commit 2e1d23370e75d7d89350d41b4ab58c7f6a0e26b2 upstream.
When we create a new attribute, we first create a shortform attribute, and try to fit the new attribute into it.
If that fails, we copy the (empty) attribute into a leaf attribute, and do the copy again. Thus there can be a transient state where we have an empty leaf attribute.
If we encounter this during log replay, the verifier will fail. So add a test to ignore this part of the leaf attr verification during log replay.
Thanks as usual to dchinner for spotting the problem.
--- fs/xfs/libxfs/xfs_attr_leaf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_attr_leaf.c +7 -1
@@ -253,6 +253,7 @@ xfs_attr3_leaf_verify( {struct xfs_mount *mp = bp->b_target->bt_mount;struct xfs_attr_leafblock *leaf = bp->b_addr; +struct xfs_perag *pag = bp->b_pag;struct xfs_attr3_icleaf_hdr ichdr;xfs_attr3_leaf_hdr_from_disk (mp->m_attr_geo, &ichdr, leaf);
@@ -273,7 +274,12 @@ xfs_attr3_leaf_verify(if (ichdr.magic !=XFS_ATTR_LEAF_MAGIC )return false; } -if (ichdr.count ==0 ) +/* +* In recovery there is a transient state where count == 0 is valid +* because we may have transitioned an empty shortform attr to a leaf +* if the attr didn't fit in shortform. +*/ +if (pag && pag->pagf_init && ichdr.count ==0 )return false;/* XXX: need to range check rest of attr header values */
Greg Kroah-Hartman
maintainerPATCH 200/206 xfs: use GPF_NOFS when allocating btree cursors
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit b24a978c377be5f14e798cb41238e66fe51aab2f upstream.
Use NOFS for allocating btree cursors, since they can be called under the ilock.
--- fs/xfs/libxfs/xfs_alloc_btree.c | 2 +- fs/xfs/libxfs/xfs_bmap_btree.c | 2 +- fs/xfs/libxfs/xfs_ialloc_btree.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
fs/xfs/libxfs/xfs_alloc_btree.c +1 -1
@@ -421,7 +421,7 @@ xfs_allocbt_init_cursor(ASSERT (btnum ==XFS_BTNUM_BNO || btnum ==XFS_BTNUM_CNT ); - cur =kmem_zone_zalloc (xfs_btree_cur_zone,KM_SLEEP ); + cur =kmem_zone_zalloc (xfs_btree_cur_zone,KM_NOFS ); cur->bc_tp = tp; cur->bc_mp = mp;
fs/xfs/libxfs/xfs_bmap_btree.c +1 -1
@@ -796,7 +796,7 @@ xfs_bmbt_init_cursor(struct xfs_btree_cur *cur;ASSERT (whichfork !=XFS_COW_FORK ); - cur =kmem_zone_zalloc (xfs_btree_cur_zone,KM_SLEEP ); + cur =kmem_zone_zalloc (xfs_btree_cur_zone,KM_NOFS ); cur->bc_tp = tp; cur->bc_mp = mp;
fs/xfs/libxfs/xfs_ialloc_btree.c +1 -1
@@ -357,7 +357,7 @@ xfs_inobt_init_cursor(struct xfs_agi *agi =XFS_BUF_TO_AGI (agbp);struct xfs_btree_cur *cur; - cur =kmem_zone_zalloc (xfs_btree_cur_zone,KM_SLEEP ); + cur =kmem_zone_zalloc (xfs_btree_cur_zone,KM_NOFS ); cur->bc_tp = tp; cur->bc_mp = mp;
Greg Kroah-Hartman
maintainerPATCH 203/206 xfs: fix crash and data corruption due to removal of busy COW extents
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
commit a1b7a4dea6166cf46be895bce4aac67ea5160fe8 upstream.
There is a race window between write_cache_pages calling clear_page_dirty_for_io and XFS calling set_page_writeback, in which the mapping for an inode is tagged neither as dirty, nor as writeback.
If the COW shrinker hits in exactly that window we'll remove the delayed COW extents and writepages trying to write it back, which in release kernels will manifest as corruption of the bmap btree, and in debug kernels will trip the ASSERT about now calling xfs_bmapi_write with the COWFORK flag for holes. A complex customer load manages to hit this window fairly reliably, probably by always having COW writeback in flight while the cow shrinker runs.
This patch adds another check for having the I_DIRTY_PAGES flag set, which is still set during this race window. While this fixes the problem I'm still not overly happy about the way the COW shrinker works as it still seems a bit fragile.
--- fs/xfs/xfs_icache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_icache.c +2 -1
@@ -1599,7 +1599,8 @@ xfs_inode_free_cowblocks(* If the mapping is dirty or under writeback we cannot touch the * CoW fork. Leave it alone if we're in the midst of a directio. */ -if (mapping_tagged (VFS_I (ip)->i_mapping,PAGECACHE_TAG_DIRTY ) || +if ((VFS_I (ip)->i_state &I_DIRTY_PAGES ) || +mapping_tagged (VFS_I (ip)->i_mapping,PAGECACHE_TAG_DIRTY ) ||mapping_tagged (VFS_I (ip)->i_mapping,PAGECACHE_TAG_WRITEBACK ) ||atomic_read (&VFS_I (ip)->i_dio_count))return 0 ;
Greg Kroah-Hartman
maintainerPATCH 202/206 xfs: use the actual AG length when reserving blocks
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit 20e73b000bcded44a91b79429d8fa743247602ad upstream.
We need to use the actual AG length when making per-AG reservations, since we could otherwise end up reserving more blocks out of the last AG than there are actual blocks.
--- fs/xfs/libxfs/xfs_ag_resv.c | 3 +++ fs/xfs/libxfs/xfs_refcount_btree.c | 9 ++++++--- fs/xfs/libxfs/xfs_refcount_btree.h | 3 ++- fs/xfs/libxfs/xfs_rmap_btree.c | 14 +++++++------- fs/xfs/libxfs/xfs_rmap_btree.h | 3 ++- fs/xfs/xfs_fsops.c | 14 ++++++++++++++ 6 files changed, 34 insertions(+), 12 deletions(-)
fs/xfs/libxfs/xfs_ag_resv.c +3 -0
@@ -256,6 +256,9 @@ xfs_ag_resv_init( goto out; } +ASSERT (xfs_perag_resv (pag,XFS_AG_RESV_METADATA )->ar_reserved + +xfs_perag_resv (pag,XFS_AG_RESV_AGFL )->ar_reserved <= + pag->pagf_freeblks + pag->pagf_flcount); out:return error; }
fs/xfs/libxfs/xfs_refcount_btree.c +6 -3
@@ -408,13 +408,14 @@ xfs_refcountbt_calc_size(*/ xfs_extlen_t xfs_refcountbt_max_size ( -struct xfs_mount *mp) +struct xfs_mount *mp, +xfs_agblock_t agblocks) {/* Bail out if we're uninitialized, which can happen in mkfs. */ if (mp->m_refc_mxr[0 ] ==0 )return 0 ; -return xfs_refcountbt_calc_size (mp, mp->m_sb.sb_agblocks); +return xfs_refcountbt_calc_size (mp, agblocks); }/*
@@ -429,22 +430,24 @@ xfs_refcountbt_calc_reserves( {struct xfs_buf *agbp;struct xfs_agf *agf; +xfs_agblock_t agblocks;xfs_extlen_t tree_len;int error;if (!xfs_sb_version_hasreflink (&mp->m_sb))return 0 ; - *ask +=xfs_refcountbt_max_size (mp); error =xfs_alloc_read_agf (mp,NULL , agno,0 , &agbp);if (error)return error; agf =XFS_BUF_TO_AGF (agbp); + agblocks =be32_to_cpu (agf->agf_length); tree_len =be32_to_cpu (agf->agf_refcount_blocks);xfs_buf_relse (agbp); + *ask +=xfs_refcountbt_max_size (mp, agblocks); *used += tree_len;return error;
fs/xfs/libxfs/xfs_refcount_btree.h +2 -1
@@ -66,7 +66,8 @@ extern void xfs_refcountbt_compute_maxleextern xfs_extlen_t xfs_refcountbt_calc_size (struct xfs_mount *mp,unsigned long long len); -extern xfs_extlen_t xfs_refcountbt_max_size (struct xfs_mount *mp); +extern xfs_extlen_t xfs_refcountbt_max_size (struct xfs_mount *mp, +xfs_agblock_t agblocks);extern int xfs_refcountbt_calc_reserves (struct xfs_mount *mp,xfs_agnumber_t agno,xfs_extlen_t *ask,xfs_extlen_t *used);
fs/xfs/libxfs/xfs_rmap_btree.c +7 -7
@@ -549,13 +549,14 @@ xfs_rmapbt_calc_size(*/ xfs_extlen_t xfs_rmapbt_max_size ( -struct xfs_mount *mp) +struct xfs_mount *mp, +xfs_agblock_t agblocks) {/* Bail out if we're uninitialized, which can happen in mkfs. */ if (mp->m_rmap_mxr[0 ] ==0 )return 0 ; -return xfs_rmapbt_calc_size (mp, mp->m_sb.sb_agblocks); +return xfs_rmapbt_calc_size (mp, agblocks); }/*
@@ -570,25 +571,24 @@ xfs_rmapbt_calc_reserves( {struct xfs_buf *agbp;struct xfs_agf *agf; -xfs_extlen_t pool_len; +xfs_agblock_t agblocks;xfs_extlen_t tree_len;int error;if (!xfs_sb_version_hasrmapbt (&mp->m_sb))return 0 ; -/* Reserve 1% of the AG or enough for 1 block per record. */ - pool_len =max (mp->m_sb.sb_agblocks /100 ,xfs_rmapbt_max_size (mp)); - *ask += pool_len; - error =xfs_alloc_read_agf (mp,NULL , agno,0 , &agbp);if (error)return error; agf =XFS_BUF_TO_AGF (agbp); + agblocks =be32_to_cpu (agf->agf_length); tree_len =be32_to_cpu (agf->agf_rmap_blocks);xfs_buf_relse (agbp); +/* Reserve 1% of the AG or enough for 1 block per record. */ + *ask +=max (agblocks /100 ,xfs_rmapbt_max_size (mp, agblocks)); *used += tree_len;return error;
fs/xfs/libxfs/xfs_rmap_btree.h +2 -1
@@ -60,7 +60,8 @@ extern void xfs_rmapbt_compute_maxlevelsextern xfs_extlen_t xfs_rmapbt_calc_size (struct xfs_mount *mp,unsigned long long len); -extern xfs_extlen_t xfs_rmapbt_max_size (struct xfs_mount *mp); +extern xfs_extlen_t xfs_rmapbt_max_size (struct xfs_mount *mp, +xfs_agblock_t agblocks);extern int xfs_rmapbt_calc_reserves (struct xfs_mount *mp,xfs_agnumber_t agno,xfs_extlen_t *ask,xfs_extlen_t *used);
fs/xfs/xfs_fsops.c +14 -0
@@ -631,6 +631,20 @@ xfs_growfs_data_private(xfs_set_low_space_thresholds (mp); mp->m_alloc_set_aside =xfs_alloc_set_aside (mp); +/* +* If we expanded the last AG, free the per-AG reservation +* so we can reinitialize it with the new size. +*/ +if (new) { +struct xfs_perag *pag; + + pag =xfs_perag_get (mp, agno); + error =xfs_ag_resv_free (pag); +xfs_perag_put (pag); +if (error) + goto out; + } +/* Reserve AG metadata blocks. */ error =xfs_fs_reserve_ag_blocks (mp);if (error && error != -ENOSPC )
Greg Kroah-Hartman
maintainerPATCH 204/206 xfs: fix max_retries _show and _store functions
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlos Maiolino <[email protected]>
commit ff97f2399edac1e0fb3fa7851d5fbcbdf04717cf upstream.
max_retries _show and _store functions should test against cfg->max_retries, not cfg->retry_timeout
--- fs/xfs/xfs_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/xfs/xfs_sysfs.c +2 -2
@@ -396,7 +396,7 @@ max_retries_show(int retries;struct xfs_error_cfg *cfg =to_error_cfg (kobject); -if (cfg->retry_timeout ==XFS_ERR_RETRY_FOREVER ) +if (cfg->max_retries ==XFS_ERR_RETRY_FOREVER ) retries =-1 ;else retries = cfg->max_retries;
@@ -422,7 +422,7 @@ max_retries_store(return -EINVAL ;if (val ==-1 ) - cfg->retry_timeout =XFS_ERR_RETRY_FOREVER ; + cfg->max_retries =XFS_ERR_RETRY_FOREVER ;else cfg->max_retries = val;return count;
Greg Kroah-Hartman
maintainerPATCH 205/206 clocksource/dummy_timer: Move hotplug callback after the real timers
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 9bf11ecce5a2758e5a097c2f3a13d08552d0d6f9 upstream.
When the dummy timer callback is invoked before the real timer callbacks, then it tries to install that timer for the starting CPU. If the platform does not have a broadcast timer installed the installation fails with a kernel crash. The crash happens due to a unconditional deference of the non available broadcast device. This needs to be fixed in the timer core code.
But even when this is fixed in the core code then installing the dummy timer before the real timers is a pointless exercise.
Move it to the end of the callback list.
--- include/linux/cpuhotplug.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/cpuhotplug.h +2 -1
@@ -80,7 +80,6 @@ enum cpuhp_state {CPUHP_AP_ARM_L2X0_STARTING ,CPUHP_AP_ARM_ARCH_TIMER_STARTING ,CPUHP_AP_ARM_GLOBAL_TIMER_STARTING , -CPUHP_AP_DUMMY_TIMER_STARTING ,CPUHP_AP_JCORE_TIMER_STARTING ,CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING , CPUHP_AP_ARM_TWD_STARTING,
@@ -94,6 +93,8 @@ enum cpuhp_state {CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING ,CPUHP_AP_KVM_ARM_VGIC_STARTING ,CPUHP_AP_KVM_ARM_TIMER_STARTING , +/* Must be the last timer callback */ +CPUHP_AP_DUMMY_TIMER_STARTING ,CPUHP_AP_ARM_XEN_STARTING ,CPUHP_AP_ARM_CORESIGHT_STARTING , CPUHP_AP_ARM_CORESIGHT4_STARTING,
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.3 release. There are 206 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jan 12 13:14:24 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America(Silicon Valley) [email protected]
Greg Kroah-Hartman
maintainerQuoted 15 lines · Shuah Khan
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.3 release. There are 206 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jan 12 13:14:24 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Great, thanks for testing these and letting me know.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.3 release. There are 206 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jan 12 13:14:24 UTC 2017. Anything received after that time might be too late.
Build results:
total: 150 pass: 149 fail: 1 Failed builds: avr32:merisc_defconfig Qemu test results: total: 122 pass: 122 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Greg Kroah-Hartman
maintainerQuoted 10 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.3 release. There are 206 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jan 12 13:14:24 UTC 2017. Anything received after that time might be too late.
Quoted 8 lines
Build results:
total: 150 pass: 149 fail: 1 Failed builds: avr32:merisc_defconfig Qemu test results: total: 122 pass: 122 fail: 0Details are available at http://kerneltests.org/builders.
This is the "known to fail" failure, correct?
Thanks for testing these and letting me know.
greg k-h
Quoted 18 lines · Greg Kroah-Hartman
Quoted 17 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.3 release. There are 206 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Jan 12 13:14:24 UTC 2017. Anything received after that time might be too late.
Build results:
total: 150 pass: 149 fail: 1 Failed builds: avr32:merisc_defconfig Qemu test results: total: 122 pass: 122 fail: 0
Quoted 4 lines
Quoted 1 line
Details are available at http://kerneltests.org/builders.
This is the "known to fail" failure, correct?
Yes, sorry, I didn't bother to spell it out.
Guenter
RE: [PATCH 4.9 094/206] nl80211: Use different attrs for BSSID and random MAC addr in scan req
In reply to Greg Kroah-HartmanHello Greg,
Really sorry that I couldn't find this earlier but there is one issue with this cherry-pick. In "enum nl80211_commands", there are more variables between NL80211_ATTR_NAN_MATCH and NL80211_ATTR_BSSID. But they are missing in this cherry-pick. The missing variables are NL80211_ATTR_FILS_KEK, NL80211_ATTR_FILS_NONCES andNL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED. Because of this NL80211_ATTR_BSSID value might not be consistent across different releases. Could you please let me know the next steps on this?
Thanks,
Vamsi
Quoted 120 lines
-----Original Message-----
From: Greg Kroah-Hartman [mailto:[email protected]]
Sent: Tuesday, January 10, 2017 7:06 PM
To: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; [email protected]; Vamsi, Krishna <[email protected]>; Malinen, Jouni <[email protected]>; Johannes Berg <[email protected]>
Subject: [PATCH 4.9 094/206] nl80211: Use different attrs for BSSID and random MAC addr in scan req4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vamsi Krishna <[email protected]>
commit
2fa436b3a2a7009c11a3bc03fe0ff4c26e80fd87upstream.
NL80211_ATTR_MACwas used to set both the specific BSSID to be scanned and the random MAC address to be used when privacy is enabled. When both the features are enabled, both the BSSID and the local MAC address were getting same value causing Probe Request frames to go with unintended DA. Hence, this has been fixed by using a differentNL80211_ATTR_BSSIDattribute to set the specific BSSID (which was the more recent addition in cfg80211) for a scan.Backwards compatibility with old userspace software is maintained to some extent by allowing
NL80211_ATTR_MACto be used to set the specific BSSID when scanning without enabling random MAC address use.Scanning with random source MAC address was introduced by commit
ad2b26abc157("cfg80211: allow drivers to support random MAC addresses for scan") and the issue was introduced with the addition of the second user for the same attribute in commit818965d39177("cfg80211: Allow a scan request for a specific BSSID").Fixes 818965d39177 ("cfg80211: Allow a scan request for a specific BSSID")Signed-off-by Vamsi Krishna <[email protected]>Signed-off-by Jouni Malinen <[email protected]>Signed-off-by Johannes Berg <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/uapi/linux/nl80211.h | 7 ++++++- net/wireless/nl80211.c | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-)include/uapi/linux/nl80211.h +0
-0@@ -323,7 +323,7 @@* @NL80211_CMD_GET_SCAN: get scan results * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
* %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send
the
- * probe requests at CCK rate or not. %NL80211_ATTR_MAC can be used
to
+ * probe requests at CCK rate or not. %NL80211_ATTR_BSSID can be used
to
* specify a BSSID to scan for; if not included, the wildcard BSSID will
* be used.
* @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to @@
-1937,6 +1937,9 @@ enumnl80211_commands{
* @NL80211_ATTR_NAN_MATCH: used to report a match. This is a nested
attribute.
* See &enumnl80211_nan_match_attributes.
*
+ * @NL80211_ATTR_BSSID: The BSSID of the AP. Note that %NL80211_ATTR_MAC is also
+ * used in various commands/events for specifying the BSSID.
+ *
* @NUM_NL80211_ATTR: total number ofnl80211_attrsavailable
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use @@ -2336,6 +2339,8 @@
enumnl80211_attrs{include/uapi/linux/nl80211.h +2
-0NL80211_ATTR_NAN_FUNC ,NL80211_ATTR_NAN_MATCH , +NL80211_ATTR_BSSID , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,net/wireless/nl80211.c +4
-1@@ -414,6 +414,7 @@ static const struct nla_policy nl80211_p [NL80211_ATTR_NAN_MASTER_PREF] = { .type = NLA_U8 }, [NL80211_ATTR_NAN_DUAL] = { .type = NLA_U8 }, [NL80211_ATTR_NAN_FUNC] = { .type = NLA_NESTED }, + [NL80211_ATTR_BSSID] = { .len = ETH_ALEN }, };/* policy for the key attributes */ @@ -6677,7 +6678,20 @@ static int nl80211_trigger_scan(struct s request->no_cck =nla_get_flag (info->attrs[NL80211_ATTR_TX_NO_CCK_RATE ]); -if (info->attrs[NL80211_ATTR_MAC ]) +/* Initial implementation used NL80211_ATTR_MAC to set the specific +* BSSID to scan for. This was problematic because that same attribute +* was already used for another purpose (local random MAC address). The
net/wireless/nl80211.c +3
-0+* NL80211_ATTR_BSSID attribute was added to fix this. For backwards +* compatibility with older userspace components, also use the +* NL80211_ATTR_MAC value here if it can be determined to be used for
net/wireless/nl80211.c +2
-0+* the specific BSSID use case instead of the random MAC address +* (NL80211_ATTR_SCAN_FLAGS is used to enable random MAC address use).
net/wireless/nl80211.c +6
-0+*/ +if (info->attrs[NL80211_ATTR_BSSID ]) +memcpy (request->bssid, +nla_data (info->attrs[NL80211_ATTR_BSSID ]),ETH_ALEN ); +else if (!(request->flags &NL80211_SCAN_FLAG_RANDOM_ADDR ) && + info->attrs[NL80211_ATTR_MAC ]) memcpy(request->bssid, nla_data(info-Quoted 1 line
attrs[NL80211_ATTR_MAC]),
net/wireless/nl80211.c +0
-0ETH_ALEN); else
Greg Kroah-Hartman
maintainerRe: [PATCH 4.9 094/206] nl80211: Use different attrs for BSSID and random MAC addr in scan req
Quoted 4 lines · Krishna Vamsi
Hello Greg,
Really sorry that I couldn't find this earlier but there is one issue with this cherry-pick. In "enum
nl80211_commands", there are more variables betweenNL80211_ATTR_NAN_MATCHandNL80211_ATTR_BSSID. But they are missing in this cherry-pick. The missing variables areNL80211_ATTR_FILS_KEK,NL80211_ATTR_FILS_NONCESandNL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED. Because of thisNL80211_ATTR_BSSIDvalue might not be consistent across different releases. Could you please let me know the next steps on this?
Can you send me a fix-up patch for this?
thanks,
greg k-h