Merge f976d964a6 ("Input: adp5589-keys - fix adp5589_gpio_get_value()") into android12-5.10-lts

Steps on the way to 5.10.227

Resolves merge conflicts in:
	fs/nfsd/nfs4xdr.c
	fs/nfsd/vfs.c

Change-Id: I8ed4156759977aa5c53d577990f4b72e61530ebf
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2024-11-14 11:34:30 +00:00
commit 509ddbb2b8
33 changed files with 217 additions and 114 deletions

View File

@ -217,10 +217,10 @@ linux_gateway_entry:
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
ldil L%sys_call_table, %r1 ldil L%sys_call_table, %r1
or,= %r2,%r2,%r2 or,ev %r2,%r2,%r2
addil L%(sys_call_table64-sys_call_table), %r1 ldil L%sys_call_table64, %r1
ldo R%sys_call_table(%r1), %r19 ldo R%sys_call_table(%r1), %r19
or,= %r2,%r2,%r2 or,ev %r2,%r2,%r2
ldo R%sys_call_table64(%r1), %r19 ldo R%sys_call_table64(%r1), %r19
#else #else
load32 sys_call_table, %r19 load32 sys_call_table, %r19
@ -355,10 +355,10 @@ tracesys_next:
extrd,u %r19,63,1,%r2 /* W hidden in bottom bit */ extrd,u %r19,63,1,%r2 /* W hidden in bottom bit */
ldil L%sys_call_table, %r1 ldil L%sys_call_table, %r1
or,= %r2,%r2,%r2 or,ev %r2,%r2,%r2
addil L%(sys_call_table64-sys_call_table), %r1 ldil L%sys_call_table64, %r1
ldo R%sys_call_table(%r1), %r19 ldo R%sys_call_table(%r1), %r19
or,= %r2,%r2,%r2 or,ev %r2,%r2,%r2
ldo R%sys_call_table64(%r1), %r19 ldo R%sys_call_table64(%r1), %r19
#else #else
load32 sys_call_table, %r19 load32 sys_call_table, %r19
@ -931,6 +931,8 @@ ENTRY(sys_call_table)
END(sys_call_table) END(sys_call_table)
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
#undef __SYSCALL_WITH_COMPAT
#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native)
.align 8 .align 8
ENTRY(sys_call_table64) ENTRY(sys_call_table64)
#include <asm/syscall_table_64.h> /* 64-bit native syscalls */ #include <asm/syscall_table_64.h> /* 64-bit native syscalls */

View File

@ -193,6 +193,11 @@ config GENERIC_HWEIGHT
config FIX_EARLYCON_MEM config FIX_EARLYCON_MEM
def_bool MMU def_bool MMU
config ILLEGAL_POINTER_VALUE
hex
default 0 if 32BIT
default 0xdead000000000000 if 64BIT
config PGTABLE_LEVELS config PGTABLE_LEVELS
int int
default 3 if 64BIT default 3 if 64BIT

View File

@ -362,6 +362,7 @@ ata_rw_frameinit(struct frame *f)
} }
ah->cmdstat = ATA_CMD_PIO_READ | writebit | extbit; ah->cmdstat = ATA_CMD_PIO_READ | writebit | extbit;
dev_hold(t->ifp->nd);
skb->dev = t->ifp->nd; skb->dev = t->ifp->nd;
} }
@ -402,6 +403,8 @@ aoecmd_ata_rw(struct aoedev *d)
__skb_queue_head_init(&queue); __skb_queue_head_init(&queue);
__skb_queue_tail(&queue, skb); __skb_queue_tail(&queue, skb);
aoenet_xmit(&queue); aoenet_xmit(&queue);
} else {
dev_put(f->t->ifp->nd);
} }
return 1; return 1;
} }
@ -484,10 +487,13 @@ resend(struct aoedev *d, struct frame *f)
memcpy(h->dst, t->addr, sizeof h->dst); memcpy(h->dst, t->addr, sizeof h->dst);
memcpy(h->src, t->ifp->nd->dev_addr, sizeof h->src); memcpy(h->src, t->ifp->nd->dev_addr, sizeof h->src);
dev_hold(t->ifp->nd);
skb->dev = t->ifp->nd; skb->dev = t->ifp->nd;
skb = skb_clone(skb, GFP_ATOMIC); skb = skb_clone(skb, GFP_ATOMIC);
if (skb == NULL) if (skb == NULL) {
dev_put(t->ifp->nd);
return; return;
}
f->sent = ktime_get(); f->sent = ktime_get();
__skb_queue_head_init(&queue); __skb_queue_head_init(&queue);
__skb_queue_tail(&queue, skb); __skb_queue_tail(&queue, skb);
@ -618,6 +624,8 @@ probe(struct aoetgt *t)
__skb_queue_head_init(&queue); __skb_queue_head_init(&queue);
__skb_queue_tail(&queue, skb); __skb_queue_tail(&queue, skb);
aoenet_xmit(&queue); aoenet_xmit(&queue);
} else {
dev_put(f->t->ifp->nd);
} }
} }
@ -1403,6 +1411,7 @@ aoecmd_ata_id(struct aoedev *d)
ah->cmdstat = ATA_CMD_ID_ATA; ah->cmdstat = ATA_CMD_ID_ATA;
ah->lba3 = 0xa0; ah->lba3 = 0xa0;
dev_hold(t->ifp->nd);
skb->dev = t->ifp->nd; skb->dev = t->ifp->nd;
d->rttavg = RTTAVG_INIT; d->rttavg = RTTAVG_INIT;
@ -1412,6 +1421,8 @@ aoecmd_ata_id(struct aoedev *d)
skb = skb_clone(skb, GFP_ATOMIC); skb = skb_clone(skb, GFP_ATOMIC);
if (skb) if (skb)
f->sent = ktime_get(); f->sent = ktime_get();
else
dev_put(t->ifp->nd);
return skb; return skb;
} }

