From: Li Zetao <lizetao1@huawei.com> To: <lizetao1@huawei.com> Cc: <st@redhat.com>, <jasowang@redhat.com>, <pbonzini@redhat.com>, <stefanha@redhat.com>, <axboe@kernel.dk>, <airlied@redhat.com>, <kraxel@redhat.com>, <gurchetansingh@chromium.org>, <olvaffe@gmail.com>, <daniel@ffwll.ch>, <david@redhat.com>, <ericvh@gmail.com>, <lucho@ionkov.net>, <asmadeus@codewreck.org>, <linux_oss@crudebyte.com>, <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <pmorel@linux.vnet.ibm.com>, <cornelia.huck@de.ibm.com>, <pankaj.gupta.linux@gmail.com>, <rusty@rustcorp.com.au>, <airlied@gmail.com>, <virtualization@lists.linux-foundation.org>, <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <dri-devel@lists.freedesktop.org>, <v9fs-developer@lists.sourceforge.net>, <netdev@vger.kernel.org> Subject: [PATCH v2 1/5] 9p: Fix probe failed when modprobe 9pnet_virtio Date: Wed, 30 Nov 2022 00:06:11 +0800 [thread overview] Message-ID: <20221129160615.3343036-2-lizetao1@huawei.com> (raw) In-Reply-To: <20221129160615.3343036-1-lizetao1@huawei.com> When doing the following test steps, an error was found: step 1: modprobe 9pnet_virtio succeeded # modprobe 9pnet_virtio <-- OK step 2: fault injection in sysfs_create_file() # modprobe -r 9pnet_virtio <-- OK # ... FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 3790 Comm: modprobe Tainted: G W 6.1.0-rc6-00285-g6a1e40c4b995-dirty #108 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) Call Trace: <TASK> ... should_failslab+0xa/0x20 ... sysfs_create_file_ns+0x130/0x1d0 p9_virtio_probe+0x662/0xb30 [9pnet_virtio] virtio_dev_probe+0x608/0xae0 ... </TASK> 9pnet_virtio: probe of virtio3 failed with error -12 step 3: modprobe 9pnet_virtio failed # modprobe 9pnet_virtio <-- failed 9pnet_virtio: probe of virtio3 failed with error -2 The root cause of the problem is that the virtqueues are not stopped on the error handling path when sysfs_create_file() fails in p9_virtio_probe(), resulting in an error "-ENOENT" returned in the next modprobe call in setup_vq(). virtio_pci_modern_device uses virtqueues to send or receive message, and "queue_enable" records whether the queues are available. In vp_modern_find_vqs(), all queues will be selected and activated, but once queues are enabled there is no way to go back except reset. Fix it by reset virtio device on error handling path. After virtio_find_single_vq() succeeded, all virtqueues should be stopped on error handling path. Fixes: ea52bf8eda98 ("9p/trans_virtio: reset virtio device on remove") Signed-off-by: Li Zetao <lizetao1@huawei.com> Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com> --- v1 -> v2: modify the description error of the test case in step 3 and modify the fixes tag information. net/9p/trans_virtio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index e757f0601304..39933187284b 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -668,6 +668,7 @@ static int p9_virtio_probe(struct virtio_device *vdev) out_free_tag: kfree(tag); out_free_vq: + virtio_reset_device(vdev); vdev->config->del_vqs(vdev); out_free_chan: kfree(chan); -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Li Zetao <lizetao1@huawei.com> To: <lizetao1@huawei.com> Cc: lucho@ionkov.net, david@redhat.com, jasowang@redhat.com, linux_oss@crudebyte.com, pmorel@linux.vnet.ibm.com, dri-devel@lists.freedesktop.org, gurchetansingh@chromium.org, edumazet@google.com, kraxel@redhat.com, kuba@kernel.org, pabeni@redhat.com, asmadeus@codewreck.org, st@redhat.com, ericvh@gmail.com, rusty@rustcorp.com.au, linux-block@vger.kernel.org, v9fs-developer@lists.sourceforge.net, stefanha@redhat.com, airlied@redhat.com, cornelia.huck@de.ibm.com, virtualization@lists.linux-foundation.org, axboe@kernel.dk, pankaj.gupta.linux@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, davem@davemloft.net Subject: [PATCH v2 1/5] 9p: Fix probe failed when modprobe 9pnet_virtio Date: Wed, 30 Nov 2022 00:06:11 +0800 [thread overview] Message-ID: <20221129160615.3343036-2-lizetao1@huawei.com> (raw) In-Reply-To: <20221129160615.3343036-1-lizetao1@huawei.com> When doing the following test steps, an error was found: step 1: modprobe 9pnet_virtio succeeded # modprobe 9pnet_virtio <-- OK step 2: fault injection in sysfs_create_file() # modprobe -r 9pnet_virtio <-- OK # ... FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 3790 Comm: modprobe Tainted: G W 6.1.0-rc6-00285-g6a1e40c4b995-dirty #108 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) Call Trace: <TASK> ... should_failslab+0xa/0x20 ... sysfs_create_file_ns+0x130/0x1d0 p9_virtio_probe+0x662/0xb30 [9pnet_virtio] virtio_dev_probe+0x608/0xae0 ... </TASK> 9pnet_virtio: probe of virtio3 failed with error -12 step 3: modprobe 9pnet_virtio failed # modprobe 9pnet_virtio <-- failed 9pnet_virtio: probe of virtio3 failed with error -2 The root cause of the problem is that the virtqueues are not stopped on the error handling path when sysfs_create_file() fails in p9_virtio_probe(), resulting in an error "-ENOENT" returned in the next modprobe call in setup_vq(). virtio_pci_modern_device uses virtqueues to send or receive message, and "queue_enable" records whether the queues are available. In vp_modern_find_vqs(), all queues will be selected and activated, but once queues are enabled there is no way to go back except reset. Fix it by reset virtio device on error handling path. After virtio_find_single_vq() succeeded, all virtqueues should be stopped on error handling path. Fixes: ea52bf8eda98 ("9p/trans_virtio: reset virtio device on remove") Signed-off-by: Li Zetao <lizetao1@huawei.com> Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com> --- v1 -> v2: modify the description error of the test case in step 3 and modify the fixes tag information. net/9p/trans_virtio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index e757f0601304..39933187284b 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -668,6 +668,7 @@ static int p9_virtio_probe(struct virtio_device *vdev) out_free_tag: kfree(tag); out_free_vq: + virtio_reset_device(vdev); vdev->config->del_vqs(vdev); out_free_chan: kfree(chan); -- 2.25.1
next prev parent reply other threads:[~2022-11-29 15:18 UTC|newest] Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-28 2:10 [PATCH 0/4] Fix probe failed when modprobe modules Li Zetao 2022-11-28 2:10 ` [PATCH 1/4] 9p: Fix probe failed when modprobe 9pnet_virtio Li Zetao 2022-11-28 14:27 ` Christian Schoenebeck 2022-11-28 2:10 ` [PATCH 2/4] virtio-mem: Fix probe failed when modprobe virtio_mem Li Zetao 2022-11-28 8:22 ` David Hildenbrand 2022-11-28 8:22 ` David Hildenbrand 2022-11-28 2:10 ` [PATCH 3/4] virtio-input: Fix probe failed when modprobe virtio_input Li Zetao 2022-11-28 9:29 ` Michael S. Tsirkin 2022-11-28 9:29 ` Michael S. Tsirkin 2022-11-28 2:10 ` [PATCH 4/4] virtio-blk: Fix probe failed when modprobe virtio_blk Li Zetao 2022-11-28 10:14 ` [PATCH 0/4] Fix probe failed when modprobe modules Michael S. Tsirkin 2022-11-28 10:14 ` Michael S. Tsirkin 2022-11-29 3:37 ` Jason Wang 2022-11-29 3:37 ` Jason Wang 2022-12-19 10:15 ` Michael S. Tsirkin 2022-12-19 10:15 ` Michael S. Tsirkin 2022-12-20 6:44 ` Jason Wang 2022-12-20 6:44 ` Jason Wang 2023-01-27 11:11 ` Michael S. Tsirkin 2023-01-27 11:11 ` Michael S. Tsirkin 2023-01-29 5:50 ` Jason Wang 2023-01-29 5:50 ` Jason Wang 2022-11-29 16:06 ` [PATCH v2 0/5] " Li Zetao 2022-11-29 16:06 ` Li Zetao 2022-11-29 16:06 ` Li Zetao [this message] 2022-11-29 16:06 ` [PATCH v2 1/5] 9p: Fix probe failed when modprobe 9pnet_virtio Li Zetao 2022-11-29 16:06 ` [PATCH v2 2/5] virtio-mem: Fix probe failed when modprobe virtio_mem Li Zetao 2022-11-29 16:06 ` Li Zetao 2022-11-29 16:06 ` [PATCH v2 3/5] virtio-input: Fix probe failed when modprobe virtio_input Li Zetao 2022-11-29 16:06 ` Li Zetao 2022-11-29 16:06 ` [PATCH v2 4/5] virtio-blk: Fix probe failed when modprobe virtio_blk Li Zetao 2022-11-29 16:06 ` Li Zetao 2022-11-29 16:06 ` [PATCH v2 5/5] drm/virtio: Fix probe failed when modprobe virtio_gpu Li Zetao 2022-11-29 16:06 ` Li Zetao 2022-11-29 17:08 ` [PATCH v2 0/5] Fix probe failed when modprobe modules Jens Axboe 2022-11-29 17:08 ` Jens Axboe 2022-11-29 17:08 ` Jens Axboe
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221129160615.3343036-2-lizetao1@huawei.com \ --to=lizetao1@huawei.com \ --cc=airlied@gmail.com \ --cc=airlied@redhat.com \ --cc=asmadeus@codewreck.org \ --cc=axboe@kernel.dk \ --cc=cornelia.huck@de.ibm.com \ --cc=daniel@ffwll.ch \ --cc=davem@davemloft.net \ --cc=david@redhat.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=edumazet@google.com \ --cc=ericvh@gmail.com \ --cc=gurchetansingh@chromium.org \ --cc=jasowang@redhat.com \ --cc=kraxel@redhat.com \ --cc=kuba@kernel.org \ --cc=linux-block@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux_oss@crudebyte.com \ --cc=lucho@ionkov.net \ --cc=netdev@vger.kernel.org \ --cc=olvaffe@gmail.com \ --cc=pabeni@redhat.com \ --cc=pankaj.gupta.linux@gmail.com \ --cc=pbonzini@redhat.com \ --cc=pmorel@linux.vnet.ibm.com \ --cc=rusty@rustcorp.com.au \ --cc=st@redhat.com \ --cc=stefanha@redhat.com \ --cc=v9fs-developer@lists.sourceforge.net \ --cc=virtualization@lists.linux-foundation.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.