Page MenuHomeFreeBSD

VOP_VPUT_PAIR(): handle the case when dvp == vp
ClosedPublic

Authored by kib on Wed, Jun 24, 6:23 PM.
Tags
None
Referenced Files
F160878270: D57824.id180768.diff
Sun, Jun 28, 3:47 PM
F160875663: D57824.id180791.diff
Sun, Jun 28, 3:32 PM
F160875609: D57824.id180791.diff
Sun, Jun 28, 3:32 PM
Unknown Object (File)
Sat, Jun 27, 7:14 PM
Unknown Object (File)
Fri, Jun 26, 4:46 PM
Unknown Object (File)
Fri, Jun 26, 1:54 PM
Unknown Object (File)
Fri, Jun 26, 12:12 PM
Unknown Object (File)
Fri, Jun 26, 8:33 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Wed, Jun 24, 6:23 PM
kib retitled this revision from ffs_vput_pair(): handle the case when dvp == vp to VOP_VPUT_PAIR(): handle the case when dvp == vp.

Also handle in the default implementation

sys/ufs/ffs/ffs_vnops.c
2008–2009

Don't you also need to check here?

Is there some situation in which we expect dvp and vp to be the same, without the caller taking steps to avoid using VOP_VPUT_PAIR() in the first place?

kib marked an inline comment as done.Wed, Jun 24, 10:36 PM
In D57824#1325771, @jah wrote:

Is there some situation in which we expect dvp and vp to be the same, without the caller taking steps to avoid using VOP_VPUT_PAIR() in the first place?

I hope that no, there is no such case. I wanted to use VOP_VPUT_PAIR() in some path for the RENAME_EXCHANGE path but it requires more generic behavior.

Handle one more return place for dvp == vp.

sys/kern/vfs_default.c
1643–1644

What should the VOP do if unlock_vp is false and vp == dvp? Right now we're unconditionally unlocking it.

kib marked an inline comment as done.

Clean up the case dvp == vp && !unlock_vp.
Add comment to vop_stdvput_pair() explaining the intent.
Change vrele() to vunref() for locked vnode, but it should be nop since there must be one more use reference.

This revision is now accepted and ready to land.Thu, Jun 25, 11:19 PM
sys/kern/vfs_default.c
1634

The comment doesn't seem to match the code in the !unlock_vp case: in that case we release only one reference.

kib marked an inline comment as done.Fri, Jun 26, 5:03 PM
kib added inline comments.
sys/kern/vfs_default.c
1634

Yes, if !unlock_vp, I release a single reference. But isn't this what the comment says?

markj added inline comments.
sys/kern/vfs_default.c
1634

I guess I find the comment confusing: it says "the VOP assumes that two references on the vnode", but in this special case we only release one of them.

kib marked 2 inline comments as done.

Expand the comment to hopefully make it more clear.

This revision now requires review to proceed.Fri, Jun 26, 5:19 PM
This revision was not accepted when it landed; it landed in state Needs Review.Fri, Jun 26, 9:46 PM
This revision was automatically updated to reflect the committed changes.