svcrdma: Preserve CB send buffer across retransmits
Subsystems (3)
RFC PATCH 1/1 svcrdma: Preserve CB send buffer across retransmits
During each NFSv4 callback Call, an RDMA Send completion frees the page that contains the RPC Call message. If the upper layer determines that a retransmit is necessary, this is too soon.
One possible symptom: after a GARBAGE_ARGS response an NFSv4.1 callback request, the following BUG fires on the NFS server:
kernel: BUG: Bad page state in process kworker/0:2H pfn:7d3ce2
kernel: page:ffffea001f4f3880 count:-2 mapcount:0 mapping: (null) index:0x0
kernel: flags: 0x2fffff80000000()
kernel: raw: 002fffff80000000 0000000000000000 0000000000000000 fffffffeffffffff
kernel: raw: dead000000000100 dead000000000200 0000000000000000 0000000000000000
kernel: page dumped because: nonzero _refcount
kernel: Modules linked in: cts rpcsec_gss_krb5 ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager ocfs2_stackglue rpcrdm a ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pc lmul crc32_pclmul ghash_clmulni_intel pcbc iTCO_wdt iTCO_vendor_support aesni_intel crypto_simd glue_helper cryptd pcspkr lpc_ich i2c_i801 mei_me mf d_core mei raid0 sg wmi ioatdma ipmi_si ipmi_devintf ipmi_msghandler shpchp acpi_power_meter acpi_pad nfsd nfs_acl lockd auth_rpcgss grace sunrpc ip_tables xfs libcrc32c mlx4_en mlx4_ib mlx5_ib ib_core sd_mod sr_mod cdrom ast drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm ahci crc32c_intel libahci drm mlx5_core igb libata mlx4_core dca i2c_algo_bit i2c_core nvme
kernel: ptp nvme_core pps_core dm_mirror dm_region_hash dm_log dm_mod dax
kernel: CPU: 0 PID: 11495 Comm: kworker/0:2H Not tainted 4.14.0-rc3-00001-g577ce48 #811
kernel: Hardware name: Supermicro Super Server/X10SRL-F, BIOS 1.0c 09/09/2015
kernel: Workqueue: ib-comp-wq ib_cq_poll_work [ib_core]
kernel: Call Trace:
kernel: dump_stack+0x62/0x80
kernel: bad_page+0xfe/0x11a
kernel: free_pages_check_bad+0x76/0x78
kernel: free_pcppages_bulk+0x364/0x441
kernel: ? ttwu_do_activate.isra.61+0x71/0x78
kernel: free_hot_cold_page+0x1c5/0x202
kernel: __put_page+0x2c/0x36
kernel: svc_rdma_put_context+0xd9/0xe4 [rpcrdma]
kernel: svc_rdma_wc_send+0x50/0x98 [rpcrdma]
This issue exists all the way back to v4.5, but refactoring and code re-organization prevents this simple patch from applying to kernels older than v4.12. The fix is the same, however, if someone needs to backport it.
--- net/sunrpc/xprtrdma/svc_rdma_backchannel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Hi Ben, Jeff-
I was able to reproduce the problem here with a rigged Linux client. This is my proposed fix. Fix also tested with a prototype Solaris client similar to the one that exposed the problem.
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +5 -1
@@ -132,6 +132,10 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma,if (ret) goto out_err; +/* Bump page refcnt so Send completion doesn't release +* the rq_buffer before all retransmits are complete. +*/ +get_page (virt_to_page (rqst->rq_buffer)); ret =svc_rdma_post_send_wr (rdma, ctxt,1 ,0 );if (ret) goto out_unmap;
@@ -164,7 +168,6 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma,return -EINVAL ; } -/* svc_rdma_sendto releases this page */ page =alloc_page (RPCRDMA_DEF_GFP );if (!page)return -ENOMEM ;
@@ -183,6 +186,7 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma, {struct rpc_rqst *rqst = task->tk_rqstp; +put_page (virt_to_page (rqst->rq_buffer));kfree (rqst->rq_rbuffer); }
Quoted 2 lines
On Oct 8, 2017, at 7:13 PM, Chuck Lever <[email protected]> =
Quoted 10 lines · wrote:
=20
During each NFSv4 callback Call, an RDMA Send completion frees the page that contains the RPC Call message. If the upper layer determines that a retransmit is necessary, this is too soon.
=20
One possible symptom: after aGARBAGE_ARGSresponse an NFSv4.1 callback request, the following BUG fires on the NFS server:
=20
kernel: BUG: Bad page state in process kworker/0:2H pfn:7d3ce2
kernel: page:ffffea001f4f3880 count:-2 mapcount:0 mapping: =
(null) index:0x0
Quoted 2 lines
kernel: flags: 0x2fffff80000000()
kernel: raw:002fffff800000000000000000000000 0000000000000000 =
fffffffeffffffff
Quoted 1 line
kernel: raw:
dead000000000100dead0000000002000000000000000000 =
0000000000000000
Quoted 2 lines
kernel: page dumped because: nonzero
_refcount
kernel: Modules linked in: ctsrpcsec_gss_krb5ocfs2_dlmfs=
ocfs2_stack_o2cb ocfs2_dlm
Quoted 1 line
ocfs2_nodemanagerocfs2_stackgluerpcrdm aib_ipoibrdma_ucmib_ucm=
ib_uverbs ib_umad
Quoted 1 line
rdma_cmib_cmiw_cmx86_pkg_temp_thermalintel_powerclampcoretemp =
kvm_intel
Quoted 1 line
kvm irqbypass
crct10dif_pclmulcrc32_pclmulghash_clmulni_intelpcbc =
iTCO_wdt
Quoted 1 line
iTCO_vendor_supportaesni_intelcrypto_simdglue_helpercryptd pcspkr =
lpc_ich i2c_i801
Quoted 1 line
mei_memfd_coremei raid0 sg wmi ioatdmaipmi_siipmi_devintf=
ipmi_msghandler shpchp
Quoted 1 line
acpi_power_meteracpi_padnfsdnfs_acllockdauth_rpcgssgrace sunrpc =
ip_tables xfs
Quoted 1 line
libcrc32c
mlx4_enmlx4_ibmlx5_ibib_coresd_modsr_modcdrom ast =
drm_kms_helper
Quoted 1 line
syscopyarea sysfillrect sysimgblt
fb_sys_fopsttm ahcicrc32c_intel=
libahci drm
Quoted 2 lines
mlx5_coreigb libatamlx4_coredcai2c_algo_biti2c_corenvme
kernel: ptpnvme_corepps_coredm_mirrordm_region_hashdm_logdm_mod=
dax
Quoted 1 line
kernel: CPU: 0 PID: 11495 Comm: kworker/0:2H Not tainted =
4.14.0-rc3-00001-g577ce48 #811
Quoted 1 line
kernel: Hardware name: Supermicro Super Server/X10SRL-F, BIOS 1.0c =
09/09/2015
Quoted 17 lines
kernel: Workqueue: ib-comp-wq
ib_cq_poll_work[ib_core]
kernel: Call Trace:
kernel:dump_stack+0x62/0x80
kernel:bad_page+0xfe/0x11a
kernel:free_pages_check_bad+0x76/0x78
kernel:free_pcppages_bulk+0x364/0x441
kernel: ? ttwu_do_activate.isra.61+0x71/0x78
kernel:free_hot_cold_page+0x1c5/0x202
kernel:__put_page+0x2c/0x36
kernel:svc_rdma_put_context+0xd9/0xe4[rpcrdma]
kernel:svc_rdma_wc_send+0x50/0x98[rpcrdma]
=20
This issue exists all the way back to v4.5, but refactoring and code re-organization prevents this simple patch from applying to kernels older than v4.12. The fix is the same, however, if someone needs to backport it.
=20
Quoted 4 lines
Reported-by Ben Coddington <[email protected]>Fixes 5d252f90a800 ('svcrdma: Add class for RDMA backwards ... ')Cc [email protected] # v4.12Signed-off-by Chuck Lever <[email protected]>
Ping.
Reviewed-by gratefully accepted! It would be good if this patch can get into 4.14.
=
Quoted 12 lines
---
net/sunrpc/xprtrdma/svc_rdma_backchannel.c| 6 +++++-1 file changed, 5 insertions(+), 1 deletion(-)=20
Hi Ben, Jeff-
=20
I was able to reproduce the problem here with a rigged Linux client. This is my proposed fix. Fix also tested with a prototype Solaris client similar to the one that exposed the problem.
=20
=20= renamed from net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0
b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
net/sunrpc/xprtrdma/svc_rdma_backchannel.c static int svc_rdma_bc_sendto(struct svcxprt_rdma =
Quoted 4 lines
index ec37ad8..1854db2 100644
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0@@ -132,6 +132,10 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma =
*rdma,
net/sunrpc/xprtrdma/svc_rdma_backchannel.c static int svc_rdma_bc_sendto(struct svcxprt_rdma =
Quoted 11 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0if (ret) goto out_err;=20
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +4
-0+/* Bump page refcnt so Send completion doesn't release +* the rq_buffer before all retransmits are complete. +*/ +get_page (virt_to_page (rqst->rq_buffer));ret =3D svc_rdma_post_send_wr(rdma, ctxt, 1, 0); if (ret) goto out_unmap;net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0@@ -164,7 +168,6 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma =
*rdma,
net/sunrpc/xprtrdma/svc_rdma_backchannel.c static int svc_rdma_bc_sendto(struct svcxprt_rdma =
Quoted 8 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0return -EINVAL ; }=20
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-1-/* svc_rdma_sendto releases this page */ page =3D alloc_page(RPCRDMA_DEF_GFP); if (!page) return -ENOMEM;net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0@@ -183,6 +186,7 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma =
*rdma,
Quoted 10 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0{ struct rpc_rqst *rqst =3D task->tk_rqstp;=20
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +1
-0+put_page (virt_to_page (rqst->rq_buffer));kfree(rqst->rq_rbuffer); }=20
=20
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever
Quoted 63 lines · Chuck Lever
During each NFSv4 callback Call, an RDMA Send completion frees the page that contains the RPC Call message. If the upper layer determines that a retransmit is necessary, this is too soon.
One possible symptom: after a
GARBAGE_ARGSresponse an NFSv4.1 callback request, the following BUG fires on the NFS server:kernel: BUG: Bad page state in process kworker/0:2H pfn:7d3ce2
kernel: page:ffffea001f4f3880 count:-2 mapcount:0 mapping: (null) index:0x0
kernel: flags: 0x2fffff80000000()
kernel: raw:002fffff800000000000000000000000 0000000000000000 fffffffeffffffff
kernel: raw:dead000000000100dead0000000002000000000000000000 0000000000000000
kernel: page dumped because: nonzero_refcount
kernel: Modules linked in: ctsrpcsec_gss_krb5ocfs2_dlmfsocfs2_stack_o2cbocfs2_dlmocfs2_nodemanagerocfs2_stackgluerpcrdm aib_ipoibrdma_ucmib_ucmib_uverbsib_umadrdma_cmib_cmiw_cmx86_pkg_temp_thermalintel_powerclampcoretempkvm_intelkvm irqbypasscrct10dif_pclmulcrc32_pclmulghash_clmulni_intelpcbciTCO_wdtiTCO_vendor_supportaesni_intelcrypto_simdglue_helpercryptd pcspkrlpc_ichi2c_i801mei_memfd_coremei raid0 sg wmi ioatdmaipmi_siipmi_devintfipmi_msghandlershpchpacpi_power_meteracpi_padnfsdnfs_acllockdauth_rpcgssgrace sunrpcip_tablesxfs libcrc32cmlx4_enmlx4_ibmlx5_ibib_coresd_modsr_modcdrom astdrm_kms_helpersyscopyarea sysfillrect sysimgbltfb_sys_fopsttm ahcicrc32c_intellibahci drmmlx5_coreigb libatamlx4_coredcai2c_algo_biti2c_corenvme
kernel: ptpnvme_corepps_coredm_mirrordm_region_hashdm_logdm_moddax
kernel: CPU: 0 PID: 11495 Comm: kworker/0:2H Not tainted 4.14.0-rc3-00001-g577ce48 #811
kernel: Hardware name: Supermicro Super Server/X10SRL-F, BIOS 1.0c 09/09/2015
kernel: Workqueue: ib-comp-wqib_cq_poll_work[ib_core]
kernel: Call Trace:
kernel:dump_stack+0x62/0x80
kernel:bad_page+0xfe/0x11a
kernel:free_pages_check_bad+0x76/0x78
kernel:free_pcppages_bulk+0x364/0x441
kernel: ? ttwu_do_activate.isra.61+0x71/0x78
kernel:free_hot_cold_page+0x1c5/0x202
kernel:__put_page+0x2c/0x36
kernel:svc_rdma_put_context+0xd9/0xe4[rpcrdma]
kernel:svc_rdma_wc_send+0x50/0x98[rpcrdma]This issue exists all the way back to v4.5, but refactoring and code re-organization prevents this simple patch from applying to kernels older than v4.12. The fix is the same, however, if someone needs to backport it.
Reported-by Ben Coddington <[email protected]>Fixes 5d252f90a800 ('svcrdma: Add class for RDMA backwards ... ')Cc [email protected] # v4.12Signed-off-by Chuck Lever <[email protected]>--- net/sunrpc/xprtrdma/svc_rdma_backchannel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)Hi Ben, Jeff-
I was able to reproduce the problem here with a rigged Linux client. This is my proposed fix. Fix also tested with a prototype Solaris client similar to the one that exposed the problem.
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0
net/sunrpc/xprtrdma/svc_rdma_backchannel.c static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma, · line 138
Quoted 7 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +4
-0@@ -132,6 +132,10 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma,if (ret) goto out_err; +/* Bump page refcnt so Send completion doesn't release +* the rq_buffer before all retransmits are complete. +*/ +get_page (virt_to_page (rqst->rq_buffer));
Looks fairly reasonable, but is this enough? Could rq_buffer be larger than a page?
Quoted 20 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +1
-1ret =svc_rdma_post_send_wr (rdma, ctxt,1 ,0 );if (ret) goto out_unmap;@@ -164,7 +168,6 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma,return -EINVAL ; } -/* svc_rdma_sendto releases this page */ page =alloc_page (RPCRDMA_DEF_GFP );if (!page)return -ENOMEM ;@@ -183,6 +186,7 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma, {struct rpc_rqst *rqst = task->tk_rqstp; +put_page (virt_to_page (rqst->rq_buffer));kfree (rqst->rq_rbuffer); }
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 6 lines · Jeff Layton
=20
Quoted 2 lines · Chuck Lever
During each NFSv4 callback Call, an RDMA Send completion frees the page that contains the RPC Call message. If the upper layer =
determines
Quoted 7 lines
Quoted 7 lines
that a retransmit is necessary, this is too soon.
=20
One possible symptom: after aGARBAGE_ARGSresponse an NFSv4.1 callback request, the following BUG fires on the NFS server:
=20
kernel: BUG: Bad page state in process kworker/0:2H pfn:7d3ce2
kernel: page:ffffea001f4f3880 count:-2 mapcount:0 mapping: =
(null) index:0x0
Quoted 2 lines
Quoted 2 lines
kernel: flags: 0x2fffff80000000()
kernel: raw:002fffff800000000000000000000000 0000000000000000 =
fffffffeffffffff
Quoted 1 line
Quoted 1 line
kernel: raw:
dead000000000100dead0000000002000000000000000000 =
0000000000000000
Quoted 2 lines
Quoted 2 lines
kernel: page dumped because: nonzero
_refcount
kernel: Modules linked in: ctsrpcsec_gss_krb5ocfs2_dlmfs=
ocfs2_stack_o2cb ocfs2_dlm
Quoted 1 line
Quoted 1 line
ocfs2_nodemanagerocfs2_stackgluerpcrdm aib_ipoibrdma_ucmib_ucm=
ib_uverbs ib_umad
Quoted 1 line
Quoted 1 line
rdma_cmib_cmiw_cmx86_pkg_temp_thermalintel_powerclampcoretemp =
kvm_intel
Quoted 1 line
Quoted 1 line
kvm irqbypass
crct10dif_pclmulcrc32_pclmulghash_clmulni_intelpcbc =
iTCO_wdt
Quoted 1 line
Quoted 1 line
iTCO_vendor_supportaesni_intelcrypto_simdglue_helpercryptd pcspkr =
lpc_ich i2c_i801
Quoted 1 line
Quoted 1 line
mei_memfd_coremei raid0 sg wmi ioatdmaipmi_siipmi_devintf=
ipmi_msghandler shpchp
Quoted 1 line
Quoted 1 line
acpi_power_meteracpi_padnfsdnfs_acllockdauth_rpcgssgrace sunrpc =
ip_tables xfs
Quoted 1 line
Quoted 1 line
libcrc32c
mlx4_enmlx4_ibmlx5_ibib_coresd_modsr_modcdrom ast =
drm_kms_helper
Quoted 1 line
Quoted 1 line
syscopyarea sysfillrect sysimgblt
fb_sys_fopsttm ahcicrc32c_intel=
libahci drm
Quoted 2 lines
Quoted 2 lines
mlx5_coreigb libatamlx4_coredcai2c_algo_biti2c_corenvme
kernel: ptpnvme_corepps_coredm_mirrordm_region_hashdm_logdm_mod=
dax
Quoted 1 line
Quoted 1 line
kernel: CPU: 0 PID: 11495 Comm: kworker/0:2H Not tainted =
4.14.0-rc3-00001-g577ce48 #811
Quoted 1 line
Quoted 1 line
kernel: Hardware name: Supermicro Super Server/X10SRL-F, BIOS 1.0c =
09/09/2015
Quoted 25 lines
Quoted 25 lines
kernel: Workqueue: ib-comp-wq
ib_cq_poll_work[ib_core]
kernel: Call Trace:
kernel:dump_stack+0x62/0x80
kernel:bad_page+0xfe/0x11a
kernel:free_pages_check_bad+0x76/0x78
kernel:free_pcppages_bulk+0x364/0x441
kernel: ? ttwu_do_activate.isra.61+0x71/0x78
kernel:free_hot_cold_page+0x1c5/0x202
kernel:__put_page+0x2c/0x36
kernel:svc_rdma_put_context+0xd9/0xe4[rpcrdma]
kernel:svc_rdma_wc_send+0x50/0x98[rpcrdma]
=20
This issue exists all the way back to v4.5, but refactoring and code re-organization prevents this simple patch from applying to kernels older than v4.12. The fix is the same, however, if someone needs to backport it.
=20Reported-by Ben Coddington <[email protected]>Fixes 5d252f90a800 ('svcrdma: Add class for RDMA backwards ... ')Cc [email protected] # v4.12Signed-off-by Chuck Lever <[email protected]>---
net/sunrpc/xprtrdma/svc_rdma_backchannel.c| 6 +++++-1 file changed, 5 insertions(+), 1 deletion(-)=20
Quoted 8 lines
=
Quoted 8 lines
Hi Ben, Jeff-
=20
I was able to reproduce the problem here with a rigged Linux client. This is my proposed fix. Fix also tested with a prototype Solaris client similar to the one that exposed the problem.
=20
=20= renamed from net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0
b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
Quoted 4 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c static int svc_rdma_bc_sendto(struct =
Quoted 4 lines
index ec37ad8..1854db2 100644
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0@@ -132,6 +132,10 @@ static int svc_rdma_bc_sendto(struct =
svcxprt_rdma *rdma,
Quoted 10 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma, · line 138
Quoted 7 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0if (ret) goto out_err;=20
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +4
-0+/* Bump page refcnt so Send completion doesn't release +* the rq_buffer before all retransmits are complete. +*/ +get_page (virt_to_page (rqst->rq_buffer));=20
Looks fairly reasonable, but is this enough? Couldrq_bufferbe larger than a page?
Not in the current implementation. See xprt_rdma_bc_allocate.
Thanks for the review!
Quoted 4 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c static int svc_rdma_bc_sendto(struct svcxprt_rdma =
Quoted 4 lines
ret =3D svc_rdma_post_send_wr(rdma, ctxt, 1, 0); if (ret) goto out_unmap;net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0@@ -164,7 +168,6 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma =
*rdma,
Quoted 8 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c static int svc_rdma_bc_sendto(struct svcxprt_rdma =
Quoted 8 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0return -EINVAL ; }=20
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-1-/* svc_rdma_sendto releases this page */ page =3D alloc_page(RPCRDMA_DEF_GFP); if (!page) return -ENOMEM;net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0@@ -183,6 +186,7 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma =
*rdma,
Quoted 5 lines
Quoted 5 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0{ struct rpc_rqst *rqst =3D task->tk_rqstp;=20
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +1
-0+put_page (virt_to_page (rqst->rq_buffer));kfree(rqst->rq_rbuffer);
Quoted 8 lines
Quoted 3 lines
}
=20
=20=20
--=20
Jeff Layton <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever
Jeff Layton
Reviewed-byQuoted 77 lines · Chuck Lever
Quoted 69 lines · Jeff Layton
Quoted 66 lines · Chuck Lever
During each NFSv4 callback Call, an RDMA Send completion frees the page that contains the RPC Call message. If the upper layer determines that a retransmit is necessary, this is too soon.
One possible symptom: after a
GARBAGE_ARGSresponse an NFSv4.1 callback request, the following BUG fires on the NFS server:kernel: BUG: Bad page state in process kworker/0:2H pfn:7d3ce2
kernel: page:ffffea001f4f3880 count:-2 mapcount:0 mapping: (null) index:0x0
kernel: flags: 0x2fffff80000000()
kernel: raw:002fffff800000000000000000000000 0000000000000000 fffffffeffffffff
kernel: raw:dead000000000100dead0000000002000000000000000000 0000000000000000
kernel: page dumped because: nonzero_refcount
kernel: Modules linked in: ctsrpcsec_gss_krb5ocfs2_dlmfsocfs2_stack_o2cbocfs2_dlmocfs2_nodemanagerocfs2_stackgluerpcrdm aib_ipoibrdma_ucmib_ucmib_uverbsib_umadrdma_cmib_cmiw_cmx86_pkg_temp_thermalintel_powerclampcoretempkvm_intelkvm irqbypasscrct10dif_pclmulcrc32_pclmulghash_clmulni_intelpcbciTCO_wdtiTCO_vendor_supportaesni_intelcrypto_simdglue_helpercryptd pcspkrlpc_ichi2c_i801mei_memfd_coremei raid0 sg wmi ioatdmaipmi_siipmi_devintfipmi_msghandlershpchpacpi_power_meteracpi_padnfsdnfs_acllockdauth_rpcgssgrace sunrpcip_tablesxfs libcrc32cmlx4_enmlx4_ibmlx5_ibib_coresd_modsr_modcdrom astdrm_kms_helpersyscopyarea sysfillrect sysimgbltfb_sys_fopsttm ahcicrc32c_intellibahci drmmlx5_coreigb libatamlx4_coredcai2c_algo_biti2c_corenvme
kernel: ptpnvme_corepps_coredm_mirrordm_region_hashdm_logdm_moddax
kernel: CPU: 0 PID: 11495 Comm: kworker/0:2H Not tainted 4.14.0-rc3-00001-g577ce48 #811
kernel: Hardware name: Supermicro Super Server/X10SRL-F, BIOS 1.0c 09/09/2015
kernel: Workqueue: ib-comp-wqib_cq_poll_work[ib_core]
kernel: Call Trace:
kernel:dump_stack+0x62/0x80
kernel:bad_page+0xfe/0x11a
kernel:free_pages_check_bad+0x76/0x78
kernel:free_pcppages_bulk+0x364/0x441
kernel: ? ttwu_do_activate.isra.61+0x71/0x78
kernel:free_hot_cold_page+0x1c5/0x202
kernel:__put_page+0x2c/0x36
kernel:svc_rdma_put_context+0xd9/0xe4[rpcrdma]
kernel:svc_rdma_wc_send+0x50/0x98[rpcrdma]This issue exists all the way back to v4.5, but refactoring and code re-organization prevents this simple patch from applying to kernels older than v4.12. The fix is the same, however, if someone needs to backport it.
Reported-by Ben Coddington <[email protected]>Fixes 5d252f90a800 ('svcrdma: Add class for RDMA backwards ... ')Cc [email protected] # v4.12Signed-off-by Chuck Lever <[email protected]>---
net/sunrpc/xprtrdma/svc_rdma_backchannel.c| 6 +++++-1 file changed, 5 insertions(+), 1 deletion(-)Hi Ben, Jeff-
I was able to reproduce the problem here with a rigged Linux client. This is my proposed fix. Fix also tested with a prototype Solaris client similar to the one that exposed the problem.
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-0@@ -132,6 +132,10 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma,if (ret) goto out_err;Quoted 7 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma, · line 138
Quoted 4 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +4
-0+/* Bump page refcnt so Send completion doesn't release +* the rq_buffer before all retransmits are complete. +*/ +get_page (virt_to_page (rqst->rq_buffer));Looks fairly reasonable, but is this enough? Could
rq_bufferbe larger than a page?
Quoted 4 lines
Not in the current implementation. See
xprt_rdma_bc_allocate.Thanks for the review!
No problem.
Quoted 29 lines
Quoted 16 lines
Quoted 16 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +0
-1ret =svc_rdma_post_send_wr (rdma, ctxt,1 ,0 );if (ret) goto out_unmap;@@ -164,7 +168,6 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma,return -EINVAL ; } -/* svc_rdma_sendto releases this page */ page =alloc_page (RPCRDMA_DEF_GFP );if (!page)return -ENOMEM ;@@ -183,6 +186,7 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma, {struct rpc_rqst *rqst = task->tk_rqstp;Quoted 12 lines
Quoted 5 lines
net/sunrpc/xprtrdma/svc_rdma_backchannel.c +1
-0+put_page (virt_to_page (rqst->rq_buffer));kfree (rqst->rq_rbuffer); }Signature · 5 lines
Jeff Layton <[email protected]> -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines
--
Chuck Lever
Might be worth making sure the thing isn't larger than a page with a WARN_ON, or at least a comment in there in case that ever changes. Otherwise, I think this is fine: