···4444 Definition: Must be one of below:4545 "qcom,pm8005-rpmh-regulators"4646 "qcom,pm8009-rpmh-regulators"4747+ "qcom,pm8009-1-rpmh-regulators"4748 "qcom,pm8150-rpmh-regulators"4849 "qcom,pm8150l-rpmh-regulators"4950 "qcom,pm8350-rpmh-regulators"
···3939 struct ecdh params;4040 unsigned int ndigits;41414242- if (crypto_ecdh_decode_key(buf, len, ¶ms) < 0)4242+ if (crypto_ecdh_decode_key(buf, len, ¶ms) < 0 ||4343+ params.key_size > sizeof(ctx->private_key))4344 return -EINVAL;44454546 ndigits = ecdh_supported_curve(params.curve_id);
+7-2
drivers/base/regmap/regmap-debugfs.c
···582582 devname = dev_name(map->dev);583583584584 if (name) {585585- map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",585585+ if (!map->debugfs_name) {586586+ map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s",586587 devname, name);588588+ if (!map->debugfs_name)589589+ return;590590+ }587591 name = map->debugfs_name;588592 } else {589593 name = devname;···595591596592 if (!strcmp(name, "dummy")) {597593 kfree(map->debugfs_name);598598-599594 map->debugfs_name = kasprintf(GFP_KERNEL, "dummy%d",600595 dummy_index);596596+ if (!map->debugfs_name)597597+ return;601598 name = map->debugfs_name;602599 dummy_index++;603600 }
+1
drivers/isdn/mISDN/Kconfig
···1313config MISDN_DSP1414 tristate "Digital Audio Processing of transparent data"1515 depends on MISDN1616+ select BITREVERSE1617 help1718 Enable support for digital audio processing capability.1819
···123123config CAN_KVASER_PCIEFD124124 depends on PCI125125 tristate "Kvaser PCIe FD cards"126126+ select CRC32126127 help127128 This is a driver for the Kvaser PCI Express CAN FD family.128129
···11# SPDX-License-Identifier: GPL-2.022config CAN_RCAR33- tristate "Renesas R-Car CAN controller"33+ tristate "Renesas R-Car and RZ/G CAN controller"44 depends on ARCH_RENESAS || ARM55 help66 Say Y here if you want to use CAN controller found on Renesas R-Car77- SoCs.77+ or RZ/G SoCs.8899 To compile this driver as a module, choose M here: the module will1010 be called rcar_can.
···44 depends on HAS_IOMEM55 depends on NET_DSA66 depends on PTP_1588_CLOCK77+ depends on LEDS_CLASS78 select NET_DSA_TAG_HELLCREEK89 help910 This driver adds support for Hirschmann Hellcreek TSN switches.
+4-3
drivers/net/dsa/lantiq_gswip.c
···14361436 phylink_set(mask, Pause);14371437 phylink_set(mask, Asym_Pause);1438143814391439- /* With the exclusion of MII and Reverse MII, we support Gigabit,14401440- * including Half duplex14391439+ /* With the exclusion of MII, Reverse MII and Reduced MII, we14401440+ * support Gigabit, including Half duplex14411441 */14421442 if (state->interface != PHY_INTERFACE_MODE_MII &&14431443- state->interface != PHY_INTERFACE_MODE_REVMII) {14431443+ state->interface != PHY_INTERFACE_MODE_REVMII &&14441444+ state->interface != PHY_INTERFACE_MODE_RMII) {14441445 phylink_set(mask, 1000baseT_Full);14451446 phylink_set(mask, 1000baseT_Half);14461447 }
···44324432 struct bpf_prog *old_prog;4433443344344434 if (prog && dev->mtu > MVNETA_MAX_RX_BUF_SIZE) {44354435- NL_SET_ERR_MSG_MOD(extack, "Jumbo frames not supported on XDP");44354435+ NL_SET_ERR_MSG_MOD(extack, "MTU too large for XDP");44364436 return -EOPNOTSUPP;44374437 }44384438
···626626 if (!reg_c0)627627 return true;628628629629+ /* If reg_c0 is not equal to the default flow tag then skb->mark630630+ * is not supported and must be reset back to 0.631631+ */632632+ skb->mark = 0;633633+629634 priv = netdev_priv(skb->dev);630635 esw = priv->mdev->priv.eswitch;631636
···564564 struct mlx5_core_dev *tmp_dev;565565 int i, err;566566567567- if (!MLX5_CAP_GEN(dev, vport_group_manager))567567+ if (!MLX5_CAP_GEN(dev, vport_group_manager) ||568568+ !MLX5_CAP_GEN(dev, lag_master) ||569569+ MLX5_CAP_GEN(dev, num_lag_ports) != MLX5_MAX_PORTS)568570 return;569571570572 tmp_dev = mlx5_get_next_phys_dev(dev);···584582 if (mlx5_lag_dev_add_pf(ldev, dev, netdev) < 0)585583 return;586584587587- for (i = 0; i < MLX5_MAX_PORTS; i++) {588588- tmp_dev = ldev->pf[i].dev;589589- if (!tmp_dev || !MLX5_CAP_GEN(tmp_dev, lag_master) ||590590- MLX5_CAP_GEN(tmp_dev, num_lag_ports) != MLX5_MAX_PORTS)585585+ for (i = 0; i < MLX5_MAX_PORTS; i++)586586+ if (!ldev->pf[i].dev)591587 break;592592- }593588594589 if (i >= MLX5_MAX_PORTS)595590 ldev->flags |= MLX5_LAG_FLAG_READY;
···7878 depends on PCI7979 select ZLIB_INFLATE8080 select CRC88181+ select CRC328182 select NET_DEVLINK8283 help8384 This enables the support for Marvell FastLinQ adapters family.
+82-47
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
···6464 * @variant: reference to the current board variant6565 * @regmap: regmap for using the syscon6666 * @internal_phy_powered: Does the internal PHY is enabled6767+ * @use_internal_phy: Is the internal PHY selected for use6768 * @mux_handle: Internal pointer used by mdio-mux lib6869 */6970struct sunxi_priv_data {···7574 const struct emac_variant *variant;7675 struct regmap_field *regmap_field;7776 bool internal_phy_powered;7777+ bool use_internal_phy;7878 void *mux_handle;7979};8080···541539 .dma_interrupt = sun8i_dwmac_dma_interrupt,542540};543541542542+static int sun8i_dwmac_power_internal_phy(struct stmmac_priv *priv);543543+544544static int sun8i_dwmac_init(struct platform_device *pdev, void *priv)545545{546546+ struct net_device *ndev = platform_get_drvdata(pdev);546547 struct sunxi_priv_data *gmac = priv;547548 int ret;548549···559554560555 ret = clk_prepare_enable(gmac->tx_clk);561556 if (ret) {562562- if (gmac->regulator)563563- regulator_disable(gmac->regulator);564557 dev_err(&pdev->dev, "Could not enable AHB clock\n");565565- return ret;558558+ goto err_disable_regulator;559559+ }560560+561561+ if (gmac->use_internal_phy) {562562+ ret = sun8i_dwmac_power_internal_phy(netdev_priv(ndev));563563+ if (ret)564564+ goto err_disable_clk;566565 }567566568567 return 0;568568+569569+err_disable_clk:570570+ clk_disable_unprepare(gmac->tx_clk);571571+err_disable_regulator:572572+ if (gmac->regulator)573573+ regulator_disable(gmac->regulator);574574+575575+ return ret;569576}570577571578static void sun8i_dwmac_core_init(struct mac_device_info *hw,···848831 struct sunxi_priv_data *gmac = priv->plat->bsp_priv;849832 u32 reg, val;850833 int ret = 0;851851- bool need_power_ephy = false;852834853835 if (current_child ^ desired_child) {854836 regmap_field_read(gmac->regmap_field, ®);···855839 case DWMAC_SUN8I_MDIO_MUX_INTERNAL_ID:856840 dev_info(priv->device, "Switch mux to internal PHY");857841 val = (reg & ~H3_EPHY_MUX_MASK) | H3_EPHY_SELECT;858858-859859- need_power_ephy = true;842842+ gmac->use_internal_phy = true;860843 break;861844 case DWMAC_SUN8I_MDIO_MUX_EXTERNAL_ID:862845 dev_info(priv->device, "Switch mux to external PHY");863846 val = (reg & ~H3_EPHY_MUX_MASK) | H3_EPHY_SHUTDOWN;864864- need_power_ephy = false;847847+ gmac->use_internal_phy = false;865848 break;866849 default:867850 dev_err(priv->device, "Invalid child ID %x\n",···868853 return -EINVAL;869854 }870855 regmap_field_write(gmac->regmap_field, val);871871- if (need_power_ephy) {856856+ if (gmac->use_internal_phy) {872857 ret = sun8i_dwmac_power_internal_phy(priv);873858 if (ret)874859 return ret;···898883 return ret;899884}900885901901-static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)886886+static int sun8i_dwmac_set_syscon(struct device *dev,887887+ struct plat_stmmacenet_data *plat)902888{903903- struct sunxi_priv_data *gmac = priv->plat->bsp_priv;904904- struct device_node *node = priv->device->of_node;889889+ struct sunxi_priv_data *gmac = plat->bsp_priv;890890+ struct device_node *node = dev->of_node;905891 int ret;906892 u32 reg, val;907893908894 ret = regmap_field_read(gmac->regmap_field, &val);909895 if (ret) {910910- dev_err(priv->device, "Fail to read from regmap field.\n");896896+ dev_err(dev, "Fail to read from regmap field.\n");911897 return ret;912898 }913899914900 reg = gmac->variant->default_syscon_value;915901 if (reg != val)916916- dev_warn(priv->device,902902+ dev_warn(dev,917903 "Current syscon value is not the default %x (expect %x)\n",918904 val, reg);919905···927911 /* Force EPHY xtal frequency to 24MHz. */928912 reg |= H3_EPHY_CLK_SEL;929913930930- ret = of_mdio_parse_addr(priv->device, priv->plat->phy_node);914914+ ret = of_mdio_parse_addr(dev, plat->phy_node);931915 if (ret < 0) {932932- dev_err(priv->device, "Could not parse MDIO addr\n");916916+ dev_err(dev, "Could not parse MDIO addr\n");933917 return ret;934918 }935919 /* of_mdio_parse_addr returns a valid (0 ~ 31) PHY···945929946930 if (!of_property_read_u32(node, "allwinner,tx-delay-ps", &val)) {947931 if (val % 100) {948948- dev_err(priv->device, "tx-delay must be a multiple of 100\n");932932+ dev_err(dev, "tx-delay must be a multiple of 100\n");949933 return -EINVAL;950934 }951935 val /= 100;952952- dev_dbg(priv->device, "set tx-delay to %x\n", val);936936+ dev_dbg(dev, "set tx-delay to %x\n", val);953937 if (val <= gmac->variant->tx_delay_max) {954938 reg &= ~(gmac->variant->tx_delay_max <<955939 SYSCON_ETXDC_SHIFT);956940 reg |= (val << SYSCON_ETXDC_SHIFT);957941 } else {958958- dev_err(priv->device, "Invalid TX clock delay: %d\n",942942+ dev_err(dev, "Invalid TX clock delay: %d\n",959943 val);960944 return -EINVAL;961945 }···963947964948 if (!of_property_read_u32(node, "allwinner,rx-delay-ps", &val)) {965949 if (val % 100) {966966- dev_err(priv->device, "rx-delay must be a multiple of 100\n");950950+ dev_err(dev, "rx-delay must be a multiple of 100\n");967951 return -EINVAL;968952 }969953 val /= 100;970970- dev_dbg(priv->device, "set rx-delay to %x\n", val);954954+ dev_dbg(dev, "set rx-delay to %x\n", val);971955 if (val <= gmac->variant->rx_delay_max) {972956 reg &= ~(gmac->variant->rx_delay_max <<973957 SYSCON_ERXDC_SHIFT);974958 reg |= (val << SYSCON_ERXDC_SHIFT);975959 } else {976976- dev_err(priv->device, "Invalid RX clock delay: %d\n",960960+ dev_err(dev, "Invalid RX clock delay: %d\n",977961 val);978962 return -EINVAL;979963 }···984968 if (gmac->variant->support_rmii)985969 reg &= ~SYSCON_RMII_EN;986970987987- switch (priv->plat->interface) {971971+ switch (plat->interface) {988972 case PHY_INTERFACE_MODE_MII:989973 /* default */990974 break;···998982 reg |= SYSCON_RMII_EN | SYSCON_ETCS_EXT_GMII;999983 break;1000984 default:10011001- dev_err(priv->device, "Unsupported interface mode: %s",10021002- phy_modes(priv->plat->interface));985985+ dev_err(dev, "Unsupported interface mode: %s",986986+ phy_modes(plat->interface));1003987 return -EINVAL;1004988 }1005989···10201004 struct sunxi_priv_data *gmac = priv;1021100510221006 if (gmac->variant->soc_has_internal_phy) {10231023- /* sun8i_dwmac_exit could be called with mdiomux uninit */10241024- if (gmac->mux_handle)10251025- mdio_mux_uninit(gmac->mux_handle);10261007 if (gmac->internal_phy_powered)10271008 sun8i_dwmac_unpower_internal_phy(gmac);10281009 }10291029-10301030- sun8i_dwmac_unset_syscon(gmac);10311031-10321032- reset_control_put(gmac->rst_ephy);1033101010341011 clk_disable_unprepare(gmac->tx_clk);10351012···10581049{10591050 struct mac_device_info *mac;10601051 struct stmmac_priv *priv = ppriv;10611061- int ret;1062105210631053 mac = devm_kzalloc(priv->device, sizeof(*mac), GFP_KERNEL);10641054 if (!mac)10651065- return NULL;10661066-10671067- ret = sun8i_dwmac_set_syscon(priv);10681068- if (ret)10691055 return NULL;1070105610711057 mac->pcsr = priv->ioaddr;···11381134 if (ret)11391135 return ret;1140113611411141- plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);11421142- if (IS_ERR(plat_dat))11431143- return PTR_ERR(plat_dat);11441144-11451137 gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL);11461138 if (!gmac)11471139 return -ENOMEM;···12011201 ret = of_get_phy_mode(dev->of_node, &interface);12021202 if (ret)12031203 return -EINVAL;12041204- plat_dat->interface = interface;12041204+12051205+ plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);12061206+ if (IS_ERR(plat_dat))12071207+ return PTR_ERR(plat_dat);1205120812061209 /* platform data specifying hardware features and callbacks.12071210 * hardware features were copied from Allwinner drivers.12081211 */12121212+ plat_dat->interface = interface;12091213 plat_dat->rx_coe = STMMAC_RX_COE_TYPE2;12101214 plat_dat->tx_coe = 1;12111215 plat_dat->has_sun8i = true;···12181214 plat_dat->exit = sun8i_dwmac_exit;12191215 plat_dat->setup = sun8i_dwmac_setup;1220121612171217+ ret = sun8i_dwmac_set_syscon(&pdev->dev, plat_dat);12181218+ if (ret)12191219+ goto dwmac_deconfig;12201220+12211221 ret = sun8i_dwmac_init(pdev, plat_dat->bsp_priv);12221222 if (ret)12231223- return ret;12231223+ goto dwmac_syscon;1224122412251225 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);12261226 if (ret)···12381230 if (gmac->variant->soc_has_internal_phy) {12391231 ret = get_ephy_nodes(priv);12401232 if (ret)12411241- goto dwmac_exit;12331233+ goto dwmac_remove;12421234 ret = sun8i_dwmac_register_mdio_mux(priv);12431235 if (ret) {12441236 dev_err(&pdev->dev, "Failed to register mux\n");···12471239 } else {12481240 ret = sun8i_dwmac_reset(priv);12491241 if (ret)12501250- goto dwmac_exit;12421242+ goto dwmac_remove;12511243 }1252124412531245 return ret;12541246dwmac_mux:12551255- sun8i_dwmac_unset_syscon(gmac);12471247+ reset_control_put(gmac->rst_ephy);12481248+ clk_put(gmac->ephy_clk);12491249+dwmac_remove:12501250+ stmmac_dvr_remove(&pdev->dev);12561251dwmac_exit:12521252+ sun8i_dwmac_exit(pdev, gmac);12531253+dwmac_syscon:12541254+ sun8i_dwmac_unset_syscon(gmac);12551255+dwmac_deconfig:12561256+ stmmac_remove_config_dt(pdev, plat_dat);12571257+12581258+ return ret;12591259+}12601260+12611261+static int sun8i_dwmac_remove(struct platform_device *pdev)12621262+{12631263+ struct net_device *ndev = platform_get_drvdata(pdev);12641264+ struct stmmac_priv *priv = netdev_priv(ndev);12651265+ struct sunxi_priv_data *gmac = priv->plat->bsp_priv;12661266+12671267+ if (gmac->variant->soc_has_internal_phy) {12681268+ mdio_mux_uninit(gmac->mux_handle);12691269+ sun8i_dwmac_unpower_internal_phy(gmac);12701270+ reset_control_put(gmac->rst_ephy);12711271+ clk_put(gmac->ephy_clk);12721272+ }12731273+12571274 stmmac_pltfr_remove(pdev);12581258-return ret;12751275+ sun8i_dwmac_unset_syscon(gmac);12761276+12771277+ return 0;12591278}1260127912611280static const struct of_device_id sun8i_dwmac_match[] = {···1304126913051270static struct platform_driver sun8i_dwmac_driver = {13061271 .probe = sun8i_dwmac_probe,13071307- .remove = stmmac_pltfr_remove,12721272+ .remove = sun8i_dwmac_remove,13081273 .driver = {13091274 .name = "dwmac-sun8i",13101275 .pm = &stmmac_pltfr_pm_ops,
+6-2
drivers/net/usb/cdc_ncm.c
···11991199 * accordingly. Otherwise, we should check here.12001200 */12011201 if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)12021202- delayed_ndp_size = ALIGN(ctx->max_ndp_size, ctx->tx_ndp_modulus);12021202+ delayed_ndp_size = ctx->max_ndp_size +12031203+ max_t(u32,12041204+ ctx->tx_ndp_modulus,12051205+ ctx->tx_modulus + ctx->tx_remainder) - 1;12031206 else12041207 delayed_ndp_size = 0;12051208···14131410 if (!(dev->driver_info->flags & FLAG_SEND_ZLP) &&14141411 skb_out->len > ctx->min_tx_pkt) {14151412 padding_count = ctx->tx_curr_size - skb_out->len;14161416- skb_put_zero(skb_out, padding_count);14131413+ if (!WARN_ON(padding_count > ctx->tx_curr_size))14141414+ skb_put_zero(skb_out, padding_count);14171415 } else if (skb_out->len < ctx->tx_curr_size &&14181416 (skb_out->len % dev->maxpacket) == 0) {14191417 skb_put_u8(skb_out, 0); /* force short packet */
+1
drivers/net/wan/Kconfig
···282282 tristate "Slic Maxim ds26522 card support"283283 depends on SPI284284 depends on FSL_SOC || ARCH_MXC || ARCH_LAYERSCAPE || COMPILE_TEST285285+ select BITREVERSE285286 help286287 This module initializes and configures the slic maxim card287288 in T1 or E1 mode.
+1
drivers/net/wireless/ath/wil6210/Kconfig
···22config WIL621033 tristate "Wilocity 60g WiFi card wil6210 support"44 select WANT_DEV_COREDUMP55+ select CRC3256 depends on CFG8021167 depends on PCI78 default n
+2
drivers/ptp/Kconfig
···6464 depends on NETWORK_PHY_TIMESTAMPING6565 depends on PHYLIB6666 depends on PTP_1588_CLOCK6767+ select CRC326768 help6869 Supports the DP83640 PHYTER with IEEE 1588 features.6970···7978config PTP_1588_CLOCK_INES8079 tristate "ZHAW InES PTP time stamping IP core"8180 depends on NETWORK_PHY_TIMESTAMPING8181+ depends on HAS_IOMEM8282 depends on PHYLIB8383 depends on PTP_1588_CLOCK8484 help
+1
drivers/regulator/Kconfig
···881881config REGULATOR_QCOM_RPMH882882 tristate "Qualcomm Technologies, Inc. RPMh regulator driver"883883 depends on QCOM_RPMH || (QCOM_RPMH=n && COMPILE_TEST)884884+ depends on QCOM_COMMAND_DB || (QCOM_COMMAND_DB=n && COMPILE_TEST)884885 help885886 This driver supports control of PMIC regulators via the RPMh hardware886887 block found on Qualcomm Technologies Inc. SoCs. RPMh regulator
···55075507 return rc;55085508}5509550955105510-static int qeth_set_online(struct qeth_card *card)55105510+static int qeth_set_online(struct qeth_card *card,55115511+ const struct qeth_discipline *disc)55115512{55125513 bool carrier_ok;55135514 int rc;5514551555155515- mutex_lock(&card->discipline_mutex);55165516 mutex_lock(&card->conf_mutex);55175517 QETH_CARD_TEXT(card, 2, "setonlin");55185518···55295529 /* no need for locking / error handling at this early stage: */55305530 qeth_set_real_num_tx_queues(card, qeth_tx_actual_queues(card));5531553155325532- rc = card->discipline->set_online(card, carrier_ok);55325532+ rc = disc->set_online(card, carrier_ok);55335533 if (rc)55345534 goto err_online;55355535···55375537 kobject_uevent(&card->gdev->dev.kobj, KOBJ_CHANGE);5538553855395539 mutex_unlock(&card->conf_mutex);55405540- mutex_unlock(&card->discipline_mutex);55415540 return 0;5542554155435542err_online:···55515552 qdio_free(CARD_DDEV(card));5552555355535554 mutex_unlock(&card->conf_mutex);55545554- mutex_unlock(&card->discipline_mutex);55555555 return rc;55565556}5557555755585558-int qeth_set_offline(struct qeth_card *card, bool resetting)55585558+int qeth_set_offline(struct qeth_card *card, const struct qeth_discipline *disc,55595559+ bool resetting)55595560{55605561 int rc, rc2, rc3;5561556255625562- mutex_lock(&card->discipline_mutex);55635563 mutex_lock(&card->conf_mutex);55645564 QETH_CARD_TEXT(card, 3, "setoffl");55655565···5579558155805582 cancel_work_sync(&card->rx_mode_work);5581558355825582- card->discipline->set_offline(card);55845584+ disc->set_offline(card);5583558555845586 qeth_qdio_clear_card(card, 0);55855587 qeth_drain_output_queues(card);···56005602 kobject_uevent(&card->gdev->dev.kobj, KOBJ_CHANGE);5601560356025604 mutex_unlock(&card->conf_mutex);56035603- mutex_unlock(&card->discipline_mutex);56045605 return 0;56055606}56065607EXPORT_SYMBOL_GPL(qeth_set_offline);5607560856085609static int qeth_do_reset(void *data)56095610{56115611+ const struct qeth_discipline *disc;56105612 struct qeth_card *card = data;56115613 int rc;56145614+56155615+ /* Lock-free, other users will block until we are done. */56165616+ disc = card->discipline;5612561756135618 QETH_CARD_TEXT(card, 2, "recover1");56145619 if (!qeth_do_run_thread(card, QETH_RECOVER_THREAD))···56205619 dev_warn(&card->gdev->dev,56215620 "A recovery process has been started for the device\n");5622562156235623- qeth_set_offline(card, true);56245624- rc = qeth_set_online(card);56225622+ qeth_set_offline(card, disc, true);56235623+ rc = qeth_set_online(card, disc);56255624 if (!rc) {56265625 dev_info(&card->gdev->dev,56275626 "Device successfully recovered!\n");···65856584 break;65866585 default:65876586 card->info.layer_enforced = true;65876587+ /* It's so early that we don't need the discipline_mutex yet. */65886588 rc = qeth_core_load_discipline(card, enforced_disc);65896589 if (rc)65906590 goto err_load;···6618661666196617 QETH_CARD_TEXT(card, 2, "removedv");6620661866196619+ mutex_lock(&card->discipline_mutex);66216620 if (card->discipline) {66226621 card->discipline->remove(gdev);66236622 qeth_core_free_discipline(card);66246623 }66246624+ mutex_unlock(&card->discipline_mutex);6625662566266626 qeth_free_qdio_queues(card);66276627···66386634 int rc = 0;66396635 enum qeth_discipline_id def_discipline;6640663666376637+ mutex_lock(&card->discipline_mutex);66416638 if (!card->discipline) {66426639 def_discipline = IS_IQD(card) ? QETH_DISCIPLINE_LAYER3 :66436640 QETH_DISCIPLINE_LAYER2;···66526647 }66536648 }6654664966556655- rc = qeth_set_online(card);66506650+ rc = qeth_set_online(card, card->discipline);66516651+66566652err:66536653+ mutex_unlock(&card->discipline_mutex);66576654 return rc;66586655}6659665666606657static int qeth_core_set_offline(struct ccwgroup_device *gdev)66616658{66626659 struct qeth_card *card = dev_get_drvdata(&gdev->dev);66606660+ int rc;6663666166646664- return qeth_set_offline(card, false);66626662+ mutex_lock(&card->discipline_mutex);66636663+ rc = qeth_set_offline(card, card->discipline, false);66646664+ mutex_unlock(&card->discipline_mutex);66656665+66666666+ return rc;66656667}6666666866676669static void qeth_core_shutdown(struct ccwgroup_device *gdev)
+1-1
drivers/s390/net/qeth_l2_main.c
···22082208 wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0);2209220922102210 if (gdev->state == CCWGROUP_ONLINE)22112211- qeth_set_offline(card, false);22112211+ qeth_set_offline(card, card->discipline, false);2212221222132213 cancel_work_sync(&card->close_dev_work);22142214 if (card->dev->reg_state == NETREG_REGISTERED)
+2-2
drivers/s390/net/qeth_l3_main.c
···18131813 struct net_device *dev,18141814 netdev_features_t features)18151815{18161816- if (qeth_get_ip_version(skb) != 4)18161816+ if (vlan_get_protocol(skb) != htons(ETH_P_IP))18171817 features &= ~NETIF_F_HW_VLAN_CTAG_TX;18181818 return qeth_features_check(skb, dev, features);18191819}···19711971 wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0);1972197219731973 if (cgdev->state == CCWGROUP_ONLINE)19741974- qeth_set_offline(card, false);19741974+ qeth_set_offline(card, card->discipline, false);1975197519761976 cancel_work_sync(&card->close_dev_work);19771977 if (card->dev->reg_state == NETREG_REGISTERED)
+17-15
drivers/spi/spi-altera.c
···189189190190 /* send the first byte */191191 altera_spi_tx_word(hw);192192- } else {193193- while (hw->count < hw->len) {194194- altera_spi_tx_word(hw);195192196196- for (;;) {197197- altr_spi_readl(hw, ALTERA_SPI_STATUS, &val);198198- if (val & ALTERA_SPI_STATUS_RRDY_MSK)199199- break;200200-201201- cpu_relax();202202- }203203-204204- altera_spi_rx_word(hw);205205- }206206- spi_finalize_current_transfer(master);193193+ return 1;207194 }208195209209- return t->len;196196+ while (hw->count < hw->len) {197197+ altera_spi_tx_word(hw);198198+199199+ for (;;) {200200+ altr_spi_readl(hw, ALTERA_SPI_STATUS, &val);201201+ if (val & ALTERA_SPI_STATUS_RRDY_MSK)202202+ break;203203+204204+ cpu_relax();205205+ }206206+207207+ altera_spi_rx_word(hw);208208+ }209209+ spi_finalize_current_transfer(master);210210+211211+ return 0;210212}211213212214static irqreturn_t altera_spi_irq(int irq, void *dev)
+80-4
drivers/spi/spi-geni-qcom.c
···8383 spinlock_t lock;8484 int irq;8585 bool cs_flag;8686+ bool abort_failed;8687};87888889static int get_spi_clk_cfg(unsigned int speed_hz,···142141 spin_unlock_irq(&mas->lock);143142144143 time_left = wait_for_completion_timeout(&mas->abort_done, HZ);145145- if (!time_left)144144+ if (!time_left) {146145 dev_err(mas->dev, "Failed to cancel/abort m_cmd\n");146146+147147+ /*148148+ * No need for a lock since SPI core has a lock and we never149149+ * access this from an interrupt.150150+ */151151+ mas->abort_failed = true;152152+ }153153+}154154+155155+static bool spi_geni_is_abort_still_pending(struct spi_geni_master *mas)156156+{157157+ struct geni_se *se = &mas->se;158158+ u32 m_irq, m_irq_en;159159+160160+ if (!mas->abort_failed)161161+ return false;162162+163163+ /*164164+ * The only known case where a transfer times out and then a cancel165165+ * times out then an abort times out is if something is blocking our166166+ * interrupt handler from running. Avoid starting any new transfers167167+ * until that sorts itself out.168168+ */169169+ spin_lock_irq(&mas->lock);170170+ m_irq = readl(se->base + SE_GENI_M_IRQ_STATUS);171171+ m_irq_en = readl(se->base + SE_GENI_M_IRQ_EN);172172+ spin_unlock_irq(&mas->lock);173173+174174+ if (m_irq & m_irq_en) {175175+ dev_err(mas->dev, "Interrupts pending after abort: %#010x\n",176176+ m_irq & m_irq_en);177177+ return true;178178+ }179179+180180+ /*181181+ * If we're here the problem resolved itself so no need to check more182182+ * on future transfers.183183+ */184184+ mas->abort_failed = false;185185+186186+ return false;147187}148188149189static void spi_geni_set_cs(struct spi_device *slv, bool set_flag)···200158 if (set_flag == mas->cs_flag)201159 return;202160203203- mas->cs_flag = set_flag;204204-205161 pm_runtime_get_sync(mas->dev);162162+163163+ if (spi_geni_is_abort_still_pending(mas)) {164164+ dev_err(mas->dev, "Can't set chip select\n");165165+ goto exit;166166+ }167167+206168 spin_lock_irq(&mas->lock);169169+ if (mas->cur_xfer) {170170+ dev_err(mas->dev, "Can't set CS when prev xfer running\n");171171+ spin_unlock_irq(&mas->lock);172172+ goto exit;173173+ }174174+175175+ mas->cs_flag = set_flag;207176 reinit_completion(&mas->cs_done);208177 if (set_flag)209178 geni_se_setup_m_cmd(se, SPI_CS_ASSERT, 0);···223170 spin_unlock_irq(&mas->lock);224171225172 time_left = wait_for_completion_timeout(&mas->cs_done, HZ);226226- if (!time_left)173173+ if (!time_left) {174174+ dev_warn(mas->dev, "Timeout setting chip select\n");227175 handle_fifo_timeout(spi, NULL);176176+ }228177178178+exit:229179 pm_runtime_put(mas->dev);230180}231181···336280 int ret;337281 struct spi_geni_master *mas = spi_master_get_devdata(spi);338282283283+ if (spi_geni_is_abort_still_pending(mas))284284+ return -EBUSY;285285+339286 ret = setup_fifo_params(spi_msg->spi, spi);340287 if (ret)341288 dev_err(mas->dev, "Couldn't select mode %d\n", ret);···413354 unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas);414355 unsigned int i = 0;415356357357+ /* Stop the watermark IRQ if nothing to send */358358+ if (!mas->cur_xfer) {359359+ writel(0, se->base + SE_GENI_TX_WATERMARK_REG);360360+ return false;361361+ }362362+416363 max_bytes = (mas->tx_fifo_depth - mas->tx_wm) * bytes_per_fifo_word;417364 if (mas->tx_rem_bytes < max_bytes)418365 max_bytes = mas->tx_rem_bytes;···461396 if (rx_last_byte_valid && rx_last_byte_valid < 4)462397 rx_bytes -= bytes_per_fifo_word - rx_last_byte_valid;463398 }399399+400400+ /* Clear out the FIFO and bail if nowhere to put it */401401+ if (!mas->cur_xfer) {402402+ for (i = 0; i < DIV_ROUND_UP(rx_bytes, bytes_per_fifo_word); i++)403403+ readl(se->base + SE_GENI_RX_FIFOn);404404+ return;405405+ }406406+464407 if (mas->rx_rem_bytes < rx_bytes)465408 rx_bytes = mas->rx_rem_bytes;466409···567494 struct spi_transfer *xfer)568495{569496 struct spi_geni_master *mas = spi_master_get_devdata(spi);497497+498498+ if (spi_geni_is_abort_still_pending(mas))499499+ return -EBUSY;570500571501 /* Terminate and return success for 0 byte length transfer */572502 if (!xfer->len)
···11081108{11091109 struct spi_statistics *statm = &ctlr->statistics;11101110 struct spi_statistics *stats = &msg->spi->statistics;11111111+ u32 speed_hz = xfer->speed_hz;11111112 unsigned long long ms;1112111311131114 if (spi_controller_is_slave(ctlr)) {···11171116 return -EINTR;11181117 }11191118 } else {11191119+ if (!speed_hz)11201120+ speed_hz = 100000;11211121+11201122 ms = 8LL * 1000LL * xfer->len;11211121- do_div(ms, xfer->speed_hz);11231123+ do_div(ms, speed_hz);11221124 ms += ms + 200; /* some tolerance */1123112511241126 if (ms > UINT_MAX)···33823378 if (status)33833379 return status;3384338033853385- if (!spi->max_speed_hz ||33863386- spi->max_speed_hz > spi->controller->max_speed_hz)33813381+ if (spi->controller->max_speed_hz &&33823382+ (!spi->max_speed_hz ||33833383+ spi->max_speed_hz > spi->controller->max_speed_hz))33873384 spi->max_speed_hz = spi->controller->max_speed_hz;3388338533893386 mutex_lock(&spi->controller->io_mutex);
+14
drivers/tty/Kconfig
···401401 help402402 FDC channel number to use for KGDB.403403404404+config NULL_TTY405405+ tristate "NULL TTY driver"406406+ help407407+ Say Y here if you want a NULL TTY which simply discards messages.408408+409409+ This is useful to allow userspace applications which expect a console410410+ device to work without modifications even when no console is411411+ available or desired.412412+413413+ In order to use this driver, you should redirect the console to this414414+ TTY, or boot the kernel with console=ttynull.415415+416416+ If unsure, say N.417417+404418config TRACE_ROUTER405419 tristate "Trace data router for MIPI P1149.7 cJTAG standard"406420 depends on TRACE_SINK
···22/*33 * Copyright (C) 2019 Axis Communications AB44 *55- * The console is useful for userspace applications which expect a console66- * device to work without modifications even when no console is available77- * or desired.88- *99- * In order to use this driver, you should redirect the console to this1010- * TTY, or boot the kernel with console=ttynull.1111- *125 * Based on ttyprintk.c:136 * Copyright (C) 2010 Samo Pogacnik147 */···5865 .name = "ttynull",5966 .device = ttynull_device,6067};6161-6262-void __init register_ttynull_console(void)6363-{6464- if (!ttynull_driver)6565- return;6666-6767- if (add_preferred_console(ttynull_console.name, 0, NULL))6868- return;6969-7070- register_console(&ttynull_console);7171-}72687369static int __init ttynull_init(void)7470{
+65-3
drivers/vhost/vsock.c
···3030#define VHOST_VSOCK_PKT_WEIGHT 25631313232enum {3333- VHOST_VSOCK_FEATURES = VHOST_FEATURES,3333+ VHOST_VSOCK_FEATURES = VHOST_FEATURES |3434+ (1ULL << VIRTIO_F_ACCESS_PLATFORM)3535+};3636+3737+enum {3838+ VHOST_VSOCK_BACKEND_FEATURES = (1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2)3439};35403641/* Used to track all the vhost_vsock instances on the system. */···9792 mutex_lock(&vq->mutex);98939994 if (!vhost_vq_get_backend(vq))9595+ goto out;9696+9797+ if (!vq_meta_prefetch(vq))10098 goto out;10199102100 /* Avoid further vmexits, we're already processing the virtqueue */···457449 if (!vhost_vq_get_backend(vq))458450 goto out;459451452452+ if (!vq_meta_prefetch(vq))453453+ goto out;454454+460455 vhost_disable_notify(&vsock->dev, vq);461456 do {462457 u32 len;···777766 mutex_lock(&vsock->dev.mutex);778767 if ((features & (1 << VHOST_F_LOG_ALL)) &&779768 !vhost_log_access_ok(&vsock->dev)) {780780- mutex_unlock(&vsock->dev.mutex);781781- return -EFAULT;769769+ goto err;770770+ }771771+772772+ if ((features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) {773773+ if (vhost_init_device_iotlb(&vsock->dev, true))774774+ goto err;782775 }783776784777 for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) {···793778 }794779 mutex_unlock(&vsock->dev.mutex);795780 return 0;781781+782782+err:783783+ mutex_unlock(&vsock->dev.mutex);784784+ return -EFAULT;796785}797786798787static long vhost_vsock_dev_ioctl(struct file *f, unsigned int ioctl,···830811 if (copy_from_user(&features, argp, sizeof(features)))831812 return -EFAULT;832813 return vhost_vsock_set_features(vsock, features);814814+ case VHOST_GET_BACKEND_FEATURES:815815+ features = VHOST_VSOCK_BACKEND_FEATURES;816816+ if (copy_to_user(argp, &features, sizeof(features)))817817+ return -EFAULT;818818+ return 0;819819+ case VHOST_SET_BACKEND_FEATURES:820820+ if (copy_from_user(&features, argp, sizeof(features)))821821+ return -EFAULT;822822+ if (features & ~VHOST_VSOCK_BACKEND_FEATURES)823823+ return -EOPNOTSUPP;824824+ vhost_set_backend_features(&vsock->dev, features);825825+ return 0;833826 default:834827 mutex_lock(&vsock->dev.mutex);835828 r = vhost_dev_ioctl(&vsock->dev, ioctl, argp);···854823 }855824}856825826826+static ssize_t vhost_vsock_chr_read_iter(struct kiocb *iocb, struct iov_iter *to)827827+{828828+ struct file *file = iocb->ki_filp;829829+ struct vhost_vsock *vsock = file->private_data;830830+ struct vhost_dev *dev = &vsock->dev;831831+ int noblock = file->f_flags & O_NONBLOCK;832832+833833+ return vhost_chr_read_iter(dev, to, noblock);834834+}835835+836836+static ssize_t vhost_vsock_chr_write_iter(struct kiocb *iocb,837837+ struct iov_iter *from)838838+{839839+ struct file *file = iocb->ki_filp;840840+ struct vhost_vsock *vsock = file->private_data;841841+ struct vhost_dev *dev = &vsock->dev;842842+843843+ return vhost_chr_write_iter(dev, from);844844+}845845+846846+static __poll_t vhost_vsock_chr_poll(struct file *file, poll_table *wait)847847+{848848+ struct vhost_vsock *vsock = file->private_data;849849+ struct vhost_dev *dev = &vsock->dev;850850+851851+ return vhost_chr_poll(file, dev, wait);852852+}853853+857854static const struct file_operations vhost_vsock_fops = {858855 .owner = THIS_MODULE,859856 .open = vhost_vsock_dev_open,···889830 .llseek = noop_llseek,890831 .unlocked_ioctl = vhost_vsock_dev_ioctl,891832 .compat_ioctl = compat_ptr_ioctl,833833+ .read_iter = vhost_vsock_chr_read_iter,834834+ .write_iter = vhost_vsock_chr_write_iter,835835+ .poll = vhost_vsock_chr_poll,892836};893837894838static struct miscdevice vhost_vsock_misc = {
+9
fs/btrfs/btrfs_inode.h
···4242 * to an inode.4343 */4444 BTRFS_INODE_NO_XATTRS,4545+ /*4646+ * Set when we are in a context where we need to start a transaction and4747+ * have dirty pages with the respective file range locked. This is to4848+ * ensure that when reserving space for the transaction, if we are low4949+ * on available space and need to flush delalloc, we will not flush5050+ * delalloc for this inode, because that could result in a deadlock (on5151+ * the file range, inode's io_tree).5252+ */5353+ BTRFS_INODE_NO_DELALLOC_FLUSH,4554};46554756/* in memory btrfs inode */
+22-2
fs/btrfs/ctree.c
···25552555 * @p: Holds all btree nodes along the search path25562556 * @root: The root node of the tree25572557 * @key: The key we are looking for25582558- * @ins_len: Indicates purpose of search, for inserts it is 1, for25592559- * deletions it's -1. 0 for plain searches25582558+ * @ins_len: Indicates purpose of search:25592559+ * >0 for inserts it's size of item inserted (*)25602560+ * <0 for deletions25612561+ * 0 for plain searches, not modifying the tree25622562+ *25632563+ * (*) If size of item inserted doesn't include25642564+ * sizeof(struct btrfs_item), then p->search_for_extension must25652565+ * be set.25602566 * @cow: boolean should CoW operations be performed. Must always be 125612567 * when modifying the tree.25622568 *···2723271727242718 if (level == 0) {27252719 p->slots[level] = slot;27202720+ /*27212721+ * Item key already exists. In this case, if we are27222722+ * allowed to insert the item (for example, in dir_item27232723+ * case, item key collision is allowed), it will be27242724+ * merged with the original item. Only the item size27252725+ * grows, no new btrfs item will be added. If27262726+ * search_for_extension is not set, ins_len already27272727+ * accounts the size btrfs_item, deduct it here so leaf27282728+ * space check will be correct.27292729+ */27302730+ if (ret == 0 && ins_len > 0 && !p->search_for_extension) {27312731+ ASSERT(ins_len >= sizeof(struct btrfs_item));27322732+ ins_len -= sizeof(struct btrfs_item);27332733+ }27262734 if (ins_len > 0 &&27272735 btrfs_leaf_free_space(b) < ins_len) {27282736 if (write_lock_level < 1) {
+27-2
fs/btrfs/ctree.h
···131131 * defrag132132 */133133 BTRFS_FS_STATE_REMOUNTING,134134+ /* Filesystem in RO mode */135135+ BTRFS_FS_STATE_RO,134136 /* Track if a transaction abort has been reported on this filesystem */135137 BTRFS_FS_STATE_TRANS_ABORTED,136138 /*···369367 unsigned int search_commit_root:1;370368 unsigned int need_commit_sem:1;371369 unsigned int skip_release_on_error:1;370370+ /*371371+ * Indicate that new item (btrfs_search_slot) is extending already372372+ * existing item and ins_len contains only the data size and not item373373+ * header (ie. sizeof(struct btrfs_item) is not included).374374+ */375375+ unsigned int search_for_extension:1;372376};373377#define BTRFS_MAX_EXTENT_ITEM_SIZE(r) ((BTRFS_LEAF_DATA_SIZE(r->fs_info) >> 4) - \374378 sizeof(struct btrfs_item))···28932885 * If we remount the fs to be R/O or umount the fs, the cleaner needn't do28942886 * anything except sleeping. This function is used to check the status of28952887 * the fs.28882888+ * We check for BTRFS_FS_STATE_RO to avoid races with a concurrent remount,28892889+ * since setting and checking for SB_RDONLY in the superblock's flags is not28902890+ * atomic.28962891 */28972892static inline int btrfs_need_cleaner_sleep(struct btrfs_fs_info *fs_info)28982893{28992899- return fs_info->sb->s_flags & SB_RDONLY || btrfs_fs_closing(fs_info);28942894+ return test_bit(BTRFS_FS_STATE_RO, &fs_info->fs_state) ||28952895+ btrfs_fs_closing(fs_info);28962896+}28972897+28982898+static inline void btrfs_set_sb_rdonly(struct super_block *sb)28992899+{29002900+ sb->s_flags |= SB_RDONLY;29012901+ set_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);29022902+}29032903+29042904+static inline void btrfs_clear_sb_rdonly(struct super_block *sb)29052905+{29062906+ sb->s_flags &= ~SB_RDONLY;29072907+ clear_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);29002908}2901290929022910/* tree mod log functions from ctree.c */···30973073 u32 min_type);3098307430993075int btrfs_start_delalloc_snapshot(struct btrfs_root *root);31003100-int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, u64 nr);30763076+int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, u64 nr,30773077+ bool in_reclaim_context);31013078int btrfs_set_extent_delalloc(struct btrfs_inode *inode, u64 start, u64 end,31023079 unsigned int extra_bits,31033080 struct extent_state **cached_state);
+1-1
fs/btrfs/dev-replace.c
···715715 * flush all outstanding I/O and inode extent mappings before the716716 * copy operation is declared as being finished717717 */718718- ret = btrfs_start_delalloc_roots(fs_info, U64_MAX);718718+ ret = btrfs_start_delalloc_roots(fs_info, U64_MAX, false);719719 if (ret) {720720 mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);721721 return ret;
+36-34
fs/btrfs/discard.c
···199199static struct btrfs_block_group *peek_discard_list(200200 struct btrfs_discard_ctl *discard_ctl,201201 enum btrfs_discard_state *discard_state,202202- int *discard_index)202202+ int *discard_index, u64 now)203203{204204 struct btrfs_block_group *block_group;205205- const u64 now = ktime_get_ns();206205207206 spin_lock(&discard_ctl->lock);208207again:209208 block_group = find_next_block_group(discard_ctl, now);210209211211- if (block_group && now > block_group->discard_eligible_time) {210210+ if (block_group && now >= block_group->discard_eligible_time) {212211 if (block_group->discard_index == BTRFS_DISCARD_INDEX_UNUSED &&213212 block_group->used != 0) {214213 if (btrfs_is_block_group_data_only(block_group))···221222 block_group->discard_state = BTRFS_DISCARD_EXTENTS;222223 }223224 discard_ctl->block_group = block_group;225225+ }226226+ if (block_group) {224227 *discard_state = block_group->discard_state;225228 *discard_index = block_group->discard_index;226226- } else {227227- block_group = NULL;228229 }229229-230230 spin_unlock(&discard_ctl->lock);231231232232 return block_group;···328330 btrfs_discard_schedule_work(discard_ctl, false);329331}330332331331-/**332332- * btrfs_discard_schedule_work - responsible for scheduling the discard work333333- * @discard_ctl: discard control334334- * @override: override the current timer335335- *336336- * Discards are issued by a delayed workqueue item. @override is used to337337- * update the current delay as the baseline delay interval is reevaluated on338338- * transaction commit. This is also maxed with any other rate limit.339339- */340340-void btrfs_discard_schedule_work(struct btrfs_discard_ctl *discard_ctl,341341- bool override)333333+static void __btrfs_discard_schedule_work(struct btrfs_discard_ctl *discard_ctl,334334+ u64 now, bool override)342335{343336 struct btrfs_block_group *block_group;344344- const u64 now = ktime_get_ns();345345-346346- spin_lock(&discard_ctl->lock);347337348338 if (!btrfs_run_discard_work(discard_ctl))349349- goto out;350350-339339+ return;351340 if (!override && delayed_work_pending(&discard_ctl->work))352352- goto out;341341+ return;353342354343 block_group = find_next_block_group(discard_ctl, now);355344 if (block_group) {···378393 mod_delayed_work(discard_ctl->discard_workers,379394 &discard_ctl->work, nsecs_to_jiffies(delay));380395 }381381-out:396396+}397397+398398+/*399399+ * btrfs_discard_schedule_work - responsible for scheduling the discard work400400+ * @discard_ctl: discard control401401+ * @override: override the current timer402402+ *403403+ * Discards are issued by a delayed workqueue item. @override is used to404404+ * update the current delay as the baseline delay interval is reevaluated on405405+ * transaction commit. This is also maxed with any other rate limit.406406+ */407407+void btrfs_discard_schedule_work(struct btrfs_discard_ctl *discard_ctl,408408+ bool override)409409+{410410+ const u64 now = ktime_get_ns();411411+412412+ spin_lock(&discard_ctl->lock);413413+ __btrfs_discard_schedule_work(discard_ctl, now, override);382414 spin_unlock(&discard_ctl->lock);383415}384416···440438 int discard_index = 0;441439 u64 trimmed = 0;442440 u64 minlen = 0;441441+ u64 now = ktime_get_ns();443442444443 discard_ctl = container_of(work, struct btrfs_discard_ctl, work.work);445444446445 block_group = peek_discard_list(discard_ctl, &discard_state,447447- &discard_index);446446+ &discard_index, now);448447 if (!block_group || !btrfs_run_discard_work(discard_ctl))449448 return;449449+ if (now < block_group->discard_eligible_time) {450450+ btrfs_discard_schedule_work(discard_ctl, false);451451+ return;452452+ }450453451454 /* Perform discarding */452455 minlen = discard_minlen[discard_index];···481474 discard_ctl->discard_extent_bytes += trimmed;482475 }483476484484- /*485485- * Updated without locks as this is inside the workfn and nothing else486486- * is reading the values487487- */488488- discard_ctl->prev_discard = trimmed;489489- discard_ctl->prev_discard_time = ktime_get_ns();490490-491477 /* Determine next steps for a block_group */492478 if (block_group->discard_cursor >= btrfs_block_group_end(block_group)) {493479 if (discard_state == BTRFS_DISCARD_BITMAPS) {···496496 }497497 }498498499499+ now = ktime_get_ns();499500 spin_lock(&discard_ctl->lock);501501+ discard_ctl->prev_discard = trimmed;502502+ discard_ctl->prev_discard_time = now;500503 discard_ctl->block_group = NULL;504504+ __btrfs_discard_schedule_work(discard_ctl, now, false);501505 spin_unlock(&discard_ctl->lock);502502-503503- btrfs_discard_schedule_work(discard_ctl, false);504506}505507506508/**
+8-5
fs/btrfs/disk-io.c
···17291729 */17301730 btrfs_delete_unused_bgs(fs_info);17311731sleep:17321732- clear_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags);17321732+ clear_and_wake_up_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags);17331733 if (kthread_should_park())17341734 kthread_parkme();17351735 if (kthread_should_stop())···28302830 return -ENOMEM;28312831 btrfs_init_delayed_root(fs_info->delayed_root);2832283228332833+ if (sb_rdonly(sb))28342834+ set_bit(BTRFS_FS_STATE_RO, &fs_info->fs_state);28352835+28332836 return btrfs_alloc_stripe_hash_table(fs_info);28342837}28352838···29722969 }29732970 }2974297129722972+ ret = btrfs_find_orphan_roots(fs_info);29752973out:29762974 return ret;29772975}···33863382 goto fail_qgroup;33873383 }33883384 }33893389-33903390- ret = btrfs_find_orphan_roots(fs_info);33913391- if (ret)33923392- goto fail_qgroup;3393338533943386 fs_info->fs_root = btrfs_get_fs_root(fs_info, BTRFS_FS_TREE_OBJECTID, true);33953387 if (IS_ERR(fs_info->fs_root)) {···41804180 */41814181 invalidate_inode_pages2(fs_info->btree_inode->i_mapping);41824182 btrfs_stop_all_workers(fs_info);41834183+41844184+ /* We shouldn't have any transaction open at this point */41854185+ ASSERT(list_empty(&fs_info->trans_list));4183418641844187 clear_bit(BTRFS_FS_OPEN, &fs_info->flags);41854188 free_root_pointers(fs_info, true);
···93909390 * some fairly slow code that needs optimization. This walks the list93919391 * of all the inodes with pending delalloc and forces them to disk.93929392 */93939393-static int start_delalloc_inodes(struct btrfs_root *root, u64 *nr, bool snapshot)93939393+static int start_delalloc_inodes(struct btrfs_root *root, u64 *nr, bool snapshot,93949394+ bool in_reclaim_context)93949395{93959396 struct btrfs_inode *binode;93969397 struct inode *inode;···9412941194139412 list_move_tail(&binode->delalloc_inodes,94149413 &root->delalloc_inodes);94149414+94159415+ if (in_reclaim_context &&94169416+ test_bit(BTRFS_INODE_NO_DELALLOC_FLUSH, &binode->runtime_flags))94179417+ continue;94189418+94159419 inode = igrab(&binode->vfs_inode);94169420 if (!inode) {94179421 cond_resched_lock(&root->delalloc_lock);···94709464 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state))94719465 return -EROFS;9472946694739473- return start_delalloc_inodes(root, &nr, true);94679467+ return start_delalloc_inodes(root, &nr, true, false);94749468}9475946994769476-int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, u64 nr)94709470+int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, u64 nr,94719471+ bool in_reclaim_context)94779472{94789473 struct btrfs_root *root;94799474 struct list_head splice;···94979490 &fs_info->delalloc_roots);94989491 spin_unlock(&fs_info->delalloc_root_lock);9499949295009500- ret = start_delalloc_inodes(root, &nr, false);94939493+ ret = start_delalloc_inodes(root, &nr, false, in_reclaim_context);95019494 btrfs_put_root(root);95029495 if (ret < 0)95039496 goto out;
+1-1
fs/btrfs/ioctl.c
···49514951 case BTRFS_IOC_SYNC: {49524952 int ret;4953495349544954- ret = btrfs_start_delalloc_roots(fs_info, U64_MAX);49544954+ ret = btrfs_start_delalloc_roots(fs_info, U64_MAX, false);49554955 if (ret)49564956 return ret;49574957 ret = btrfs_sync_fs(inode->i_sb, 1);
+30-13
fs/btrfs/qgroup.c
···31903190 return ret;31913191}3192319231933193+static bool rescan_should_stop(struct btrfs_fs_info *fs_info)31943194+{31953195+ return btrfs_fs_closing(fs_info) ||31963196+ test_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);31973197+}31983198+31933199static void btrfs_qgroup_rescan_worker(struct btrfs_work *work)31943200{31953201 struct btrfs_fs_info *fs_info = container_of(work, struct btrfs_fs_info,···32043198 struct btrfs_trans_handle *trans = NULL;32053199 int err = -ENOMEM;32063200 int ret = 0;32013201+ bool stopped = false;3207320232083203 path = btrfs_alloc_path();32093204 if (!path)···32173210 path->skip_locking = 1;3218321132193212 err = 0;32203220- while (!err && !btrfs_fs_closing(fs_info)) {32133213+ while (!err && !(stopped = rescan_should_stop(fs_info))) {32213214 trans = btrfs_start_transaction(fs_info->fs_root, 0);32223215 if (IS_ERR(trans)) {32233216 err = PTR_ERR(trans);···32603253 }3261325432623255 mutex_lock(&fs_info->qgroup_rescan_lock);32633263- if (!btrfs_fs_closing(fs_info))32563256+ if (!stopped)32643257 fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_RESCAN;32653258 if (trans) {32663259 ret = update_qgroup_status_item(trans);···3279327232803273 btrfs_end_transaction(trans);3281327432823282- if (btrfs_fs_closing(fs_info)) {32753275+ if (stopped) {32833276 btrfs_info(fs_info, "qgroup scan paused");32843277 } else if (err >= 0) {32853278 btrfs_info(fs_info, "qgroup scan completed%s",···35383531 bool can_commit = true;3539353235403533 /*35413541- * We don't want to run flush again and again, so if there is a running35423542- * one, we won't try to start a new flush, but exit directly.35433543- */35443544- if (test_and_set_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state)) {35453545- wait_event(root->qgroup_flush_wait,35463546- !test_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state));35473547- return 0;35483548- }35493549-35503550- /*35513534 * If current process holds a transaction, we shouldn't flush, as we35523535 * assume all space reservation happens before a transaction handle is35533536 * held.···35503553 if (current->journal_info &&35513554 current->journal_info != BTRFS_SEND_TRANS_STUB)35523555 can_commit = false;35563556+35573557+ /*35583558+ * We don't want to run flush again and again, so if there is a running35593559+ * one, we won't try to start a new flush, but exit directly.35603560+ */35613561+ if (test_and_set_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state)) {35623562+ /*35633563+ * We are already holding a transaction, thus we can block other35643564+ * threads from flushing. So exit right now. This increases35653565+ * the chance of EDQUOT for heavy load and near limit cases.35663566+ * But we can argue that if we're already near limit, EDQUOT is35673567+ * unavoidable anyway.35683568+ */35693569+ if (!can_commit)35703570+ return 0;35713571+35723572+ wait_event(root->qgroup_flush_wait,35733573+ !test_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state));35743574+ return 0;35753575+ }3553357635543577 ret = btrfs_start_delalloc_snapshot(root);35553578 if (ret < 0)
+15
fs/btrfs/reflink.c
···8989 if (ret)9090 goto out_unlock;91919292+ /*9393+ * After dirtying the page our caller will need to start a transaction,9494+ * and if we are low on metadata free space, that can cause flushing of9595+ * delalloc for all inodes in order to get metadata space released.9696+ * However we are holding the range locked for the whole duration of9797+ * the clone/dedupe operation, so we may deadlock if that happens and no9898+ * other task releases enough space. So mark this inode as not being9999+ * possible to flush to avoid such deadlock. We will clear that flag100100+ * when we finish cloning all extents, since a transaction is started101101+ * after finding each extent to clone.102102+ */103103+ set_bit(BTRFS_INODE_NO_DELALLOC_FLUSH, &inode->runtime_flags);104104+92105 if (comp_type == BTRFS_COMPRESS_NONE) {93106 char *map;94107···562549out:563550 btrfs_free_path(path);564551 kvfree(buf);552552+ clear_bit(BTRFS_INODE_NO_DELALLOC_FLUSH, &BTRFS_I(inode)->runtime_flags);553553+565554 return ret;566555}567556
+31-18
fs/btrfs/send.c
···236236 * after this directory is moved, we can try to rmdir the ino rmdir_ino.237237 */238238 u64 rmdir_ino;239239+ u64 rmdir_gen;239240 bool orphanized;240241};241242···317316static struct waiting_dir_move *318317get_waiting_dir_move(struct send_ctx *sctx, u64 ino);319318320320-static int is_waiting_for_rm(struct send_ctx *sctx, u64 dir_ino);319319+static int is_waiting_for_rm(struct send_ctx *sctx, u64 dir_ino, u64 gen);321320322321static int need_send_hole(struct send_ctx *sctx)323322{···2300229923012300 fs_path_reset(name);2302230123032303- if (is_waiting_for_rm(sctx, ino)) {23022302+ if (is_waiting_for_rm(sctx, ino, gen)) {23042303 ret = gen_unique_name(sctx, ino, gen, name);23052304 if (ret < 0)23062305 goto out;···28592858 return ret;28602859}2861286028622862-static struct orphan_dir_info *28632863-add_orphan_dir_info(struct send_ctx *sctx, u64 dir_ino)28612861+static struct orphan_dir_info *add_orphan_dir_info(struct send_ctx *sctx,28622862+ u64 dir_ino, u64 dir_gen)28642863{28652864 struct rb_node **p = &sctx->orphan_dirs.rb_node;28662865 struct rb_node *parent = NULL;···28692868 while (*p) {28702869 parent = *p;28712870 entry = rb_entry(parent, struct orphan_dir_info, node);28722872- if (dir_ino < entry->ino) {28712871+ if (dir_ino < entry->ino)28732872 p = &(*p)->rb_left;28742874- } else if (dir_ino > entry->ino) {28732873+ else if (dir_ino > entry->ino)28752874 p = &(*p)->rb_right;28762876- } else {28752875+ else if (dir_gen < entry->gen)28762876+ p = &(*p)->rb_left;28772877+ else if (dir_gen > entry->gen)28782878+ p = &(*p)->rb_right;28792879+ else28772880 return entry;28782878- }28792881 }2880288228812883 odi = kmalloc(sizeof(*odi), GFP_KERNEL);28822884 if (!odi)28832885 return ERR_PTR(-ENOMEM);28842886 odi->ino = dir_ino;28852885- odi->gen = 0;28872887+ odi->gen = dir_gen;28862888 odi->last_dir_index_offset = 0;2887288928882890 rb_link_node(&odi->node, parent, p);···28932889 return odi;28942890}2895289128962896-static struct orphan_dir_info *28972897-get_orphan_dir_info(struct send_ctx *sctx, u64 dir_ino)28922892+static struct orphan_dir_info *get_orphan_dir_info(struct send_ctx *sctx,28932893+ u64 dir_ino, u64 gen)28982894{28992895 struct rb_node *n = sctx->orphan_dirs.rb_node;29002896 struct orphan_dir_info *entry;···29052901 n = n->rb_left;29062902 else if (dir_ino > entry->ino)29072903 n = n->rb_right;29042904+ else if (gen < entry->gen)29052905+ n = n->rb_left;29062906+ else if (gen > entry->gen)29072907+ n = n->rb_right;29082908 else29092909 return entry;29102910 }29112911 return NULL;29122912}2913291329142914-static int is_waiting_for_rm(struct send_ctx *sctx, u64 dir_ino)29142914+static int is_waiting_for_rm(struct send_ctx *sctx, u64 dir_ino, u64 gen)29152915{29162916- struct orphan_dir_info *odi = get_orphan_dir_info(sctx, dir_ino);29162916+ struct orphan_dir_info *odi = get_orphan_dir_info(sctx, dir_ino, gen);2917291729182918 return odi != NULL;29192919}···29622954 key.type = BTRFS_DIR_INDEX_KEY;29632955 key.offset = 0;2964295629652965- odi = get_orphan_dir_info(sctx, dir);29572957+ odi = get_orphan_dir_info(sctx, dir, dir_gen);29662958 if (odi)29672959 key.offset = odi->last_dir_index_offset;29682960···2993298529942986 dm = get_waiting_dir_move(sctx, loc.objectid);29952987 if (dm) {29962996- odi = add_orphan_dir_info(sctx, dir);29882988+ odi = add_orphan_dir_info(sctx, dir, dir_gen);29972989 if (IS_ERR(odi)) {29982990 ret = PTR_ERR(odi);29992991 goto out;···30012993 odi->gen = dir_gen;30022994 odi->last_dir_index_offset = found_key.offset;30032995 dm->rmdir_ino = dir;29962996+ dm->rmdir_gen = dir_gen;30042997 ret = 0;30052998 goto out;30062999 }3007300030083001 if (loc.objectid > send_progress) {30093009- odi = add_orphan_dir_info(sctx, dir);30023002+ odi = add_orphan_dir_info(sctx, dir, dir_gen);30103003 if (IS_ERR(odi)) {30113004 ret = PTR_ERR(odi);30123005 goto out;···30473038 return -ENOMEM;30483039 dm->ino = ino;30493040 dm->rmdir_ino = 0;30413041+ dm->rmdir_gen = 0;30503042 dm->orphanized = orphanized;3051304330523044 while (*p) {···31933183 while (ino != BTRFS_FIRST_FREE_OBJECTID) {31943184 fs_path_reset(name);3195318531963196- if (is_waiting_for_rm(sctx, ino))31863186+ if (is_waiting_for_rm(sctx, ino, gen))31973187 break;31983188 if (is_waiting_for_move(sctx, ino)) {31993189 if (*ancestor_ino == 0)···32333223 u64 parent_ino, parent_gen;32343224 struct waiting_dir_move *dm = NULL;32353225 u64 rmdir_ino = 0;32263226+ u64 rmdir_gen;32363227 u64 ancestor;32373228 bool is_orphan;32383229 int ret;···32483237 dm = get_waiting_dir_move(sctx, pm->ino);32493238 ASSERT(dm);32503239 rmdir_ino = dm->rmdir_ino;32403240+ rmdir_gen = dm->rmdir_gen;32513241 is_orphan = dm->orphanized;32523242 free_waiting_dir_move(sctx, dm);32533243···32853273 dm = get_waiting_dir_move(sctx, pm->ino);32863274 ASSERT(dm);32873275 dm->rmdir_ino = rmdir_ino;32763276+ dm->rmdir_gen = rmdir_gen;32883277 }32893278 goto out;32903279 }···33043291 struct orphan_dir_info *odi;33053292 u64 gen;3306329333073307- odi = get_orphan_dir_info(sctx, rmdir_ino);32943294+ odi = get_orphan_dir_info(sctx, rmdir_ino, rmdir_gen);33083295 if (!odi) {33093296 /* already deleted */33103297 goto finish;
···175175 btrfs_discard_stop(fs_info);176176177177 /* btrfs handle error by forcing the filesystem readonly */178178- sb->s_flags |= SB_RDONLY;178178+ btrfs_set_sb_rdonly(sb);179179 btrfs_info(fs_info, "forced readonly");180180 /*181181 * Note that a running device replace operation is not canceled here···19531953 /* avoid complains from lockdep et al. */19541954 up(&fs_info->uuid_tree_rescan_sem);1955195519561956- sb->s_flags |= SB_RDONLY;19561956+ btrfs_set_sb_rdonly(sb);1957195719581958 /*19591959 * Setting SB_RDONLY will put the cleaner thread to···19641964 */19651965 btrfs_delete_unused_bgs(fs_info);1966196619671967+ /*19681968+ * The cleaner task could be already running before we set the19691969+ * flag BTRFS_FS_STATE_RO (and SB_RDONLY in the superblock).19701970+ * We must make sure that after we finish the remount, i.e. after19711971+ * we call btrfs_commit_super(), the cleaner can no longer start19721972+ * a transaction - either because it was dropping a dead root,19731973+ * running delayed iputs or deleting an unused block group (the19741974+ * cleaner picked a block group from the list of unused block19751975+ * groups before we were able to in the previous call to19761976+ * btrfs_delete_unused_bgs()).19771977+ */19781978+ wait_on_bit(&fs_info->flags, BTRFS_FS_CLEANER_RUNNING,19791979+ TASK_UNINTERRUPTIBLE);19801980+19811981+ /*19821982+ * We've set the superblock to RO mode, so we might have made19831983+ * the cleaner task sleep without running all pending delayed19841984+ * iputs. Go through all the delayed iputs here, so that if an19851985+ * unmount happens without remounting RW we don't end up at19861986+ * finishing close_ctree() with a non-empty list of delayed19871987+ * iputs.19881988+ */19891989+ btrfs_run_delayed_iputs(fs_info);19901990+19671991 btrfs_dev_replace_suspend_for_unmount(fs_info);19681992 btrfs_scrub_cancel(fs_info);19691993 btrfs_pause_balance(fs_info);19941994+19951995+ /*19961996+ * Pause the qgroup rescan worker if it is running. We don't want19971997+ * it to be still running after we are in RO mode, as after that,19981998+ * by the time we unmount, it might have left a transaction open,19991999+ * so we would leak the transaction and/or crash.20002000+ */20012001+ btrfs_qgroup_wait_for_completion(fs_info, false);1970200219712003 ret = btrfs_commit_super(fs_info);19722004 if (ret)···20382006 if (ret)20392007 goto restore;2040200820412041- sb->s_flags &= ~SB_RDONLY;20092009+ btrfs_clear_sb_rdonly(sb);2042201020432011 set_bit(BTRFS_FS_OPEN, &fs_info->flags);20442012 }···20602028 /* We've hit an error - don't reset SB_RDONLY */20612029 if (sb_rdonly(sb))20622030 old_flags |= SB_RDONLY;20312031+ if (!(old_flags & SB_RDONLY))20322032+ clear_bit(BTRFS_FS_STATE_RO, &fs_info->fs_state);20632033 sb->s_flags = old_flags;20642034 fs_info->mount_opt = old_opts;20652035 fs_info->compress_type = old_compress_type;
···7575 *7676 * @rx_dropped: Number of packets received but not processed,7777 * e.g. due to lack of resources or unsupported protocol.7878- * For hardware interfaces this counter should not include packets7979- * dropped by the device which are counted separately in7878+ * For hardware interfaces this counter may include packets discarded7979+ * due to L2 address filtering but should not include packets dropped8080+ * by the device due to buffer exhaustion which are counted separately in8081 * @rx_missed_errors (since procfs folds those two counters together).8182 *8283 * @tx_dropped: Number of packets dropped on their way to transmission,
+2-8
init/main.c
···14801480 struct file *file = filp_open("/dev/console", O_RDWR, 0);1481148114821482 if (IS_ERR(file)) {14831483- pr_err("Warning: unable to open an initial console. Fallback to ttynull.\n");14841484- register_ttynull_console();14851485-14861486- file = filp_open("/dev/console", O_RDWR, 0);14871487- if (IS_ERR(file)) {14881488- pr_err("Warning: Failed to add ttynull console. No stdin, stdout, and stderr for the init process!\n");14891489- return;14901490- }14831483+ pr_err("Warning: unable to open an initial console.\n");14841484+ return;14911485 }14921486 init_dup(file);14931487 init_dup(file);
+1
kernel/bpf/task_iter.c
···159159 }160160161161 /* set info->task and info->tid */162162+ info->task = curr_task;162163 if (curr_tid == info->tid) {163164 curr_fd = info->fd;164165 } else {
+2-1
net/8021q/vlan.c
···284284 return 0;285285286286out_free_newdev:287287- if (new_dev->reg_state == NETREG_UNINITIALIZED)287287+ if (new_dev->reg_state == NETREG_UNINITIALIZED ||288288+ new_dev->reg_state == NETREG_UNREGISTERED)288289 free_netdev(new_dev);289290 return err;290291}
+1-1
net/ipv4/ip_output.c
···302302 if (skb_is_gso(skb))303303 return ip_finish_output_gso(net, sk, skb, mtu);304304305305- if (skb->len > mtu || (IPCB(skb)->flags & IPSKB_FRAG_PMTU))305305+ if (skb->len > mtu || IPCB(skb)->frag_max_size)306306 return ip_fragment(net, sk, skb, mtu, ip_finish_output2);307307308308 return ip_finish_output2(net, sk, skb);
···627627 for (i = NHA_GROUP_TYPE + 1; i < __NHA_MAX; ++i) {628628 if (!tb[i])629629 continue;630630- if (tb[NHA_FDB])630630+ if (i == NHA_FDB)631631 continue;632632 NL_SET_ERR_MSG(extack,633633 "No other attributes can be set in nexthop groups");···14591459 return nh;1460146014611461out_no_nh:14621462- for (; i >= 0; --i)14621462+ for (i--; i >= 0; --i) {14631463+ list_del(&nhg->nh_entries[i].nh_list);14631464 nexthop_put(nhg->nh_entries[i].nh);14651465+ }1464146614651467 kfree(nhg->spare);14661468 kfree(nhg);
+2-3
net/ipv6/ip6_fib.c
···10251025{10261026 struct fib6_table *table = rt->fib6_table;1027102710281028+ /* Flush all cached dst in exception table */10291029+ rt6_flush_exceptions(rt);10281030 fib6_drop_pcpu_from(rt, table);1029103110301032 if (rt->nh && !list_empty(&rt->nh_list))···19281926 rt->fib6_node = NULL;19291927 net->ipv6.rt6_stats->fib_rt_entries--;19301928 net->ipv6.rt6_stats->fib_discarded_routes++;19311931-19321932- /* Flush all cached dst in exception table */19331933- rt6_flush_exceptions(rt);1934192919351930 /* Reset round-robin state, if necessary */19361931 if (rcu_access_pointer(fn->rr_ptr) == rt)
+4-3
net/qrtr/ns.c
···755755 queue_work(qrtr_ns.workqueue, &qrtr_ns.work);756756}757757758758-void qrtr_ns_init(void)758758+int qrtr_ns_init(void)759759{760760 struct sockaddr_qrtr sq;761761 int ret;···766766 ret = sock_create_kern(&init_net, AF_QIPCRTR, SOCK_DGRAM,767767 PF_QIPCRTR, &qrtr_ns.sock);768768 if (ret < 0)769769- return;769769+ return ret;770770771771 ret = kernel_getsockname(qrtr_ns.sock, (struct sockaddr *)&sq);772772 if (ret < 0) {···797797 if (ret < 0)798798 goto err_wq;799799800800- return;800800+ return 0;801801802802err_wq:803803 destroy_workqueue(qrtr_ns.workqueue);804804err_sock:805805 sock_release(qrtr_ns.sock);806806+ return ret;806807}807808EXPORT_SYMBOL_GPL(qrtr_ns_init);808809
···2121 tristate "cfg80211 - wireless configuration API"2222 depends on RFKILL || !RFKILL2323 select FW_LOADER2424+ select CRC322425 # may need to update this when certificates are changed and are2526 # using a different algorithm, though right now they shouldn't2627 # (this is here rather than below to allow it to be a module)
···17331733 per_pin->silent_stream = false;1734173417351735 unlock_out:17361736- mutex_unlock(&spec->pcm_lock);17361736+ mutex_unlock(&per_pin->lock);17371737}1738173817391739/* update ELD and jack state via audio component */
···869869 pid3=$!870870 ip netns exec me ping -f 2001:db8:101::2 >/dev/null 2>&1 &871871 pid4=$!872872- ip netns exec me mausezahn veth1 -B 2001:db8:101::2 -A 2001:db8:91::1 -c 0 -t tcp "dp=1-1023, flags=syn" >/dev/null 2>&1 &872872+ ip netns exec me mausezahn -6 veth1 -B 2001:db8:101::2 -A 2001:db8:91::1 -c 0 -t tcp "dp=1-1023, flags=syn" >/dev/null 2>&1 &873873 pid5=$!874874875875 sleep 300
+69-2
tools/testing/selftests/net/pmtu.sh
···162162# - list_flush_ipv6_exception163163# Using the same topology as in pmtu_ipv6, create exceptions, and check164164# they are shown when listing exception caches, gone after flushing them165165-165165+#166166+# - pmtu_ipv4_route_change167167+# Use the same topology as in pmtu_ipv4, but issue a route replacement168168+# command and delete the corresponding device afterward. This tests for169169+# proper cleanup of the PMTU exceptions by the route replacement path.170170+# Device unregistration should complete successfully171171+#172172+# - pmtu_ipv6_route_change173173+# Same as above but with IPv6166174167175# Kselftest framework requirement - SKIP code is 4.168176ksft_skip=4···232224 cleanup_ipv4_exception ipv4: cleanup of cached exceptions 1233225 cleanup_ipv6_exception ipv6: cleanup of cached exceptions 1234226 list_flush_ipv4_exception ipv4: list and flush cached exceptions 1235235- list_flush_ipv6_exception ipv6: list and flush cached exceptions 1"227227+ list_flush_ipv6_exception ipv6: list and flush cached exceptions 1228228+ pmtu_ipv4_route_change ipv4: PMTU exception w/route replace 1229229+ pmtu_ipv6_route_change ipv6: PMTU exception w/route replace 1"236230237231NS_A="ns-A"238232NS_B="ns-B"···17901780 fi1791178117921782 return ${fail}17831783+}17841784+17851785+test_pmtu_ipvX_route_change() {17861786+ family=${1}17871787+17881788+ setup namespaces routing || return 217891789+ trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \17901790+ "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \17911791+ "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \17921792+ "${ns_r2}" veth_R2-B "${ns_b}" veth_B-R217931793+17941794+ if [ ${family} -eq 4 ]; then17951795+ ping=ping17961796+ dst1="${prefix4}.${b_r1}.1"17971797+ dst2="${prefix4}.${b_r2}.1"17981798+ gw="${prefix4}.${a_r1}.2"17991799+ else18001800+ ping=${ping6}18011801+ dst1="${prefix6}:${b_r1}::1"18021802+ dst2="${prefix6}:${b_r2}::1"18031803+ gw="${prefix6}:${a_r1}::2"18041804+ fi18051805+18061806+ # Set up initial MTU values18071807+ mtu "${ns_a}" veth_A-R1 200018081808+ mtu "${ns_r1}" veth_R1-A 200018091809+ mtu "${ns_r1}" veth_R1-B 140018101810+ mtu "${ns_b}" veth_B-R1 140018111811+18121812+ mtu "${ns_a}" veth_A-R2 200018131813+ mtu "${ns_r2}" veth_R2-A 200018141814+ mtu "${ns_r2}" veth_R2-B 150018151815+ mtu "${ns_b}" veth_B-R2 150018161816+18171817+ # Create route exceptions18181818+ run_cmd ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1800 ${dst1}18191819+ run_cmd ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1800 ${dst2}18201820+18211821+ # Check that exceptions have been created with the correct PMTU18221822+ pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst1})"18231823+ check_pmtu_value "1400" "${pmtu_1}" "exceeding MTU" || return 118241824+ pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})"18251825+ check_pmtu_value "1500" "${pmtu_2}" "exceeding MTU" || return 118261826+18271827+ # Replace the route from A to R118281828+ run_cmd ${ns_a} ip route change default via ${gw}18291829+18301830+ # Delete the device in A18311831+ run_cmd ${ns_a} ip link del "veth_A-R1"18321832+}18331833+18341834+test_pmtu_ipv4_route_change() {18351835+ test_pmtu_ipvX_route_change 418361836+}18371837+18381838+test_pmtu_ipv6_route_change() {18391839+ test_pmtu_ipvX_route_change 617931840}1794184117951842usage() {
···11+#!/bin/bash22+# SPDX-License-Identifier: GPL-2.033+44+# Kselftest framework requirement - SKIP code is 4.55+ksft_skip=466+77+# Conntrack needs to reassemble fragments in order to have complete88+# packets for rule matching. Reassembly can lead to packet loss.99+1010+# Consider the following setup:1111+# +--------+ +---------+ +--------+1212+# |Router A|-------|Wanrouter|-------|Router B|1313+# | |.IPIP..| |..IPIP.| |1414+# +--------+ +---------+ +--------+1515+# / mtu 1400 \1616+# / \1717+#+--------+ +--------+1818+#|Client A| |Client B|1919+#| | | |2020+#+--------+ +--------+2121+2222+# Router A and Router B use IPIP tunnel interfaces to tunnel traffic2323+# between Client A and Client B over WAN. Wanrouter has MTU 1400 set2424+# on its interfaces.2525+2626+rnd=$(mktemp -u XXXXXXXX)2727+rx=$(mktemp)2828+2929+r_a="ns-ra-$rnd"3030+r_b="ns-rb-$rnd"3131+r_w="ns-rw-$rnd"3232+c_a="ns-ca-$rnd"3333+c_b="ns-cb-$rnd"3434+3535+checktool (){3636+ if ! $1 > /dev/null 2>&1; then3737+ echo "SKIP: Could not $2"3838+ exit $ksft_skip3939+ fi4040+}4141+4242+checktool "iptables --version" "run test without iptables"4343+checktool "ip -Version" "run test without ip tool"4444+checktool "which nc" "run test without nc (netcat)"4545+checktool "ip netns add ${r_a}" "create net namespace"4646+4747+for n in ${r_b} ${r_w} ${c_a} ${c_b};do4848+ ip netns add ${n}4949+done5050+5151+cleanup() {5252+ for n in ${r_a} ${r_b} ${r_w} ${c_a} ${c_b};do5353+ ip netns del ${n}5454+ done5555+ rm -f ${rx}5656+}5757+5858+trap cleanup EXIT5959+6060+test_path() {6161+ msg="$1"6262+6363+ ip netns exec ${c_b} nc -n -w 3 -q 3 -u -l -p 5000 > ${rx} < /dev/null &6464+6565+ sleep 16666+ for i in 1 2 3; do6767+ head -c1400 /dev/zero | tr "\000" "a" | ip netns exec ${c_a} nc -n -w 1 -u 192.168.20.2 50006868+ done6969+7070+ wait7171+7272+ bytes=$(wc -c < ${rx})7373+7474+ if [ $bytes -eq 1400 ];then7575+ echo "OK: PMTU $msg connection tracking"7676+ else7777+ echo "FAIL: PMTU $msg connection tracking: got $bytes, expected 1400"7878+ exit 17979+ fi8080+}8181+8282+# Detailed setup for Router A8383+# ---------------------------8484+# Interfaces:8585+# eth0: 10.2.2.1/248686+# eth1: 192.168.10.1/248787+# ipip0: No IP address, local 10.2.2.1 remote 10.4.4.18888+# Routes:8989+# 192.168.20.0/24 dev ipip0 (192.168.20.0/24 is subnet of Client B)9090+# 10.4.4.1 via 10.2.2.254 (Router B via Wanrouter)9191+# No iptables rules at all.9292+9393+ip link add veth0 netns ${r_a} type veth peer name veth0 netns ${r_w}9494+ip link add veth1 netns ${r_a} type veth peer name veth0 netns ${c_a}9595+9696+l_addr="10.2.2.1"9797+r_addr="10.4.4.1"9898+ip netns exec ${r_a} ip link add ipip0 type ipip local ${l_addr} remote ${r_addr} mode ipip || exit $ksft_skip9999+100100+for dev in lo veth0 veth1 ipip0; do101101+ ip -net ${r_a} link set $dev up102102+done103103+104104+ip -net ${r_a} addr add 10.2.2.1/24 dev veth0105105+ip -net ${r_a} addr add 192.168.10.1/24 dev veth1106106+107107+ip -net ${r_a} route add 192.168.20.0/24 dev ipip0108108+ip -net ${r_a} route add 10.4.4.0/24 via 10.2.2.254109109+110110+ip netns exec ${r_a} sysctl -q net.ipv4.conf.all.forwarding=1 > /dev/null111111+112112+# Detailed setup for Router B113113+# ---------------------------114114+# Interfaces:115115+# eth0: 10.4.4.1/24116116+# eth1: 192.168.20.1/24117117+# ipip0: No IP address, local 10.4.4.1 remote 10.2.2.1118118+# Routes:119119+# 192.168.10.0/24 dev ipip0 (192.168.10.0/24 is subnet of Client A)120120+# 10.2.2.1 via 10.4.4.254 (Router A via Wanrouter)121121+# No iptables rules at all.122122+123123+ip link add veth0 netns ${r_b} type veth peer name veth1 netns ${r_w}124124+ip link add veth1 netns ${r_b} type veth peer name veth0 netns ${c_b}125125+126126+l_addr="10.4.4.1"127127+r_addr="10.2.2.1"128128+129129+ip netns exec ${r_b} ip link add ipip0 type ipip local ${l_addr} remote ${r_addr} mode ipip || exit $ksft_skip130130+131131+for dev in lo veth0 veth1 ipip0; do132132+ ip -net ${r_b} link set $dev up133133+done134134+135135+ip -net ${r_b} addr add 10.4.4.1/24 dev veth0136136+ip -net ${r_b} addr add 192.168.20.1/24 dev veth1137137+138138+ip -net ${r_b} route add 192.168.10.0/24 dev ipip0139139+ip -net ${r_b} route add 10.2.2.0/24 via 10.4.4.254140140+ip netns exec ${r_b} sysctl -q net.ipv4.conf.all.forwarding=1 > /dev/null141141+142142+# Client A143143+ip -net ${c_a} addr add 192.168.10.2/24 dev veth0144144+ip -net ${c_a} link set dev lo up145145+ip -net ${c_a} link set dev veth0 up146146+ip -net ${c_a} route add default via 192.168.10.1147147+148148+# Client A149149+ip -net ${c_b} addr add 192.168.20.2/24 dev veth0150150+ip -net ${c_b} link set dev veth0 up151151+ip -net ${c_b} link set dev lo up152152+ip -net ${c_b} route add default via 192.168.20.1153153+154154+# Wan155155+ip -net ${r_w} addr add 10.2.2.254/24 dev veth0156156+ip -net ${r_w} addr add 10.4.4.254/24 dev veth1157157+158158+ip -net ${r_w} link set dev lo up159159+ip -net ${r_w} link set dev veth0 up mtu 1400160160+ip -net ${r_w} link set dev veth1 up mtu 1400161161+162162+ip -net ${r_a} link set dev veth0 mtu 1400163163+ip -net ${r_b} link set dev veth0 mtu 1400164164+165165+ip netns exec ${r_w} sysctl -q net.ipv4.conf.all.forwarding=1 > /dev/null166166+167167+# Path MTU discovery168168+# ------------------169169+# Running tracepath from Client A to Client B shows PMTU discovery is working170170+# as expected:171171+#172172+# clienta:~# tracepath 192.168.20.2173173+# 1?: [LOCALHOST] pmtu 1500174174+# 1: 192.168.10.1 0.867ms175175+# 1: 192.168.10.1 0.302ms176176+# 2: 192.168.10.1 0.312ms pmtu 1480177177+# 2: no reply178178+# 3: 192.168.10.1 0.510ms pmtu 1380179179+# 3: 192.168.20.2 2.320ms reached180180+# Resume: pmtu 1380 hops 3 back 3181181+182182+# ip netns exec ${c_a} traceroute --mtu 192.168.20.2183183+184184+# Router A has learned PMTU (1400) to Router B from Wanrouter.185185+# Client A has learned PMTU (1400 - IPIP overhead = 1380) to Client B186186+# from Router A.187187+188188+#Send large UDP packet189189+#---------------------190190+#Now we send a 1400 bytes UDP packet from Client A to Client B:191191+192192+# clienta:~# head -c1400 /dev/zero | tr "\000" "a" | nc -u 192.168.20.2 5000193193+test_path "without"194194+195195+# The IPv4 stack on Client A already knows the PMTU to Client B, so the196196+# UDP packet is sent as two fragments (1380 + 20). Router A forwards the197197+# fragments between eth1 and ipip0. The fragments fit into the tunnel and198198+# reach their destination.199199+200200+#When sending the large UDP packet again, Router A now reassembles the201201+#fragments before routing the packet over ipip0. The resulting IPIP202202+#packet is too big (1400) for the tunnel PMTU (1380) to Router B, it is203203+#dropped on Router A before sending.204204+205205+ip netns exec ${r_a} iptables -A FORWARD -m conntrack --ctstate NEW206206+test_path "with"