Skip to contentSkip to conversation

cephfs inode size handling and inode_drop field in struct MetaRequest

DISCUSSION Jeff Layton 2 participants 3 messages Oct 29, 2020 – Nov 3, 2020

lore
Share & tools
lore
#0 lore raw

I'm working on a F_SETLEASE implementation for kcephfs, and am hitting a deadlock of sorts, due to a truncate triggering a cap revoke at an inopportune time.

The issue is that truncates to a smaller size are always done via synchronous call to the MDS, whereas a truncate larger does not if Fx caps are held. That synchronous call causes the MDS to issue the client a cap revoke for caps that the lease holds references on (Frw, in particular).

The client code has been this way since the inception and I haven't been able to locate any rationale for it. Some questions about this:

1) Why doesn't the client ever buffer a truncate to smaller size? It seems like that is something that could be done without a synchronous MDS call if we hold Fx caps.

2) The client setattr implementations set inode_drop values in the MetaRequest, but as far as I can tell, those values end up being ignored by the MDS. What purpose does inode_drop actually serve? Is this field vestigial?

Thanks,

Signature · 1 line
Jeff Layton <[email protected]>
#1 lore raw
Quoted 13 lines · Jeff Layton

I'm working on a F_SETLEASE implementation for kcephfs, and am hitting a deadlock of sorts, due to a truncate triggering a cap revoke at an inopportune time.

The issue is that truncates to a smaller size are always done via synchronous call to the MDS, whereas a truncate larger does not if Fx caps are held. That synchronous call causes the MDS to issue the client a cap revoke for caps that the lease holds references on (Frw, in particular).

The client code has been this way since the inception and I haven't been able to locate any rationale for it. Some questions about this:

Quoted 8 lines

1) Why doesn't the client ever buffer a truncate to smaller size? It seems like that is something that could be done without a synchronous MDS call if we hold Fx caps.

2) The client setattr implementations set inode_drop values in the MetaRequest, but as far as I can tell, those values end up being ignored by the MDS. What purpose does inode_drop actually serve? Is this field vestigial?

I think I answered the second question myself. It _is_ potentially used to encoded a cap release into the call. That's not happening here because of the extra references held by the lease. I think I see a couple of potential fixes for that problem.

I think the first question is still valid though.

Signature · 1 line
Jeff Layton <[email protected]>
#2 lore raw
Quoted 12 lines · Jeff Layton
Quoted 10 lines · Jeff Layton

I'm working on a F_SETLEASE implementation for kcephfs, and am hitting a deadlock of sorts, due to a truncate triggering a cap revoke at an inopportune time.

The issue is that truncates to a smaller size are always done via synchronous call to the MDS, whereas a truncate larger does not if Fx caps are held. That synchronous call causes the MDS to issue the client a cap revoke for caps that the lease holds references on (Frw, in particular).

Quoted 7 lines
Quoted 7 lines

The client code has been this way since the inception and I haven't been able to locate any rationale for it. Some questions about this:

1) Why doesn't the client ever buffer a truncate to smaller size? It seems like that is something that could be done without a synchronous MDS call if we hold Fx caps.

because we need to increate truncate_seq. truncate_seq makes OSD drop/adjust write operation that were sent before the truncate.

Quoted 15 lines
Quoted 4 lines

2) The client setattr implementations set inode_drop values in the MetaRequest, but as far as I can tell, those values end up being ignored by the MDS. What purpose does inode_drop actually serve? Is this field vestigial?

I think I answered the second question myself. It _is_ potentially used to encoded a cap release into the call. That's not happening here because of the extra references held by the lease. I think I see a couple of potential fixes for that problem.

I think the first question is still valid though.
--
Jeff Layton <[email protected]>