From: sagi@grimberg.me (Sagi Grimberg) Date: Thu, 29 Jun 2017 08:35:21 +0300 Subject: Unexpected issues with 2 NVME initiators using the same target In-Reply-To: <7D1C540B-FEA0-4101-8B58-87BCB7DB5492@oracle.com> References: <20170620074639.GP17846@mtr-leonro.local> <1c706958-992e-b104-6bae-4a6616c0a9f9@grimberg.me> <20170620083309.GQ17846@mtr-leonro.local> <614481c7-22dd-d93b-e97e-52f868727ec3@grimberg.me> <59FF0C04-2BFB-4F66-81BA-A598A9A087FC@oracle.com> <20170620173532.GA827@obsidianresearch.com> <20170620192742.GB827@obsidianresearch.com> <20170620211958.GA5574@obsidianresearch.com> <4f0812f1-0067-4e63-e383-b913ee1f319d@grimberg.me> <28F6F58E-B6F4-4114-8DFF-B72353CE814B@oracle.com> <52ad3547-efcf-f428-6b39-117efda3379f@grimberg.me> <9990B5CB-E0FF-481E-9F34-21EACF0E796E@oracle.com> <7D1C540B-FEA0-4101-8B58-87BCB7DB5492@oracle.com> Message-ID: <66b1b8be-e506-50b8-c01f-fa0e3cea98a4@grimberg.me> >> How do you know when that happens? > > The RPC Call send path sets up the Send SGE array. If it includes > page cache pages, it can set IB_SEND_SIGNALED. > > The SGE array and the ib_cqe for the send are in the same data > structure, so the Send completion handler can find the SGE array > and figure out what needs to be unmapped. > > The only problem is if a POSIX signal fires. In that case the > data structure can be released before the Send completion fires, > and we get touch-after-free in the completion handler. > > I'm thinking that it just isn't going to be practical to handle > unmapping this way, and I should just revert back to using RDMA > Read instead of adding page cache pages to the Send SGE. Or wait for the send completion before completing the I/O?