NFSv4.1 handle ERR_DELAY error reclaiming locking state on delegation recall
Subsystems (14)
Sasha Levin
maintainerPATCH 12/22 openrisc: Fix cache API compile issue when not inlining
In reply to Sasha LevinFrom: Stafford Horne <[email protected]>
[ Upstream commit 3ae90d764093dfcd6ab8ab6875377302892c87d4 ]
I found this when compiling a kbuild random config with GCC 11. The config enables CONFIG_DEBUG_SECTION_MISMATCH, which sets CFLAGS -fno-inline-functions-called-once. This causes the call to cache_loop in cache.c to not be inlined causing the below compile error.
In file included from arch/openrisc/mm/cache.c:13:
arch/openrisc/mm/cache.c: In function 'cache_loop':
./arch/openrisc/include/asm/spr.h:16:27: warning: 'asm' operand 0 probably does not match constraints
16 | #define mtspr(_spr, _val) __asm__ __volatile__ ( \
| ^~~~~~~
arch/openrisc/mm/cache.c:25:3: note: in expansion of macro 'mtspr'
25 | mtspr(reg, line);
| ^~~~~
./arch/openrisc/include/asm/spr.h:16:27: error: impossible constraint in 'asm'
16 | #define mtspr(_spr, _val) __asm__ __volatile__ ( \
| ^~~~~~~
arch/openrisc/mm/cache.c:25:3: note: in expansion of macro 'mtspr'
25 | mtspr(reg, line);
| ^~~~~
make[1]: *** [scripts/Makefile.build:283: arch/openrisc/mm/cache.o] Error 1The asm constraint "K" requires a immediate constant argument to mtspr, however because of no inlining a register argument is passed causing a failure. Fix this by using __always_inline.
--- arch/openrisc/mm/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/openrisc/mm/cache.c +1 -1
@@ -16,7 +16,7 @@#include <asm/cacheflush.h> #include <asm/tlbflush.h> -static void cache_loop (struct page *page,const unsigned int reg) +static __always_inline void cache_loop(struct page *page, const unsigned int reg) {unsigned long paddr =page_to_pfn (page) <<PAGE_SHIFT ;unsigned long line = paddr & ~(L1_CACHE_BYTES -1 );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 13/22 nvme-fc: cancel async events before freeing event struct
In reply to Sasha LevinFrom: David Milburn <[email protected]>
[ Upstream commit e126e8210e950bb83414c4f57b3120ddb8450742 ]
Cancel async event work in case async event has been queued up, and nvme_fc_submit_async_event() runs after event has been freed.
--- drivers/nvme/host/fc.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/fc.c +1 -0
@@ -1820,6 +1820,7 @@ nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl)struct nvme_fc_fcp_op *aen_op;int i; +cancel_work_sync (&ctrl->ctrl.async_event_work); aen_op = ctrl->aen_ops;for (i =0 ; i <NVME_NR_AEN_COMMANDS ; i++, aen_op++) {if (!aen_op->fcp_req.private)
Signature · 7 lines
2.25.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 14/22 nvme-rdma: cancel async events before freeing event struct
In reply to Sasha LevinFrom: David Milburn <[email protected]>
[ Upstream commit 925dd04c1f9825194b9e444c12478084813b2b5d ]
Cancel async event work in case async event has been queued up, and nvme_rdma_submit_async_event() runs after event has been freed.
--- drivers/nvme/host/rdma.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/rdma.c +1 -0
@@ -768,6 +768,7 @@ static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl,blk_mq_free_tag_set (ctrl->ctrl.admin_tagset); }if (ctrl->async_event_sqe.data) { +cancel_work_sync (&ctrl->ctrl.async_event_work);nvme_rdma_free_qe (ctrl->device->dev, &ctrl->async_event_sqe,sizeof (struct nvme_command ),DMA_TO_DEVICE ); ctrl->async_event_sqe.data =NULL ;
Signature · 7 lines
2.25.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 15/22 nvme-tcp: cancel async events before freeing event struct
In reply to Sasha LevinFrom: David Milburn <[email protected]>
[ Upstream commit ceb1e0874dba5cbfc4e0b4145796a4bfb3716e6a ]
Cancel async event work in case async event has been queued up, and nvme_tcp_submit_async_event() runs after event has been freed.
--- drivers/nvme/host/tcp.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/tcp.c +1 -0
@@ -1506,6 +1506,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl,static void nvme_tcp_free_admin_queue (struct nvme_ctrl *ctrl) {if (to_tcp_ctrl (ctrl)->async_req.pdu) { +cancel_work_sync (&ctrl->async_event_work);nvme_tcp_free_async_req (to_tcp_ctrl (ctrl));to_tcp_ctrl (ctrl)->async_req.pdu =NULL ; }
Signature · 7 lines
2.25.1 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 17/22 f2fs: fix indefinite loop scanning for free nid
In reply to Sasha LevinFrom: Sahitya Tummala <[email protected]>
[ Upstream commit e2cab031ba7b5003cd12185b3ef38f1a75e3dae8 ]
If the sbi->ckpt->next_free_nid is not NAT block aligned and if there are free nids in that NAT block between the start of the block and next_free_nid, then those free nids will not be scanned in scan_nat_page(). This results into mismatch between nm_i->available_nids and the sum of nm_i->free_nid_count of all NAT blocks scanned. And nm_i->available_nids will always be greater than the sum of free nids in all the blocks. Under this condition, if we use all the currently scanned free nids, then it will loop forever in f2fs_alloc_nid() as nm_i->available_nids is still not zero but nm_i->free_nid_count of that partially scanned NAT block is zero.
Fix this to align the nm_i->next_scan_nid to the first nid of the corresponding NAT block.
--- fs/f2fs/node.c | 3 +++ 1 file changed, 3 insertions(+)
fs/f2fs/node.c +3 -0
@@ -2315,6 +2315,9 @@ static int __f2fs_build_free_nids(struct f2fs_sb_info *sbi,if (unlikely (nid >= nm_i->max_nid)) nid =0 ; +if (unlikely (nid %NAT_ENTRY_PER_BLOCK )) + nid =NAT_BLOCK_OFFSET (nid) *NAT_ENTRY_PER_BLOCK ; +/* Enough entries */ if (nm_i->nid_cnt[FREE_NID ] >=NAT_ENTRY_PER_BLOCK )return 0 ;
Signature · 8 lines
2.25.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Sasha Levin
maintainerPATCH 18/22 f2fs: Return EOF on unaligned end of file DIO read
In reply to Sasha LevinFrom: Gabriel Krisman Bertazi <[email protected]>
[ Upstream commit 20d0a107fb35f37578b919f62bd474d6d358d579 ]
Reading past end of file returns EOF for aligned reads but -EINVAL for unaligned reads on f2fs. While documentation is not strict about this corner case, most filesystem returns EOF on this case, like iomap filesystems. This patch consolidates the behavior for f2fs, by making it return EOF(0).
it can be verified by a read loop on a file that does a partial read before EOF (A file that doesn't end at an aligned address). The following code fails on an unaligned file on f2fs, but not on btrfs, ext4, and xfs.
while (done < total) {
ssize_t delta = pread(fd, buf + done, total - done, off + done);
if (!delta)
break;
...
}It is arguable whether filesystems should actually return EOF or -EINVAL, but since iomap filesystems support it, and so does the original DIO code, it seems reasonable to consolidate on that.
--- fs/f2fs/data.c | 3 +++ 1 file changed, 3 insertions(+)
fs/f2fs/data.c +3 -0
@@ -2753,6 +2753,9 @@ static int check_direct_IO(struct inode *inode, struct iov_iter *iter,unsigned long align = offset |iov_iter_alignment (iter);struct block_device *bdev = inode->i_sb->s_bdev; +if (iov_iter_rw (iter) ==READ && offset >=i_size_read (inode)) +return 1 ; +if (align & blocksize_mask) {if (bdev) blkbits =blksize_bits (bdev_logical_block_size (bdev));
Signature · 8 lines
2.25.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Sasha Levin
maintainerPATCH 5/22 regulator: pwm: Fix machine constraints application
In reply to Sasha LevinFrom: Vincent Whitchurch <[email protected]>
[ Upstream commit 59ae97a7a9e1499c2070e29841d1c4be4ae2994a ]
If the zero duty cycle doesn't correspond to any voltage in the voltage table, the PWM regulator returns an -EINVAL from get_voltage_sel() which results in the core erroring out with a "failed to get the current voltage" and ending up not applying the machine constraints.
Instead, return -ENOTRECOVERABLE which makes the core set the voltage since it's at an unknown value.
For example, with this device tree:
fooregulator {
compatible = "pwm-regulator";
pwms = <&foopwm 0 100000>;
regulator-min-microvolt = <2250000>;
regulator-max-microvolt = <2250000>;
regulator-name = "fooregulator";
regulator-always-on;
regulator-boot-on;
voltage-table = <2250000 30>;
};Before this patch:
fooregulator: failed to get the current voltage(-22)
After this patch:
fooregulator: Setting 2250000-2250000uV
fooregulator: 2250 mV
--- drivers/regulator/pwm-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/pwm-regulator.c +1 -1
@@ -279,7 +279,7 @@ static int pwm_regulator_init_table(struct platform_device *pdev,return ret; } - drvdata->state = -EINVAL ; + drvdata->state = -ENOTRECOVERABLE ; drvdata->duty_cycle_table = duty_cycle_table; drvdata->desc.ops = &pwm_regulator_voltage_table_ops; drvdata->desc.n_voltages = length /sizeof (*duty_cycle_table);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 22/22 KVM: MIPS: Change the definition of kvm type
In reply to Sasha LevinFrom: Huacai Chen <[email protected]>
[ Upstream commit 15e9e35cd1dec2bc138464de6bf8ef828df19235 ]
MIPS defines two kvm types:
#define KVM_VM_MIPS_TE 0
#define KVM_VM_MIPS_VZ 1
In Documentation/virt/kvm/api.rst it is said that "You probably want to use 0 as machine type", which implies that type 0 be the "automatic" or "default" type. And, in user-space libvirt use the null-machine (with type 0) to detect the kvm capability, which returns "KVM not supported" on a VZ platform.
I try to fix it in QEMU but it is ugly:
https://lists.nongnu.org/archive/html/qemu-devel/2020-08/msg05629.html
And Thomas Huth suggests me to change the definition of kvm type:
https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03281.html
So I define like this:
#define KVM_VM_MIPS_AUTO 0 #define KVM_VM_MIPS_VZ 1 #define KVM_VM_MIPS_TE 2
Since VZ and TE cannot co-exists, using type 0 on a TE platform will still return success (so old user-space tools have no problems on new kernels); the advantage is that using type 0 on a VZ platform will not return failure. So, the only problem is "new user-space tools use type 2 on old kernels", but if we treat this as a kernel bug, we can backport this patch to old stable kernels.
Message-Id: <[email protected]>
--- arch/mips/kvm/mips.c | 2 ++ include/uapi/linux/kvm.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-)
arch/mips/kvm/mips.c +2 -0
@@ -131,6 +131,8 @@ int kvm_arch_check_processor_compat(void)int kvm_arch_init_vm (struct kvm *kvm,unsigned long type) {switch (type) { +case KVM_VM_MIPS_AUTO : +break ;#ifdef CONFIG_KVM_MIPS_VZ case KVM_VM_MIPS_VZ :#else
include/uapi/linux/kvm.h +3 -2
@@ -768,9 +768,10 @@ struct kvm_ppc_resize_hpt {#define KVM_VM_PPC_HV 1#define KVM_VM_PPC_PR 2 -/* on MIPS, 0 forces trap & emulate, 1 forces VZ ASE */ -#define KVM_VM_MIPS_TE 0 +/* on MIPS, 0 indicates auto, 1 forces VZ ASE, 2 forces trap & emulate */ +#define KVM_VM_MIPS_AUTO 0#define KVM_VM_MIPS_VZ 1 +#define KVM_VM_MIPS_TE 2#define KVM_S390_SIE_PAGE_OFFSET 1
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 7/22 NFS: Zero-stateid SETATTR should first return delegation
In reply to Sasha LevinFrom: Chuck Lever <[email protected]>
[ Upstream commit 644c9f40cf71969f29add32f32349e71d4995c0b ]
If a write delegation isn't available, the Linux NFS client uses a zero-stateid when performing a SETATTR.
NFSv4.0 provides no mechanism for an NFS server to match such a request to a particular client. It recalls all delegations for that file, even delegations held by the client issuing the request. If that client happens to hold a read delegation, the server will recall it immediately, resulting in an NFS4ERR_DELAY/CB_RECALL/ DELEGRETURN sequence.
Optimize out this pipeline bubble by having the client return any delegations it may hold on a file before it issues a SETATTR(zero-stateid) on that file.
--- fs/nfs/nfs4proc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/nfs4proc.c +3 -1
@@ -3257,8 +3257,10 @@ static int _nfs4_do_setattr(struct inode *inode,/* Servers should only apply open mode checks for file size changes */ truncate = (arg->iap->ia_valid &ATTR_SIZE ) ? true : false; -if (!truncate) +if (!truncate) { +nfs4_inode_make_writeable (inode); goto zero_stateid; + }if (nfs4_copy_delegation_stateid (inode,FMODE_WRITE , &arg->stateid, &delegation_cred)) {/* Use that stateid */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 21/22 gcov: add support for GCC 10.1
In reply to Sasha LevinFrom: Peter Oberparleiter <[email protected]>
[ Upstream commit 40249c6962075c040fd071339acae524f18bfac9 ]
Using gcov to collect coverage data for kernels compiled with GCC 10.1 causes random malfunctions and kernel crashes. This is the result of a changed GCOV_COUNTERS value in GCC 10.1 that causes a mismatch between the layout of the gcov_info structure created by GCC profiling code and the related structure used by the kernel.
Fix this by updating the in-kernel GCOV_COUNTERS value. Also re-enable config GCOV_KERNEL for use with GCC 10.
--- kernel/gcov/gcc_4_7.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/gcov/gcc_4_7.c +3 -1
@@ -19,7 +19,9 @@#include <linux/vmalloc.h> #include "gcov.h" -#if (__GNUC__ >=7 ) +#if (__GNUC__ >=10 ) +#define GCOV_COUNTERS 8 +#elif (__GNUC__ >=7 )#define GCOV_COUNTERS 9#elif (__GNUC__ >5 ) || (__GNUC__ ==5 && __GNUC_MINOR__ >=1 )#define GCOV_COUNTERS 10
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 20/22 spi: Fix memory leak on splited transfers
In reply to Sasha LevinFrom: Gustav Wiklander <[email protected]>
[ Upstream commit b59a7ca15464c78ea1ba3b280cfc5ac5ece11ade ]
In the prepare_message callback the bus driver has the opportunity to split a transfer into smaller chunks. spi_map_msg is done after prepare_message.
Function spi_res_release releases the splited transfers in the message. Therefore spi_res_release should be called after spi_map_msg.
The previous try at this was commit c9ba7a16d0f1 which released the splited transfers after spi_finalize_current_message had been called. This introduced a race since the message struct could be out of scope because the spi_sync call got completed.
Fixes this leak on spi bus driver spi-bcm2835.c when transfer size is greater than 65532:
Kmemleak:
sg_alloc_table+0x28/0xc8 spi_map_buf+0xa4/0x300 __spi_pump_messages+0x370/0x748 __spi_sync+0x1d4/0x270 spi_sync+0x34/0x58 spi_test_execute_msg+0x60/0x340 [spi_loopback_test] spi_test_run_iter+0x548/0x578 [spi_loopback_test] spi_test_run_test+0x94/0x140 [spi_loopback_test] spi_test_run_tests+0x150/0x180 [spi_loopback_test] spi_loopback_test_probe+0x50/0xd0 [spi_loopback_test] spi_drv_probe+0x84/0xe0
--- drivers/spi/spi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/spi/spi.c +7 -2
@@ -1241,8 +1241,6 @@ static int spi_transfer_one_message(struct spi_controller *ctlr,if (msg->status && ctlr->handle_err) ctlr->handle_err (ctlr, msg); -spi_res_release (ctlr, msg); -spi_finalize_current_message (ctlr);return ret;
@@ -1525,6 +1523,13 @@ void spi_finalize_current_message(struct spi_controller *ctlr)spi_unmap_msg (ctlr, mesg); +/* In the prepare_messages callback the spi bus has the opportunity to +* split a transfer to smaller chunks. +* Release splited transfers here since spi_map_msg is done on the +* splited transfers. +*/ +spi_res_release (ctlr, mesg); +if (ctlr->cur_msg_prepared && ctlr->unprepare_message) { ret = ctlr->unprepare_message (ctlr, mesg);if (ret) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 10/22 cifs: fix DFS mount with cifsacl/modefromsid
In reply to Sasha LevinFrom: Ronnie Sahlberg <[email protected]>
[ Upstream commit 01ec372cef1e5afa4ab843bbaf88a6fcb64dc14c ]
RHBZ: 1871246
If during cifs_lookup()/get_inode_info() we encounter a DFS link and we use the cifsacl or modefromsid mount options we must suppress any -EREMOTE errors that triggers or else we will not be able to follow the DFS link and automount the target.
This fixes an issue with modefromsid/cifsacl where these mountoptions would break DFS and we would no longer be able to access the share.
--- fs/cifs/inode.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/cifs/inode.c +4 -0
@@ -898,6 +898,8 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_MODE_FROM_SID ) { rc =cifs_acl_to_fattr (cifs_sb, &fattr, *inode, true, full_path, fid); +if (rc == -EREMOTE ) + rc =0 ;if (rc) {cifs_dbg (FYI ,"%s: Get mode from SID failed. rc=%d\n" , __func__, rc);
@@ -906,6 +908,8 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, }else if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_ACL ) { rc =cifs_acl_to_fattr (cifs_sb, &fattr, *inode, false, full_path, fid); +if (rc == -EREMOTE ) + rc =0 ;if (rc) {cifs_dbg (FYI ,"%s: Getting ACL failed with error: %d\n" , __func__, rc);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 8/22 SUNRPC: stop printk reading past end of string
In reply to Sasha LevinFrom: "J. Bruce Fields" <[email protected]>
[ Upstream commit 8c6b6c793ed32b8f9770ebcdf1ba99af423c303b ]
Since p points at raw xdr data, there's no guarantee that it's NULL terminated, so we should give a length. And probably escape any special characters too.
--- net/sunrpc/rpcb_clnt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/rpcb_clnt.c +2 -2
@@ -988,8 +988,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, p =xdr_inline_decode (xdr, len);if (unlikely (p ==NULL )) goto out_fail; -dprintk ("RPC: %5u RPCB_%s reply: %s\n" , req->rq_task->tk_pid, - req->rq_task->tk_msg.rpc_proc->p_name, (char *)p); +dprintk ("RPC: %5u RPCB_%s reply: %*pE\n" , req->rq_task->tk_pid, + req->rq_task->tk_msg.rpc_proc->p_name, len, (char *)p);if (rpc_uaddr2sockaddr (req->rq_xprt->xprt_net, (char *)p, len, sap,sizeof (address)) ==0 )
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 16/22 block: only call sched requeue_request() for scheduled requests
In reply to Sasha LevinFrom: Omar Sandoval <[email protected]>
[ Upstream commit e8a8a185051a460e3eb0617dca33f996f4e31516 ]
Yang Yang reported the following crash caused by requeueing a flush request in Kyber:
[ 2.517297] Unable to handle kernel paging request at virtual address ffffffd8071c0b00 ... [ 2.517468] pc : clear_bit+0x18/0x2c [ 2.517502] lr : sbitmap_queue_clear+0x40/0x228 [ 2.517503] sp : ffffff800832bc60 pstate : 00c00145 ... [ 2.517599] Process ksoftirqd/5 (pid: 51, stack limit = 0xffffff8008328000) [ 2.517602] Call trace: [ 2.517606] clear_bit+0x18/0x2c [ 2.517619] kyber_finish_request+0x74/0x80 [ 2.517627] blk_mq_requeue_request+0x3c/0xc0 [ 2.517637] __scsi_queue_insert+0x11c/0x148 [ 2.517640] scsi_softirq_done+0x114/0x130 [ 2.517643] blk_done_softirq+0x7c/0xb0 [ 2.517651] __do_softirq+0x208/0x3bc [ 2.517657] run_ksoftirqd+0x34/0x60 [ 2.517663] smpboot_thread_fn+0x1c4/0x2c0 [ 2.517667] kthread+0x110/0x120 [ 2.517669] ret_from_fork+0x10/0x18
This happens because Kyber doesn't track flush requests, so kyber_finish_request() reads a garbage domain token. Only call the scheduler's requeue_request() hook if RQF_ELVPRIV is set (like we do for the finish_request() hook in blk_mq_free_request()). Now that we're handling it in blk-mq, also remove the check from BFQ.
--- block/bfq-iosched.c | 12 ------------ block/blk-mq-sched.h | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-)
block/bfq-iosched.c +0 -12
@@ -5890,18 +5890,6 @@ static void bfq_finish_requeue_request(struct request *rq)struct bfq_queue *bfqq =RQ_BFQQ (rq);struct bfq_data *bfqd; -/* -* Requeue and finish hooks are invoked in blk-mq without -* checking whether the involved request is actually still -* referenced in the scheduler. To handle this fact, the -* following two checks make this function exit in case of -* spurious invocations, for which there is nothing to do. -* -* First, check whether rq has nothing to do with an elevator. -*/ -if (unlikely (!(rq->rq_flags &RQF_ELVPRIV ))) -return ; -/* * rq either is not associated with any icq, or is an already * requeued request that has not (yet) been re-inserted into
block/blk-mq-sched.h +1 -1
@@ -66,7 +66,7 @@ static inline void blk_mq_sched_requeue_request(struct request *rq)struct request_queue *q = rq->q;struct elevator_queue *e = q->elevator; -if (e && e->type->ops.requeue_request) +if ((rq->rq_flags &RQF_ELVPRIV ) && e && e->type->ops.requeue_request) e->type->ops.requeue_request (rq); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 19/22 i2c: algo: pca: Reapply i2c bus settings after reset
In reply to Sasha LevinFrom: Evan Nimmo <[email protected]>
[ Upstream commit 0a355aeb24081e4538d4d424cd189f16c0bbd983 ]
If something goes wrong (such as the SCL being stuck low) then we need to reset the PCA chip. The issue with this is that on reset we lose all config settings and the chip ends up in a disabled state which results in a lock up/high CPU usage. We need to re-apply any configuration that had previously been set and re-enable the chip.
--- drivers/i2c/algos/i2c-algo-pca.c | 35 +++++++++++++++++++++----------- include/linux/i2c-algo-pca.h | 15 ++++++++++++++ 2 files changed, 38 insertions(+), 12 deletions(-)
drivers/i2c/algos/i2c-algo-pca.c +23 -12
@@ -41,8 +41,22 @@ static void pca_reset(struct i2c_algo_pca_data *adap)pca_outw (adap,I2C_PCA_INDPTR ,I2C_PCA_IPRESET );pca_outw (adap,I2C_PCA_IND ,0xA5 );pca_outw (adap,I2C_PCA_IND ,0x5A ); + +/* +* After a reset we need to re-apply any configuration +* (calculated in pca_init) to get the bus in a working state. +*/ +pca_outw (adap,I2C_PCA_INDPTR ,I2C_PCA_IMODE ); +pca_outw (adap,I2C_PCA_IND , adap->bus_settings.mode); +pca_outw (adap,I2C_PCA_INDPTR ,I2C_PCA_ISCLL ); +pca_outw (adap,I2C_PCA_IND , adap->bus_settings.tlow); +pca_outw (adap,I2C_PCA_INDPTR ,I2C_PCA_ISCLH ); +pca_outw (adap,I2C_PCA_IND , adap->bus_settings.thi); + +pca_set_con (adap,I2C_PCA_CON_ENSIO ); }else { adap->reset_chip (adap->data); +pca_set_con (adap,I2C_PCA_CON_ENSIO | adap->bus_settings.clock_freq); } }
@@ -423,13 +437,14 @@ static int pca_init(struct i2c_adapter *adap) " Use the nominal frequency.\n", adap->name); } -pca_reset (pca_data); - clock =pca_clock (pca_data);printk (KERN_INFO "%s: Clock frequency is %dkHz\n" , adap->name, freqs[clock]); -pca_set_con (pca_data,I2C_PCA_CON_ENSIO | clock); +/* Store settings as these will be needed when the PCA chip is reset */ + pca_data->bus_settings.clock_freq = clock; + +pca_reset (pca_data); }else {int clock;int mode;
@@ -496,19 +511,15 @@ static int pca_init(struct i2c_adapter *adap) thi = tlow * min_thi / min_tlow; } +/* Store settings as these will be needed when the PCA chip is reset */ + pca_data->bus_settings.mode = mode; + pca_data->bus_settings.tlow = tlow; + pca_data->bus_settings.thi = thi; +pca_reset (pca_data);printk (KERN_INFO "%s: Clock frequency is %dHz\n" , adap->name, clock *100 ); - -pca_outw (pca_data,I2C_PCA_INDPTR ,I2C_PCA_IMODE ); -pca_outw (pca_data,I2C_PCA_IND , mode); -pca_outw (pca_data,I2C_PCA_INDPTR ,I2C_PCA_ISCLL ); -pca_outw (pca_data,I2C_PCA_IND , tlow); -pca_outw (pca_data,I2C_PCA_INDPTR ,I2C_PCA_ISCLH ); -pca_outw (pca_data,I2C_PCA_IND , thi); - -pca_set_con (pca_data,I2C_PCA_CON_ENSIO ); }udelay (500 );/* 500 us for oscillator to stabilise */
include/linux/i2c-algo-pca.h +15 -0
@@ -53,6 +53,20 @@#define I2C_PCA_CON_SI 0x08/* Serial Interrupt */ #define I2C_PCA_CON_CR 0x07/* Clock Rate (MASK) */ +/** +* struct pca_i2c_bus_settings - The configured PCA i2c bus settings +* @mode: Configured i2c bus mode +* @tlow: Configured SCL LOW period +* @thi: Configured SCL HIGH period +* @clock_freq: The configured clock frequency +*/ +struct pca_i2c_bus_settings { +int mode; +int tlow; +int thi; +int clock_freq; +}; +struct i2c_algo_pca_data {void *data;/* private low level data */ void (*write_byte) (void *data,int reg,int val);
@@ -64,6 +78,7 @@ struct i2c_algo_pca_data {* For PCA9665, use the frequency you want here. */ unsigned int i2c_clock;unsigned int chip; +struct pca_i2c_bus_settings bus_settings; };int i2c_pca_add_bus (struct i2c_adapter *);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 11/22 kobject: Drop unneeded conditional in __kobject_del()
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 07ecc6693f9157cf293da5d165c73fb28fd69bf4 ]
__kobject_del() is called from two places, in one where kobj is dereferenced before and thus can't be NULL, and in the other the NULL check is done before call. Drop unneeded conditional in __kobject_del().
--- lib/kobject.c | 3 --- 1 file changed, 3 deletions(-)
lib/kobject.c +0 -3
@@ -604,9 +604,6 @@ static void __kobject_del(struct kobject *kobj)struct kernfs_node *sd;const struct kobj_type *ktype; -if (!kobj) -return ; - sd = kobj->sd; ktype =get_ktype (kobj);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 9/22 rapidio: Replace 'select' DMAENGINES 'with depends on'
In reply to Sasha LevinFrom: Laurent Pinchart <[email protected]>
[ Upstream commit d2b86100245080cfdf1e95e9e07477474c1be2bd ]
Enabling a whole subsystem from a single driver 'select' is frowned upon and won't be accepted in new drivers, that need to use 'depends on' instead. Existing selection of DMAENGINES will then cause circular dependencies. Replace them with a dependency.
--- drivers/rapidio/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rapidio/Kconfig +1 -1
@@ -37,7 +37,7 @@ config RAPIDIO_ENABLE_RX_TX_PORTS config RAPIDIO_DMA_ENGINE bool "DMA Engine support for RapidIO" depends on RAPIDIO - select DMADEVICES + depends on DMADEVICES select DMA_ENGINE help Say Y here if you want to use DMA Engine frameork for RapidIO data
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 6/22 spi: spi-loopback-test: Fix out-of-bounds read
In reply to Sasha LevinFrom: Vincent Whitchurch <[email protected]>
[ Upstream commit 837ba18dfcd4db21ad58107c65bfe89753aa56d7 ]
The "tx/rx-transfer - crossing PAGE_SIZE" test always fails when len=131071 and rx_offset >= 5:
spi-loopback-test spi0.0: Running test tx/rx-transfer - crossing PAGE_SIZE
...
with iteration values: len = 131071, tx_off = 0, rx_off = 3 with iteration values: len = 131071, tx_off = 0, rx_off = 4 with iteration values: len = 131071, tx_off = 0, rx_off = 5
loopback strangeness - rx changed outside of allowed range at: ...a4321000
spi_msg@ffffffd5a4157690
frame_length: 131071
actual_length: 131071
spi_transfer@ffffffd5a41576f8
len: 131071
tx_buf: ffffffd5a4340ffcNote that rx_offset > 3 can only occur if the SPI controller driver sets ->dma_alignment to a higher value than 4, so most SPI controller drivers are not affect.
The allocated Rx buffer is of size SPI_TEST_MAX_SIZE_PLUS, which is 132 KiB (assuming 4 KiB pages). This test uses an initial offset into the rx_buf of PAGE_SIZE - 4, and a len of 131071, so the range expected to be written in this transfer ends at (4096 - 4) + 5 + 131071 == 132 KiB, which is also the end of the allocated buffer. But the code which verifies the content of the buffer reads a byte beyond the allocated buffer and spuriously fails because this out-of-bounds read doesn't return the expected value.
Fix this by using ITERATE_LEN instead of ITERATE_MAX_LEN to avoid testing sizes which cause out-of-bounds reads.
--- drivers/spi/spi-loopback-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-loopback-test.c +1 -1
@@ -90,7 +90,7 @@ static struct spi_test spi_tests[] = { { .description = "tx/rx-transfer - crossing PAGE_SIZE", .fill_option = FILL_COUNT_8, - .iterate_len = { ITERATE_MAX_LEN }, + .iterate_len = { ITERATE_LEN }, .iterate_tx_align = ITERATE_ALIGN, .iterate_rx_align = ITERATE_ALIGN, .transfer_count = 1,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 4/22 scsi: lpfc: Fix FLOGI/PLOGI receive race condition in pt2pt discovery
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 7b08e89f98cee9907895fabb64cf437bc505ce9a ]
The driver is unable to successfully login with remote device. During pt2pt login, the driver completes its FLOGI request with the remote device having WWN precedence. The remote device issues its own (delayed) FLOGI after accepting the driver's and, upon transmitting the FLOGI, immediately recognizes it has already processed the driver's FLOGI thus it transitions to sending a PLOGI before waiting for an ACC to its FLOGI.
In the driver, the FLOGI is received and an ACC sent, followed by the PLOGI being received and an ACC sent. The issue is that the PLOGI reception occurs before the response from the adapter from the FLOGI ACC is received. Processing of the PLOGI sets state flags to perform the REG_RPI mailbox command and proceed with the rest of discovery on the port. The same completion routine used by both FLOGI and PLOGI is generic in nature. One of the things it does is clear flags, and those flags happen to drive the rest of discovery. So what happened was the PLOGI processing set the flags, the FLOGI ACC completion cleared them, thus when the PLOGI ACC completes it doesn't see the flags and stops.
Fix by modifying the generic completion routine to not clear the rest of discovery flag (NLP_ACC_REGLOGIN) unless the completion is also associated with performing a mailbox command as part of its handling. For things such as FLOGI ACC, there isn't a subsequent action to perform with the adapter, thus there is no mailbox cmd ptr. PLOGI ACC though will perform REG_RPI upon completion, thus there is a mailbox cmd ptr.
--- drivers/scsi/lpfc/lpfc_els.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_els.c +3 -1
@@ -4442,7 +4442,9 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, out:if (ndlp &&NLP_CHK_NODE_ACT (ndlp) && shost) {spin_lock_irq (shost->host_lock); - ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN |NLP_RM_DFLT_RPI ); +if (mbox) + ndlp->nlp_flag &= ~NLP_ACC_REGLOGIN ; + ndlp->nlp_flag &= ~NLP_RM_DFLT_RPI ;spin_unlock_irq (shost->host_lock);/* If the node is not being used by another discovery thread,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 2/22 scsi: pm8001: Fix memleak in pm8001_exec_internal_task_abort
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit ea403fde7552bd61bad6ea45e3feb99db77cb31e ]
When pm8001_tag_alloc() fails, task should be freed just like it is done in the subsequent error paths.
--- drivers/scsi/pm8001/pm8001_sas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/pm8001/pm8001_sas.c +1 -1
@@ -816,7 +816,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha, res =pm8001_tag_alloc (pm8001_ha, &ccb_tag);if (res) -return res; + goto ex_err; ccb = &pm8001_ha->ccb_info[ccb_tag]; ccb->device = pm8001_dev; ccb->ccb_tag = ccb_tag;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 1/22 NFSv4.1 handle ERR_DELAY error reclaiming locking state on delegation recall
From: Olga Kornievskaia <[email protected]>
[ Upstream commit 3d7a9520f0c3e6a68b6de8c5812fc8b6d7a52626 ]
A client should be able to handle getting an ERR_DELAY error while doing a LOCK call to reclaim state due to delegation being recalled. This is a transient error that can happen due to server moving its volumes and invalidating its file location cache and upon reference to it during the LOCK call needing to do an expensive lookup (leading to an ERR_DELAY error on a PUTFH).
--- fs/nfs/nfs4proc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/nfs/nfs4proc.c +6 -1
@@ -7232,7 +7232,12 @@ int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state, err =nfs4_set_lock_state (state, fl);if (err !=0 )return err; - err =_nfs4_do_setlk (state,F_SETLK , fl,NFS_LOCK_NEW ); +do { + err =_nfs4_do_setlk (state,F_SETLK , fl,NFS_LOCK_NEW ); +if (err != -NFS4ERR_DELAY ) +break ; +ssleep (1 ); + }while (err == -NFS4ERR_DELAY );return nfs4_handle_delegation_recall_error (server, state, stateid, fl, err); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 3/22 scsi: libfc: Fix for double free()
From: Javed Hasan <[email protected]>
[ Upstream commit 5a5b80f98534416b3b253859897e2ba1dc241e70 ]
Fix for '&fp->skb' double free.
Link:
https://lore.kernel.org/r/[email protected]
--- drivers/scsi/libfc/fc_disc.c | 2 -- 1 file changed, 2 deletions(-)
drivers/scsi/libfc/fc_disc.c +0 -2
@@ -634,8 +634,6 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,fc_frame_free (fp); out:kref_put (&rdata->kref, fc_rport_destroy); -if (!IS_ERR (fp)) -fc_frame_free (fp); }/**
Signature · 1 line
2.25.1