View File

@ -270,6 +270,8 @@ static int clk_rpmh_bcm_send_cmd(struct clk_rpmh *c, bool enable)
cmd_state = 0; cmd_state = 0;
} }
cmd_state = min(cmd_state, BCM_TCS_CMD_VOTE_MASK);
if (c->last_sent_aggr_state != cmd_state) { if (c->last_sent_aggr_state != cmd_state) {
cmd.addr = c->res_addr; cmd.addr = c->res_addr;
cmd.data = BCM_TCS_CMD(1, enable, 0, cmd_state); cmd.data = BCM_TCS_CMD(1, enable, 0, cmd_state);

View File

@ -3229,7 +3229,7 @@ static struct gdsc pcie_0_gdsc = {
.pd = { .pd = {
.name = "pcie_0_gdsc", .name = "pcie_0_gdsc",
}, },
.pwrsts = PWRSTS_OFF_ON, .pwrsts = PWRSTS_RET_ON,
}; };
static struct gdsc pcie_1_gdsc = { static struct gdsc pcie_1_gdsc = {
@ -3237,7 +3237,7 @@ static struct gdsc pcie_1_gdsc = {
.pd = { .pd = {
.name = "pcie_1_gdsc", .name = "pcie_1_gdsc",
}, },
.pwrsts = PWRSTS_OFF_ON, .pwrsts = PWRSTS_RET_ON,
}; };
static struct gdsc pcie_2_gdsc = { static struct gdsc pcie_2_gdsc = {
@ -3245,7 +3245,7 @@ static struct gdsc pcie_2_gdsc = {
.pd = { .pd = {
.name = "pcie_2_gdsc", .name = "pcie_2_gdsc",
}, },
.pwrsts = PWRSTS_OFF_ON, .pwrsts = PWRSTS_RET_ON,
}; };
static struct gdsc ufs_card_gdsc = { static struct gdsc ufs_card_gdsc = {

View File

@ -442,12 +442,13 @@ void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
struct rockchip_clk_branch *list, struct rockchip_clk_branch *list,
unsigned int nr_clk) unsigned int nr_clk)
{ {
struct clk *clk = NULL; struct clk *clk;
unsigned int idx; unsigned int idx;
unsigned long flags; unsigned long flags;
for (idx = 0; idx < nr_clk; idx++, list++) { for (idx = 0; idx < nr_clk; idx++, list++) {
flags = list->flags; flags = list->flags;
clk = NULL;
/* catch simple muxes */ /* catch simple muxes */
switch (list->branch_type) { switch (list->branch_type) {

View File

@ -600,6 +600,10 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
soc = soc_device_match(omapdrm_soc_devices); soc = soc_device_match(omapdrm_soc_devices);
priv->omaprev = soc ? (unsigned int)soc->data : 0; priv->omaprev = soc ? (unsigned int)soc->data : 0;
priv->wq = alloc_ordered_workqueue("omapdrm", 0); priv->wq = alloc_ordered_workqueue("omapdrm", 0);
if (!priv->wq) {
ret = -ENOMEM;
goto err_alloc_workqueue;
}
mutex_init(&priv->list_lock); mutex_init(&priv->list_lock);
INIT_LIST_HEAD(&priv->obj_list); INIT_LIST_HEAD(&priv->obj_list);
@ -649,6 +653,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
err_gem_deinit: err_gem_deinit:
omap_gem_deinit(ddev); omap_gem_deinit(ddev);
destroy_workqueue(priv->wq); destroy_workqueue(priv->wq);
err_alloc_workqueue:
omap_disconnect_pipelines(ddev); omap_disconnect_pipelines(ddev);
omap_crtc_pre_uninit(priv); omap_crtc_pre_uninit(priv);
drm_dev_put(ddev); drm_dev_put(ddev);

View File

@ -661,22 +661,8 @@ static int ak8975_start_read_axis(struct ak8975_data *data,
if (ret < 0) if (ret < 0)
return ret; return ret;
/* This will be executed only for non-interrupt based waiting case */ /* Return with zero if the data is ready. */
if (ret & data->def->ctrl_masks[ST1_DRDY]) { return !data->def->ctrl_regs[ST1_DRDY];
ret = i2c_smbus_read_byte_data(client,
data->def->ctrl_regs[ST2]);
if (ret < 0) {
dev_err(&client->dev, "Error in reading ST2\n");
return ret;
}
if (ret & (data->def->ctrl_masks[ST2_DERR] |
data->def->ctrl_masks[ST2_HOFL])) {
dev_err(&client->dev, "ST2 status error 0x%x\n", ret);
return -EINVAL;
}
}
return 0;
} }
/* Retrieve raw flux value for one of the x, y, or z axis. */ /* Retrieve raw flux value for one of the x, y, or z axis. */
@ -703,6 +689,20 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val)
if (ret < 0) if (ret < 0)
goto exit; goto exit;
/* Read out ST2 for release lock on measurment data. */
ret = i2c_smbus_read_byte_data(client, data->def->ctrl_regs[ST2]);
if (ret < 0) {
dev_err(&client->dev, "Error in reading ST2\n");
goto exit;
}
if (ret & (data->def->ctrl_masks[ST2_DERR] |
data->def->ctrl_masks[ST2_HOFL])) {
dev_err(&client->dev, "ST2 status error 0x%x\n", ret);
ret = -EINVAL;
goto exit;
}
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
pm_runtime_mark_last_busy(&data->client->dev); pm_runtime_mark_last_busy(&data->client->dev);

View File

@ -390,10 +390,17 @@ static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
struct adp5589_kpad *kpad = gpiochip_get_data(chip); struct adp5589_kpad *kpad = gpiochip_get_data(chip);
unsigned int bank = kpad->var->bank(kpad->gpiomap[off]); unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
unsigned int bit = kpad->var->bit(kpad->gpiomap[off]); unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
int val;
return !!(adp5589_read(kpad->client, mutex_lock(&kpad->gpio_lock);
kpad->var->reg(ADP5589_GPI_STATUS_A) + bank) & if (kpad->dir[bank] & bit)
bit); val = kpad->dat_out[bank];
else
val = adp5589_read(kpad->client,
kpad->var->reg(ADP5589_GPI_STATUS_A) + bank);
mutex_unlock(&kpad->gpio_lock);
return !!(val & bit);
} }
static void adp5589_gpio_set_value(struct gpio_chip *chip, static void adp5589_gpio_set_value(struct gpio_chip *chip,

View File

@ -366,6 +366,7 @@ static int venus_remove(struct platform_device *pdev)
struct device *dev = core->dev; struct device *dev = core->dev;
int ret; int ret;
cancel_delayed_work_sync(&core->work);
ret = pm_runtime_get_sync(dev); ret = pm_runtime_get_sync(dev);
WARN_ON(ret < 0); WARN_ON(ret < 0);

View File

@ -40,6 +40,10 @@ static const struct media_entity_operations sun4i_csi_video_entity_ops = {
.link_validate = v4l2_subdev_link_validate, .link_validate = v4l2_subdev_link_validate,
}; };
static const struct media_entity_operations sun4i_csi_subdev_entity_ops = {
.link_validate = v4l2_subdev_link_validate,
};
static int sun4i_csi_notify_bound(struct v4l2_async_notifier *notifier, static int sun4i_csi_notify_bound(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev, struct v4l2_subdev *subdev,
struct v4l2_async_subdev *asd) struct v4l2_async_subdev *asd)
@ -245,6 +249,7 @@ static int sun4i_csi_probe(struct platform_device *pdev)
v4l2_subdev_init(subdev, &sun4i_csi_subdev_ops); v4l2_subdev_init(subdev, &sun4i_csi_subdev_ops);
subdev->flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; subdev->flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
subdev->entity.ops = &sun4i_csi_subdev_entity_ops;
subdev->owner = THIS_MODULE; subdev->owner = THIS_MODULE;
snprintf(subdev->name, sizeof(subdev->name), "sun4i-csi-0"); snprintf(subdev->name, sizeof(subdev->name), "sun4i-csi-0");
v4l2_set_subdevdata(subdev, csi); v4l2_set_subdevdata(subdev, csi);

View File

@ -363,6 +363,7 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
return ret; return ret;
priv->plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB; priv->plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB;
return 0;
} }
/* Final adjustments for HW */ /* Final adjustments for HW */

View File

@ -642,8 +642,7 @@ struct irq_domain *of_msi_map_get_device_domain(struct device *dev, u32 id,
* @np: device node for @dev * @np: device node for @dev
* @token: bus type for this domain * @token: bus type for this domain
* *
* Parse the msi-parent property (both the simple and the complex * Parse the msi-parent property and returns the corresponding MSI domain.
* versions), and returns the corresponding MSI domain.
* *
* Returns: the MSI domain for this device (or NULL on failure). * Returns: the MSI domain for this device (or NULL on failure).
*/ */
@ -651,33 +650,14 @@ struct irq_domain *of_msi_get_domain(struct device *dev,
struct device_node *np, struct device_node *np,
enum irq_domain_bus_token token) enum irq_domain_bus_token token)
{ {
struct device_node *msi_np; struct of_phandle_iterator it;
struct irq_domain *d; struct irq_domain *d;
int err;
/* Check for a single msi-parent property */ of_for_each_phandle(&it, err, np, "msi-parent", "#msi-cells", 0) {
msi_np = of_parse_phandle(np, "msi-parent", 0); d = irq_find_matching_host(it.node, token);
if (msi_np && !of_property_read_bool(msi_np, "#msi-cells")) {
d = irq_find_matching_host(msi_np, token);
if (!d)
of_node_put(msi_np);
return d;
}
if (token == DOMAIN_BUS_PLATFORM_MSI) {
/* Check for the complex msi-parent version */
struct of_phandle_args args;
int index = 0;
while (!of_parse_phandle_with_args(np, "msi-parent",
"#msi-cells",
index, &args)) {
d = irq_find_matching_host(args.np, token);
if (d) if (d)
return d; return d;
of_node_put(args.np);
index++;
}
} }
return NULL; return NULL;

View File

@ -368,6 +368,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
return ret; return ret;
rtc->gpbr = syscon_node_to_regmap(args.np); rtc->gpbr = syscon_node_to_regmap(args.np);
of_node_put(args.np);
rtc->gpbr_offset = args.args[0]; rtc->gpbr_offset = args.args[0];
if (IS_ERR(rtc->gpbr)) { if (IS_ERR(rtc->gpbr)) {
dev_err(&pdev->dev, "failed to retrieve gpbr regmap, aborting.\n"); dev_err(&pdev->dev, "failed to retrieve gpbr regmap, aborting.\n");

View File

@ -768,6 +768,7 @@ int setup_arg_pages(struct linux_binprm *bprm,
stack_base = STACK_SIZE_MAX; stack_base = STACK_SIZE_MAX;
/* Add space for stack randomization. */ /* Add space for stack randomization. */
if (current->flags & PF_RANDOMIZE)
stack_base += (STACK_RND_MASK << PAGE_SHIFT); stack_base += (STACK_RND_MASK << PAGE_SHIFT);
/* Make sure we didn't let the argument array grow too large. */ /* Make sure we didn't let the argument array grow too large. */

View File

@ -110,11 +110,8 @@ int exfat_load_bitmap(struct super_block *sb)
return -EIO; return -EIO;
type = exfat_get_entry_type(ep); type = exfat_get_entry_type(ep);
if (type == TYPE_UNUSED) if (type == TYPE_BITMAP &&
break; ep->dentry.bitmap.flags == 0x0) {
if (type != TYPE_BITMAP)
continue;
if (ep->dentry.bitmap.flags == 0x0) {
int err; int err;
err = exfat_allocate_bitmap(sb, ep); err = exfat_allocate_bitmap(sb, ep);
@ -122,6 +119,9 @@ int exfat_load_bitmap(struct super_block *sb)
return err; return err;
} }
brelse(bh); brelse(bh);
if (type == TYPE_UNUSED)
return -EINVAL;
} }
if (exfat_get_next_cluster(sb, &clu.dir)) if (exfat_get_next_cluster(sb, &clu.dir))

View File

@ -949,6 +949,8 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block,
ext4_ext_show_path(inode, path); ext4_ext_show_path(inode, path);
if (orig_path)
*orig_path = path;
return path; return path;
err: err:
@ -1867,6 +1869,7 @@ static void ext4_ext_try_to_merge_up(handle_t *handle,
path[0].p_hdr->eh_max = cpu_to_le16(max_root); path[0].p_hdr->eh_max = cpu_to_le16(max_root);
brelse(path[1].p_bh); brelse(path[1].p_bh);
path[1].p_bh = NULL;
ext4_free_blocks(handle, inode, NULL, blk, 1, ext4_free_blocks(handle, inode, NULL, blk, 1,
EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET);
} }
@ -2095,6 +2098,7 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
ppath, newext); ppath, newext);
if (err) if (err)
goto cleanup; goto cleanup;
path = *ppath;
depth = ext_depth(inode); depth = ext_depth(inode);
eh = path[depth].p_hdr; eh = path[depth].p_hdr;
@ -3226,6 +3230,24 @@ static int ext4_split_extent_at(handle_t *handle,
if (err != -ENOSPC && err != -EDQUOT) if (err != -ENOSPC && err != -EDQUOT)
goto out; goto out;
/*
* Update path is required because previous ext4_ext_insert_extent()
* may have freed or reallocated the path. Using EXT4_EX_NOFAIL
* guarantees that ext4_find_extent() will not return -ENOMEM,
* otherwise -ENOMEM will cause a retry in do_writepages(), and a
* WARN_ON may be triggered in ext4_da_update_reserve_space() due to
* an incorrect ee_len causing the i_reserved_data_blocks exception.
*/
path = ext4_find_extent(inode, ee_block, ppath,
flags | EXT4_EX_NOFAIL);
if (IS_ERR(path)) {
EXT4_ERROR_INODE(inode, "Failed split extent on %u, err %ld",
split, PTR_ERR(path));
return PTR_ERR(path);
}
depth = ext_depth(inode);
ex = path[depth].p_ext;
if (EXT4_EXT_MAY_ZEROOUT & split_flag) { if (EXT4_EXT_MAY_ZEROOUT & split_flag) {
if (split_flag & (EXT4_EXT_DATA_VALID1|EXT4_EXT_DATA_VALID2)) { if (split_flag & (EXT4_EXT_DATA_VALID1|EXT4_EXT_DATA_VALID2)) {
if (split_flag & EXT4_EXT_DATA_VALID1) { if (split_flag & EXT4_EXT_DATA_VALID1) {
@ -3278,7 +3300,7 @@ static int ext4_split_extent_at(handle_t *handle,
ext4_ext_dirty(handle, inode, path + path->p_depth); ext4_ext_dirty(handle, inode, path + path->p_depth);
return err; return err;
out: out:
ext4_ext_show_leaf(inode, path); ext4_ext_show_leaf(inode, *ppath);
return err; return err;
} }
@ -5547,6 +5569,7 @@ static int ext4_insert_range(struct file *file, loff_t offset, loff_t len)
path = ext4_find_extent(inode, offset_lblk, NULL, 0); path = ext4_find_extent(inode, offset_lblk, NULL, 0);
if (IS_ERR(path)) { if (IS_ERR(path)) {
up_write(&EXT4_I(inode)->i_data_sem); up_write(&EXT4_I(inode)->i_data_sem);
ret = PTR_ERR(path);
goto out_stop; goto out_stop;
} }
@ -5908,7 +5931,7 @@ int ext4_clu_mapped(struct inode *inode, ext4_lblk_t lclu)
int ext4_ext_replay_update_ex(struct inode *inode, ext4_lblk_t start, int ext4_ext_replay_update_ex(struct inode *inode, ext4_lblk_t start,
int len, int unwritten, ext4_fsblk_t pblk) int len, int unwritten, ext4_fsblk_t pblk)
{ {
struct ext4_ext_path *path = NULL, *ppath; struct ext4_ext_path *path;
struct ext4_extent *ex; struct ext4_extent *ex;
int ret; int ret;
@ -5924,30 +5947,29 @@ int ext4_ext_replay_update_ex(struct inode *inode, ext4_lblk_t start,
if (le32_to_cpu(ex->ee_block) != start || if (le32_to_cpu(ex->ee_block) != start ||
ext4_ext_get_actual_len(ex) != len) { ext4_ext_get_actual_len(ex) != len) {
/* We need to split this extent to match our extent first */ /* We need to split this extent to match our extent first */
ppath = path;
down_write(&EXT4_I(inode)->i_data_sem); down_write(&EXT4_I(inode)->i_data_sem);
ret = ext4_force_split_extent_at(NULL, inode, &ppath, start, 1); ret = ext4_force_split_extent_at(NULL, inode, &path, start, 1);
up_write(&EXT4_I(inode)->i_data_sem); up_write(&EXT4_I(inode)->i_data_sem);
if (ret) if (ret)
goto out; goto out;
kfree(path);
path = ext4_find_extent(inode, start, NULL, 0); path = ext4_find_extent(inode, start, &path, 0);
if (IS_ERR(path)) if (IS_ERR(path))
return -1; return PTR_ERR(path);
ppath = path;
ex = path[path->p_depth].p_ext; ex = path[path->p_depth].p_ext;
WARN_ON(le32_to_cpu(ex->ee_block) != start); WARN_ON(le32_to_cpu(ex->ee_block) != start);
if (ext4_ext_get_actual_len(ex) != len) { if (ext4_ext_get_actual_len(ex) != len) {
down_write(&EXT4_I(inode)->i_data_sem); down_write(&EXT4_I(inode)->i_data_sem);
ret = ext4_force_split_extent_at(NULL, inode, &ppath, ret = ext4_force_split_extent_at(NULL, inode, &path,
start + len, 1); start + len, 1);
up_write(&EXT4_I(inode)->i_data_sem); up_write(&EXT4_I(inode)->i_data_sem);
if (ret) if (ret)
goto out; goto out;
kfree(path);
path = ext4_find_extent(inode, start, NULL, 0); path = ext4_find_extent(inode, start, &path, 0);
if (IS_ERR(path)) if (IS_ERR(path))
return -EINVAL; return PTR_ERR(path);
ex = path[path->p_depth].p_ext; ex = path[path->p_depth].p_ext;
} }
} }

View File

@ -5399,8 +5399,9 @@ static void ext4_wait_for_tail_page_commit(struct inode *inode)
struct page *page; struct page *page;
unsigned offset; unsigned offset;
journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
tid_t commit_tid = 0; tid_t commit_tid;
int ret; int ret;
bool has_transaction;
offset = inode->i_size & (PAGE_SIZE - 1); offset = inode->i_size & (PAGE_SIZE - 1);
/* /*
@ -5425,12 +5426,14 @@ static void ext4_wait_for_tail_page_commit(struct inode *inode)
put_page(page); put_page(page);
if (ret != -EBUSY) if (ret != -EBUSY)
return; return;
commit_tid = 0; has_transaction = false;
read_lock(&journal->j_state_lock); read_lock(&journal->j_state_lock);
if (journal->j_committing_transaction) if (journal->j_committing_transaction) {
commit_tid = journal->j_committing_transaction->t_tid; commit_tid = journal->j_committing_transaction->t_tid;
has_transaction = true;
}
read_unlock(&journal->j_state_lock); read_unlock(&journal->j_state_lock);
if (commit_tid) if (has_transaction)
jbd2_log_wait_commit(journal, commit_tid); jbd2_log_wait_commit(journal, commit_tid);
} }
} }

View File

@ -36,7 +36,6 @@ get_ext_path(struct inode *inode, ext4_lblk_t lblock,
*ppath = NULL; *ppath = NULL;
return -ENODATA; return -ENODATA;
} }
*ppath = path;
return 0; return 0;
} }

View File

@ -2006,7 +2006,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
split = count/2; split = count/2;
hash2 = map[split].hash; hash2 = map[split].hash;
continued = hash2 == map[split - 1].hash; continued = split > 0 ? hash2 == map[split - 1].hash : 0;
dxtrace(printk(KERN_INFO "Split block %lu at %x, %i/%i\n", dxtrace(printk(KERN_INFO "Split block %lu at %x, %i/%i\n",
(unsigned long)dx_get_block(frame->at), (unsigned long)dx_get_block(frame->at),
hash2, split, count-split)); hash2, split, count-split));

View File

@ -115,17 +115,23 @@ __releases(&journal->j_state_lock)
if (space_left < nblocks) { if (space_left < nblocks) {
int chkpt = journal->j_checkpoint_transactions != NULL; int chkpt = journal->j_checkpoint_transactions != NULL;
tid_t tid = 0; tid_t tid = 0;
bool has_transaction = false;
if (journal->j_committing_transaction) if (journal->j_committing_transaction) {
tid = journal->j_committing_transaction->t_tid; tid = journal->j_committing_transaction->t_tid;
has_transaction = true;
}
spin_unlock(&journal->j_list_lock); spin_unlock(&journal->j_list_lock);
write_unlock(&journal->j_state_lock); write_unlock(&journal->j_state_lock);
if (chkpt) { if (chkpt) {
jbd2_log_do_checkpoint(journal); jbd2_log_do_checkpoint(journal);
} else if (jbd2_cleanup_journal_tail(journal) == 0) { } else if (jbd2_cleanup_journal_tail(journal) <= 0) {
/* We were able to recover space; yay! */ /*
* We were able to recover space or the
* journal was aborted due to an error.
*/
; ;
} else if (tid) { } else if (has_transaction) {
/* /*
* jbd2_journal_commit_transaction() may want * jbd2_journal_commit_transaction() may want
* to take the checkpoint_mutex if JBD2_FLUSHED * to take the checkpoint_mutex if JBD2_FLUSHED

View File

@ -740,7 +740,7 @@ int jbd2_fc_begin_commit(journal_t *journal, tid_t tid)
return -EINVAL; return -EINVAL;
write_lock(&journal->j_state_lock); write_lock(&journal->j_state_lock);
if (tid <= journal->j_commit_sequence) { if (tid_geq(journal->j_commit_sequence, tid)) {
write_unlock(&journal->j_state_lock); write_unlock(&journal->j_state_lock);
return -EALREADY; return -EALREADY;
} }

View File

@ -868,7 +868,8 @@ static void nfs4_free_deleg(struct nfs4_stid *stid)
* When a delegation is recalled, the filehandle is stored in the "new" * When a delegation is recalled, the filehandle is stored in the "new"
* filter. * filter.
* Every 30 seconds we swap the filters and clear the "new" one, * Every 30 seconds we swap the filters and clear the "new" one,
* unless both are empty of course. * unless both are empty of course. This results in delegations for a
* given filehandle being blocked for between 30 and 60 seconds.
* *
* Each filter is 256 bits. We hash the filehandle to 32bit and use the * Each filter is 256 bits. We hash the filehandle to 32bit and use the
* low 3 bytes as hash-table indices. * low 3 bytes as hash-table indices.
@ -897,9 +898,9 @@ static int delegation_blocked(struct knfsd_fh *fh)
if (ktime_get_seconds() - bd->swap_time > 30) { if (ktime_get_seconds() - bd->swap_time > 30) {
bd->entries -= bd->old_entries; bd->entries -= bd->old_entries;
bd->old_entries = bd->entries; bd->old_entries = bd->entries;
bd->new = 1-bd->new;
memset(bd->set[bd->new], 0, memset(bd->set[bd->new], 0,
sizeof(bd->set[0])); sizeof(bd->set[0]));
bd->new = 1-bd->new;
bd->swap_time = ktime_get_seconds(); bd->swap_time = ktime_get_seconds();
} }
spin_unlock(&blocked_delegations_lock); spin_unlock(&blocked_delegations_lock);

View File

@ -158,9 +158,8 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock,
err = ocfs2_extent_map_get_blocks(inode, iblock, &p_blkno, &count, err = ocfs2_extent_map_get_blocks(inode, iblock, &p_blkno, &count,
&ext_flags); &ext_flags);
if (err) { if (err) {
mlog(ML_ERROR, "Error %d from get_blocks(0x%p, %llu, 1, " mlog(ML_ERROR, "get_blocks() failed, inode: 0x%p, "
"%llu, NULL)\n", err, inode, (unsigned long long)iblock, "block: %llu\n", inode, (unsigned long long)iblock);
(unsigned long long)p_blkno);
goto bail; goto bail;
} }

View File

@ -237,7 +237,6 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
if (bhs[i] == NULL) { if (bhs[i] == NULL) {
bhs[i] = sb_getblk(sb, block++); bhs[i] = sb_getblk(sb, block++);
if (bhs[i] == NULL) { if (bhs[i] == NULL) {
ocfs2_metadata_cache_io_unlock(ci);
status = -ENOMEM; status = -ENOMEM;
mlog_errno(status); mlog_errno(status);
/* Don't forget to put previous bh! */ /* Don't forget to put previous bh! */
@ -391,6 +390,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
/* Always set the buffer in the cache, even if it was /* Always set the buffer in the cache, even if it was
* a forced read, or read-ahead which hasn't yet * a forced read, or read-ahead which hasn't yet
* completed. */ * completed. */
if (bh)
ocfs2_set_buffer_uptodate(ci, bh); ocfs2_set_buffer_uptodate(ci, bh);
} }
ocfs2_metadata_cache_io_unlock(ci); ocfs2_metadata_cache_io_unlock(ci);

View File

@ -996,7 +996,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
if (!igrab(inode)) if (!igrab(inode))
BUG(); BUG();
num_running_trans = atomic_read(&(osb->journal->j_num_trans)); num_running_trans = atomic_read(&(journal->j_num_trans));
trace_ocfs2_journal_shutdown(num_running_trans); trace_ocfs2_journal_shutdown(num_running_trans);
/* Do a commit_cache here. It will flush our journal, *and* /* Do a commit_cache here. It will flush our journal, *and*
@ -1015,9 +1015,10 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
osb->commit_task = NULL; osb->commit_task = NULL;
} }
BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0); BUG_ON(atomic_read(&(journal->j_num_trans)) != 0);
if (ocfs2_mount_local(osb)) { if (ocfs2_mount_local(osb) &&
(journal->j_journal->j_flags & JBD2_LOADED)) {
jbd2_journal_lock_updates(journal->j_journal); jbd2_journal_lock_updates(journal->j_journal);
status = jbd2_journal_flush(journal->j_journal); status = jbd2_journal_flush(journal->j_journal);
jbd2_journal_unlock_updates(journal->j_journal); jbd2_journal_unlock_updates(journal->j_journal);

View File

@ -1010,6 +1010,25 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
start = bit_off + 1; start = bit_off + 1;
} }
/* clear the contiguous bits until the end boundary */
if (count) {
blkno = la_start_blk +
ocfs2_clusters_to_blocks(osb->sb,
start - count);
trace_ocfs2_sync_local_to_main_free(
count, start - count,
(unsigned long long)la_start_blk,
(unsigned long long)blkno);
status = ocfs2_release_clusters(handle,
main_bm_inode,
main_bm_bh, blkno,
count);
if (status < 0)
mlog_errno(status);
}
bail: bail:
if (status) if (status)
mlog_errno(status); mlog_errno(status);

View File

@ -689,7 +689,7 @@ static int ocfs2_local_read_info(struct super_block *sb, int type)
int status; int status;
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
struct ocfs2_quota_recovery *rec; struct ocfs2_quota_recovery *rec;
int locked = 0; int locked = 0, global_read = 0;
info->dqi_max_spc_limit = 0x7fffffffffffffffLL; info->dqi_max_spc_limit = 0x7fffffffffffffffLL;
info->dqi_max_ino_limit = 0x7fffffffffffffffLL; info->dqi_max_ino_limit = 0x7fffffffffffffffLL;
@ -697,6 +697,7 @@ static int ocfs2_local_read_info(struct super_block *sb, int type)
if (!oinfo) { if (!oinfo) {
mlog(ML_ERROR, "failed to allocate memory for ocfs2 quota" mlog(ML_ERROR, "failed to allocate memory for ocfs2 quota"
" info."); " info.");
status = -ENOMEM;
goto out_err; goto out_err;
} }
info->dqi_priv = oinfo; info->dqi_priv = oinfo;
@ -709,6 +710,7 @@ static int ocfs2_local_read_info(struct super_block *sb, int type)
status = ocfs2_global_read_info(sb, type); status = ocfs2_global_read_info(sb, type);
if (status < 0) if (status < 0)
goto out_err; goto out_err;
global_read = 1;
status = ocfs2_inode_lock(lqinode, &oinfo->dqi_lqi_bh, 1); status = ocfs2_inode_lock(lqinode, &oinfo->dqi_lqi_bh, 1);
if (status < 0) { if (status < 0) {
@ -779,10 +781,12 @@ static int ocfs2_local_read_info(struct super_block *sb, int type)
if (locked) if (locked)
ocfs2_inode_unlock(lqinode, 1); ocfs2_inode_unlock(lqinode, 1);
ocfs2_release_local_quota_bitmaps(&oinfo->dqi_chunk); ocfs2_release_local_quota_bitmaps(&oinfo->dqi_chunk);
if (global_read)
cancel_delayed_work_sync(&oinfo->dqi_sync_work);
kfree(oinfo); kfree(oinfo);
} }
brelse(bh); brelse(bh);
return -1; return status;
} }
/* Write local info to quota file */ /* Write local info to quota file */

View File

@ -27,6 +27,7 @@
#include "namei.h" #include "namei.h"
#include "ocfs2_trace.h" #include "ocfs2_trace.h"
#include "file.h" #include "file.h"
#include "symlink.h"
#include <linux/bio.h> #include <linux/bio.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
@ -4184,8 +4185,9 @@ static int __ocfs2_reflink(struct dentry *old_dentry,
int ret; int ret;
struct inode *inode = d_inode(old_dentry); struct inode *inode = d_inode(old_dentry);
struct buffer_head *new_bh = NULL; struct buffer_head *new_bh = NULL;
struct ocfs2_inode_info *oi = OCFS2_I(inode);
if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) { if (oi->ip_flags & OCFS2_INODE_SYSTEM_FILE) {
ret = -EINVAL; ret = -EINVAL;
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -4211,6 +4213,26 @@ static int __ocfs2_reflink(struct dentry *old_dentry,
goto out_unlock; goto out_unlock;
} }
if ((oi->ip_dyn_features & OCFS2_HAS_XATTR_FL) &&
(oi->ip_dyn_features & OCFS2_INLINE_XATTR_FL)) {
/*
* Adjust extent record count to reserve space for extended attribute.
* Inline data count had been adjusted in ocfs2_duplicate_inline_data().
*/
struct ocfs2_inode_info *new_oi = OCFS2_I(new_inode);
if (!(new_oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) &&
!(ocfs2_inode_is_fast_symlink(new_inode))) {
struct ocfs2_dinode *new_di = (struct ocfs2_dinode *)new_bh->b_data;
struct ocfs2_dinode *old_di = (struct ocfs2_dinode *)old_bh->b_data;
struct ocfs2_extent_list *el = &new_di->id2.i_list;
int inline_size = le16_to_cpu(old_di->i_xattr_inline_size);
le16_add_cpu(&el->l_count, -(inline_size /
sizeof(struct ocfs2_extent_rec)));
}
}
ret = ocfs2_create_reflink_node(inode, old_bh, ret = ocfs2_create_reflink_node(inode, old_bh,
new_inode, new_bh, preserve); new_inode, new_bh, preserve);
if (ret) { if (ret) {
@ -4218,7 +4240,7 @@ static int __ocfs2_reflink(struct dentry *old_dentry,
goto inode_unlock; goto inode_unlock;
} }
if (OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_XATTR_FL) { if (oi->ip_dyn_features & OCFS2_HAS_XATTR_FL) {
ret = ocfs2_reflink_xattrs(inode, old_bh, ret = ocfs2_reflink_xattrs(inode, old_bh,
new_inode, new_bh, new_inode, new_bh,
preserve); preserve);

View File

@ -6526,16 +6526,7 @@ static int ocfs2_reflink_xattr_inline(struct ocfs2_xattr_reflink *args)
} }
new_oi = OCFS2_I(args->new_inode); new_oi = OCFS2_I(args->new_inode);
/*
* Adjust extent record count to reserve space for extended attribute.
* Inline data count had been adjusted in ocfs2_duplicate_inline_data().
*/
if (!(new_oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) &&
!(ocfs2_inode_is_fast_symlink(args->new_inode))) {
struct ocfs2_extent_list *el = &new_di->id2.i_list;
le16_add_cpu(&el->l_count, -(inline_size /
sizeof(struct ocfs2_extent_rec)));
}
spin_lock(&new_oi->ip_lock); spin_lock(&new_oi->ip_lock);
new_oi->ip_dyn_features |= OCFS2_HAS_XATTR_FL | OCFS2_INLINE_XATTR_FL; new_oi->ip_dyn_features |= OCFS2_HAS_XATTR_FL | OCFS2_INLINE_XATTR_FL;
new_di->i_dyn_features = cpu_to_le16(new_oi->ip_dyn_features); new_di->i_dyn_features = cpu_to_le16(new_oi->ip_dyn_features);

View File

@ -132,6 +132,8 @@ static inline void cec_msg_init(struct cec_msg *msg,
* Set the msg destination to the orig initiator and the msg initiator to the * Set the msg destination to the orig initiator and the msg initiator to the
* orig destination. Note that msg and orig may be the same pointer, in which * orig destination. Note that msg and orig may be the same pointer, in which
* case the change is done in place. * case the change is done in place.
*
* It also zeroes the reply, timeout and flags fields.
*/ */
static inline void cec_msg_set_reply_to(struct cec_msg *msg, static inline void cec_msg_set_reply_to(struct cec_msg *msg,
struct cec_msg *orig) struct cec_msg *orig)
@ -139,7 +141,9 @@ static inline void cec_msg_set_reply_to(struct cec_msg *msg,
/* The destination becomes the initiator and vice versa */ /* The destination becomes the initiator and vice versa */
msg->msg[0] = (cec_msg_destination(orig) << 4) | msg->msg[0] = (cec_msg_destination(orig) << 4) |
cec_msg_initiator(orig); cec_msg_initiator(orig);
msg->reply = msg->timeout = 0; msg->reply = 0;
msg->timeout = 0;
msg->flags = 0;
} }
/* cec_msg flags field */ /* cec_msg flags field */

View File

@ -1101,6 +1101,13 @@ static __always_inline void *__do_krealloc(const void *p, size_t new_size,
/* If the object still fits, repoison it precisely. */ /* If the object still fits, repoison it precisely. */
if (ks >= new_size) { if (ks >= new_size) {
/* Zero out spare memory. */
if (want_init_on_alloc(flags)) {
kasan_disable_current();
memset((void *)p + new_size, 0, ks - new_size);
kasan_enable_current();
}
p = kasan_krealloc((void *)p, new_size, flags); p = kasan_krealloc((void *)p, new_size, flags);
return (void *)p; return (void *)p;
} }

View File

@ -725,10 +725,13 @@ int tomoyo_find_next_domain(struct linux_binprm *bprm)
ee->r.obj = &ee->obj; ee->r.obj = &ee->obj;
ee->obj.path1 = bprm->file->f_path; ee->obj.path1 = bprm->file->f_path;
/* Get symlink's pathname of program. */ /* Get symlink's pathname of program. */
retval = -ENOENT;
exename.name = tomoyo_realpath_nofollow(original_name); exename.name = tomoyo_realpath_nofollow(original_name);
if (!exename.name) {
/* Fallback to realpath if symlink's pathname does not exist. */
exename.name = tomoyo_realpath_from_path(&bprm->file->f_path);
if (!exename.name) if (!exename.name)
goto out; goto out;
}
tomoyo_fill_path_info(&exename); tomoyo_fill_path_info(&exename);
retry: retry:
/* Check 'aggregator' directive. */ /* Check 'aggregator' directive. */