Skip to contentSkip to conversation

9p/xen: fix init sequence

PATCH Applied Alexander Merritt 3 participants 4 messages Nov 19, 2024 – Nov 21, 2024 9P file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 9p/xen: fix init sequence

From: Alex Zenla <[email protected]>

Large amount of mount hangs observed during hotplugging of 9pfs devices. The 9pfs Xen driver attempts to initialize itself more than once, causing the frontend and backend to disagree: the backend listens on a channel that the frontend does not send on, resulting in stalled processing.

Only allow initialization of 9p frontend once.

Fixes c15fe55d14b3b ("9p/xen: fix connection sequence")
---
 net/9p/trans_xen.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
net/9p/trans_xen.c +5 -2
index dfdbe1ca5338..0304e8a1616d 100644
@@ -465,6 +465,7 @@ static int xen_9pfs_front_init(struct xenbus_device *dev)
 		goto error;
 	}
 
+	xenbus_switch_state(dev, XenbusStateInitialised);
 	return 0;
 
  error_xenbus:
@@ -512,8 +513,10 @@ static void xen_9pfs_front_changed(struct xenbus_device *dev,
 		break;
 
 	case XenbusStateInitWait:
-		if (!xen_9pfs_front_init(dev))
-			xenbus_switch_state(dev, XenbusStateInitialised);
+		if (dev->state != XenbusStateInitialising)
+			break;
+
+		xen_9pfs_front_init(dev);
 		break;
 
 	case XenbusStateConnected:
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Alexander Merritt

From: Alex Zenla <[email protected]>

Large amount of mount hangs observed during hotplugging of 9pfs devices. The 9pfs Xen driver attempts to initialize itself more than once, causing the frontend and backend to disagree: the backend listens on a channel that the frontend does not send on, resulting in stalled processing.

Quoted 6 lines

Only allow initialization of 9p frontend once.

Fixes c15fe55d14b3b ("9p/xen: fix connection sequence")

Juergen

maintainer Applied
#2 lore raw
In reply to Alexander Merritt

Alexander Merritt wrote on Tue, Nov 19, 2024 at 09:16:33PM +0000:

Quoted 8 lines

From: Alex Zenla <[email protected]>

Large amount of mount hangs observed during hotplugging of 9pfs devices. The 9pfs Xen driver attempts to initialize itself more than once, causing the frontend and backend to disagree: the backend listens on a channel that the frontend does not send on, resulting in stalled processing.

Only allow initialization of 9p frontend once.

I'm not familiar with the xen bringup so I don't understand how the patch guarantees this -- otherend_changed calls are guaranted to be seralized for a given frontend?
I guess that at least it guaratees that we won't restart the init process after init's been done on our side and before the remote side sends the ack, so if you've all tested this I'll just trust you and Juergen's review and take it as an improvement.

Queued to 9p-next; will send this to Linus in ~1week

Thanks!

Signature · 1 line
Dominique
#3 lore raw
Quoted 8 lines · Dominique Martinet

Alexander Merritt wrote on Tue, Nov 19, 2024 at 09:16:33PM +0000:

Quoted 7 lines

From: Alex Zenla <[email protected]>

Large amount of mount hangs observed during hotplugging of 9pfs devices. The 9pfs Xen driver attempts to initialize itself more than once, causing the frontend and backend to disagree: the backend listens on a channel that the frontend does not send on, resulting in stalled processing.

Quoted 5 lines
Quoted 1 line

Only allow initialization of 9p frontend once.

I'm not familiar with the xen bringup so I don't understand how the patch guarantees this -- otherend_changed calls are guaranted to be seralized for a given frontend?

Yes. They are all executed by a single kernel thread.

Juergen