Page MenuHomeFreeBSD

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

Authored by kib on Wed, Jun 24, 6:23 PM.
Tags
None
Referenced Files
F160676843: D57824.id.diff
Fri, Jun 26, 4:46 PM
F160659808: D57824.diff
Fri, Jun 26, 1:54 PM
F160651330: D57824.id180574.diff
Fri, Jun 26, 12:12 PM
F160630773: D57824.diff
Fri, Jun 26, 8:33 AM
F160599705: D57824.diff
Fri, Jun 26, 1:51 AM
F160568490: D57824.diff
Thu, Jun 25, 6:51 PM
Unknown Object (File)
Thu, Jun 25, 4:08 PM
Unknown Object (File)
Thu, Jun 25, 5:44 AM
Subscribers

Details

Reviewers
jah
markj
mckusick

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
2012

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
1633–1634

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
1635

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
1635

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