On Sun, May 18, 2025 at 10:32:17PM -0700, Christoph Hellwig wrote: > On Fri, May 16, 2025 at 12:06:21PM -0400, Benjamin Marzinski wrote: > > I've run into SCSI arrays that always act like they were called with the > > ALL_TG_PT flag set (or perhaps they were just configured that way, I > > never could get a straight answer about that). > > Hmm, that's pretty strange. > > > libmpathpersist accepts > > this flag, and only sends one registration per initiator & target device > > when it's set, instead of one per initator & target port. > > With "this flag" you mean ALL_TG_PT?
Yes. > > > dm-multipath > > currently doesn't have the knowledge necessary to figure out which > > devices it needs to send reservations to, even if the kernel PR API > > supported this. > > > > But I supposed it could just send the registration normally down one > > path and if that works, it could just ignore the existing key when it > > sends the registration down all the other paths. > > We could add support for a similar flag to the kernel PR API. The > problem is to figure out how to discover support for it. What does > the library do for that currently? > libmpathpersist knows which scsi path devices map to the same Initiator, but different target ports. When ALL_TG_PT is set, it only sends one registration command to each group, instead of sending one to each path device (like when ALL_TG_TP isn't set). If it sent a registration to every SCSI device on these arrays that act like ALL_TG_PT is always set, it would get reservation conflicts when sending the command to devices using ports after the first, since they would already have a registered key. That's why I mentioned the posibility of using Register and Ignore, which doesn't care if there's a key already registered. I don't think it would take much work for the Kernel API to support ALL_TG_PT, if the SCSI implementation just passed the flag down to the device. The problem really only exists for things like dm-multipath, that are composed of a number of different devices that all point to the same underlying Target LUN. To handle this without relying on something like Register and Ignore, It would need to be able to group all the devices that come from the same initiator but different target ports together, and only send a registration to one device per group. This takes more SCSI specific knowledge than it currently has, or really wants to have. -Ben