Page MenuHomeFreeBSD

[PR 206224] bv_cnt is sometimes examined without holding the bufobj lock
ClosedPublic

Authored by rpokala on Jan 14 2016, 4:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 15 2024, 7:10 AM
Unknown Object (File)
Nov 10 2024, 7:46 PM
Unknown Object (File)
Oct 31 2024, 11:33 PM
Unknown Object (File)
Oct 22 2024, 12:21 PM
Unknown Object (File)
Oct 18 2024, 10:01 PM
Unknown Object (File)
Oct 9 2024, 6:34 AM
Unknown Object (File)
Oct 2 2024, 2:06 PM
Unknown Object (File)
Sep 29 2024, 5:23 PM
Subscribers

Details

Summary

Add locking around accesses to bv_cnt which are currently being done unlocked.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rpokala retitled this revision from to [PR 206224] bv_cnt is sometimes examined without holding the bufobj lock.
rpokala updated this object.
rpokala edited the test plan for this revision. (Show Details)
rpokala set the repository for this revision to rS FreeBSD src repository - subversion.

I do not want to read nandfs code to see of there is any more issues than just bv_cnt.

sys/fs/nfsclient/nfs_clvfsops.c
1655 ↗(On Diff #12286)

I do not see what this change changes. The access is single read, which is atomic on itself. Assuming that bv_cnt is protected by bufobj lock, the test might become invalid immediately after the lock is dropped.

I.e. the original and patched versions have equiv races and guarantees, except that the patched version adds locking overhead.

sys/kern/vfs_default.c
1214 ↗(On Diff #12286)

Same comment there.

rpokala edited edge metadata.

kib pointed out that the changes to nfs_clvfsops.c and vfs_default.c are unnecessary; revert them.

imp added a reviewer: imp.

There's other, much more heinous locking issues with nandfs. However, that doesn't make this any less legit. Go for it.

This revision is now accepted and ready to land.Jan 15 2016, 10:54 PM
This revision was automatically updated to reflect the committed changes.