NFSv4: Retry LOCK on OLD_STATEID during delegation return
Subsystems (10)
Sasha Levin
maintainerPATCH 1/6 NFSv4: Retry LOCK on OLD_STATEID during delegation return
From: Benjamin Coddington <[email protected]>
[ Upstream commit f5ea16137a3fa2858620dc9084466491c128535f ]
There's a small window where a LOCK sent during a delegation return can race with another OPEN on client, but the open stateid has not yet been updated. In this case, the client doesn't handle the OLD_STATEID error from the server and will lose this lock, emitting:
"NFS: nfs4_handle_delegation_recall_error: unhandled error -10024".
Fix this by sending the task through the nfs4 error handling in nfs4_lock_done() when we may have to reconcile our stateid with what the server believes it to be. For this case, the result is a retry of the LOCK operation with the updated stateid.
--- fs/nfs/nfs4proc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +4 -2
@@ -7014,6 +7014,7 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata) {struct nfs4_lockdata *data = calldata;struct nfs4_lock_state *lsp = data->lsp; +struct nfs_server *server =NFS_SERVER (d_inode (data->ctx->dentry));dprintk ("%s: begin!\n" , __func__);
@@ -7023,8 +7024,7 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata) data->rpc_status = task->tk_status;switch (task->tk_status) {case 0 : -renew_lease (NFS_SERVER (d_inode (data->ctx->dentry)), - data->timestamp); +renew_lease (server, data->timestamp);if (data->arg.new_lock && !data->cancelled) { data->fl.fl_flags &= ~(FL_SLEEP |FL_ACCESS );if (locks_lock_inode_wait (lsp->ls_state->inode, &data->fl) <0 )
@@ -7045,6 +7045,8 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)if (!nfs4_stateid_match (&data->arg.open_stateid, &lsp->ls_state->open_stateid)) goto out_restart; +else if (nfs4_async_handle_error (task, server, lsp->ls_state,NULL ) == -EAGAIN ) + goto out_restart; }else if (!nfs4_stateid_match (&data->arg.lock_stateid, &lsp->ls_stateid)) goto out_restart;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/6 i2c: tegra: Allocate DMA memory for DMA engine
From: Thierry Reding <[email protected]>
[ Upstream commit cdbf26251d3b35c4ccaea0c3a6de4318f727d3d2 ]
When the I2C controllers are running in DMA mode, it is the DMA engine that performs the memory accesses rather than the I2C controller. Pass the DMA engine's struct device pointer to the DMA API to make sure the correct DMA operations are used.
This fixes an issue where the DMA engine's SMMU stream ID needs to be misleadingly set for the I2C controllers in device tree.
--- drivers/i2c/busses/i2c-tegra.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-tegra.c +10 -6
@@ -283,6 +283,7 @@ struct tegra_i2c_dev {struct dma_chan *tx_dma_chan;struct dma_chan *rx_dma_chan;unsigned int dma_buf_size; +struct device *dma_dev;dma_addr_t dma_phys;void *dma_buf;
@@ -419,7 +420,7 @@ static int tegra_i2c_dma_submit(struct tegra_i2c_dev *i2c_dev, size_t len)static void tegra_i2c_release_dma (struct tegra_i2c_dev *i2c_dev) {if (i2c_dev->dma_buf) { -dma_free_coherent (i2c_dev->dev, i2c_dev->dma_buf_size, +dma_free_coherent (i2c_dev->dma_dev, i2c_dev->dma_buf_size, i2c_dev->dma_buf, i2c_dev->dma_phys); i2c_dev->dma_buf =NULL ; }
@@ -466,10 +467,13 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev) i2c_dev->tx_dma_chan = chan; +WARN_ON (i2c_dev->tx_dma_chan->device != i2c_dev->rx_dma_chan->device); + i2c_dev->dma_dev = chan->device->dev; + i2c_dev->dma_buf_size = i2c_dev->hw->quirks->max_write_len +I2C_PACKET_HEADER_SIZE ; - dma_buf =dma_alloc_coherent (i2c_dev->dev, i2c_dev->dma_buf_size, + dma_buf =dma_alloc_coherent (i2c_dev->dma_dev, i2c_dev->dma_buf_size, &dma_phys,GFP_KERNEL | __GFP_NOWARN);if (!dma_buf) {dev_err (i2c_dev->dev,"failed to allocate DMA buffer\n" );
@@ -1255,7 +1259,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,if (i2c_dev->dma_mode) {if (i2c_dev->msg_read) { -dma_sync_single_for_device (i2c_dev->dev, +dma_sync_single_for_device (i2c_dev->dma_dev, i2c_dev->dma_phys, xfer_size,DMA_FROM_DEVICE );
@@ -1263,7 +1267,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,if (err)return err; }else { -dma_sync_single_for_cpu (i2c_dev->dev, +dma_sync_single_for_cpu (i2c_dev->dma_dev, i2c_dev->dma_phys, xfer_size,DMA_TO_DEVICE ); }
@@ -1276,7 +1280,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,memcpy (i2c_dev->dma_buf +I2C_PACKET_HEADER_SIZE , msg->buf, msg->len); -dma_sync_single_for_device (i2c_dev->dev, +dma_sync_single_for_device (i2c_dev->dma_dev, i2c_dev->dma_phys, xfer_size,DMA_TO_DEVICE );
@@ -1327,7 +1331,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, }if (i2c_dev->msg_read && i2c_dev->msg_err ==I2C_ERR_NONE ) { -dma_sync_single_for_cpu (i2c_dev->dev, +dma_sync_single_for_cpu (i2c_dev->dma_dev, i2c_dev->dma_phys, xfer_size,DMA_FROM_DEVICE );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/6 i2c: i801: add lis3lv02d's I2C address for Vostro 5568
In reply to Sasha LevinFrom: Nam Cao <[email protected]>
[ Upstream commit d6643d7207c572c1b0305ed505101f15502c6c87 ]
Dell Vostro 5568 laptop has lis3lv02d, but its i2c address is not known to the kernel. Add this address.
Output of "cat /sys/devices/platform/lis3lv02d/position" on Dell Vostro 5568 laptop:
- Horizontal: (-18,0,1044)
- Front elevated: (522,-18,1080)
- Left elevated: (-18,-360,1080)
- Upside down: (36,108,-1134)
--- drivers/i2c/busses/i2c-i801.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/busses/i2c-i801.c +1 -0
@@ -1275,6 +1275,7 @@ static const struct {*/ { "Latitude 5480", 0x29 }, { "Vostro V131", 0x1d }, + { "Vostro 5568", 0x29 }, };static void register_dell_lis3lv02d_i2c_device (struct i801_priv *priv)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/6 drm/imx: imx-tve: Fix return type of imx_tve_connector_mode_valid
In reply to Sasha LevinFrom: Nathan Huckleberry <[email protected]>
[ Upstream commit fc007fb815ab5395c3962c09b79a1630b0fbed9c ]
The mode_valid field in drm_connector_helper_funcs is expected to be of type:
enum drm_mode_status (* mode_valid) (struct drm_connector *connector,
struct drm_display_mode *mode);
The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition.
The return type of imx_tve_connector_mode_valid should be changed from int to enum drm_mode_status.
--- drivers/gpu/drm/imx/imx-tve.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/imx/imx-tve.c +3 -2
@@ -212,8 +212,9 @@ static int imx_tve_connector_get_modes(struct drm_connector *connector)return ret; } -static int imx_tve_connector_mode_valid (struct drm_connector *connector, -struct drm_display_mode *mode) +static enum drm_mode_status +imx_tve_connector_mode_valid (struct drm_connector *connector, +struct drm_display_mode *mode) {struct imx_tve *tve =con_to_tve (connector);unsigned long rate;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/6 btrfs: remove pointless and double ulist frees in error paths of qgroup tests
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit d0ea17aec12ea0f7b9d2ed727d8ef8169d1e7699 ]
Several places in the qgroup self tests follow the pattern of freeing the ulist pointer they passed to btrfs_find_all_roots() if the call to that function returned an error. That is pointless because that function always frees the ulist in case it returns an error.
Also In some places like at test_multiple_refs(), after a call to btrfs_qgroup_account_extent() we also leave "old_roots" and "new_roots" pointing to ulists that were freed, because btrfs_qgroup_account_extent() has freed those ulists, and if after that the next call to btrfs_find_all_roots() fails, we call ulist_free() on the "old_roots" ulist again, resulting in a double free.
So remove those calls to reduce the code size and avoid double ulist free in case of an error.
--- fs/btrfs/tests/qgroup-tests.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
fs/btrfs/tests/qgroup-tests.c +4 -12
@@ -230,7 +230,6 @@ static int test_no_shared_qgroup(struct btrfs_root *root, ret =btrfs_find_all_roots (&trans, fs_info, nodesize,0 , &old_roots, false);if (ret) { -ulist_free (old_roots);test_err ("couldn't find old roots: %d" , ret);return ret; }
@@ -244,7 +243,6 @@ static int test_no_shared_qgroup(struct btrfs_root *root, false);if (ret) {ulist_free (old_roots); -ulist_free (new_roots);test_err ("couldn't find old roots: %d" , ret);return ret; }
@@ -256,18 +254,19 @@ static int test_no_shared_qgroup(struct btrfs_root *root,return ret; } +/* btrfs_qgroup_account_extent() always frees the ulists passed to it. */ + old_roots =NULL ; + new_roots =NULL ; +if (btrfs_verify_qgroup_counts (fs_info,BTRFS_FS_TREE_OBJECTID , nodesize, nodesize)) {test_err ("qgroup counts didn't match expected values" );return -EINVAL ; } - old_roots =NULL ; - new_roots =NULL ; ret =btrfs_find_all_roots (&trans, fs_info, nodesize,0 , &old_roots, false);if (ret) { -ulist_free (old_roots);test_err ("couldn't find old roots: %d" , ret);return ret; }
@@ -280,7 +279,6 @@ static int test_no_shared_qgroup(struct btrfs_root *root, false);if (ret) {ulist_free (old_roots); -ulist_free (new_roots);test_err ("couldn't find old roots: %d" , ret);return ret; }
@@ -331,7 +329,6 @@ static int test_multiple_refs(struct btrfs_root *root, ret =btrfs_find_all_roots (&trans, fs_info, nodesize,0 , &old_roots, false);if (ret) { -ulist_free (old_roots);test_err ("couldn't find old roots: %d" , ret);return ret; }
@@ -345,7 +342,6 @@ static int test_multiple_refs(struct btrfs_root *root, false);if (ret) {ulist_free (old_roots); -ulist_free (new_roots);test_err ("couldn't find old roots: %d" , ret);return ret; }
@@ -366,7 +362,6 @@ static int test_multiple_refs(struct btrfs_root *root, ret =btrfs_find_all_roots (&trans, fs_info, nodesize,0 , &old_roots, false);if (ret) { -ulist_free (old_roots);test_err ("couldn't find old roots: %d" , ret);return ret; }
@@ -380,7 +375,6 @@ static int test_multiple_refs(struct btrfs_root *root, false);if (ret) {ulist_free (old_roots); -ulist_free (new_roots);test_err ("couldn't find old roots: %d" , ret);return ret; }
@@ -407,7 +401,6 @@ static int test_multiple_refs(struct btrfs_root *root, ret =btrfs_find_all_roots (&trans, fs_info, nodesize,0 , &old_roots, false);if (ret) { -ulist_free (old_roots);test_err ("couldn't find old roots: %d" , ret);return ret; }
@@ -421,7 +414,6 @@ static int test_multiple_refs(struct btrfs_root *root, false);if (ret) {ulist_free (old_roots); -ulist_free (new_roots);test_err ("couldn't find old roots: %d" , ret);return ret; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/6 Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm
In reply to Sasha LevinFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit f937b758a188d6fd328a81367087eddbb2fce50f ]
l2cap_global_chan_by_psm shall not return fixed channels as they are not meant to be connected by (S)PSM.
--- net/bluetooth/l2cap_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +1 -1
@@ -1986,7 +1986,7 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm,if (link_type ==LE_LINK && c->src_type ==BDADDR_BREDR )continue ; -if (c->psm == psm) { +if (c->chan_type !=L2CAP_CHAN_FIXED && c->psm == psm) {int src_match, dst_match;int src_any, dst_any;
Signature · 1 line
2.35.1