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)
Fri, Apr 26, 12:40 AM
Unknown Object (File)
Thu, Apr 25, 11:28 PM
Unknown Object (File)
Thu, Apr 25, 11:28 PM
Unknown Object (File)
Thu, Apr 25, 2:43 PM
Unknown Object (File)
Thu, Apr 25, 10:27 AM
Unknown Object (File)
Sun, Apr 21, 7:46 PM
Unknown Object (File)
Mar 24 2024, 6:11 PM
Unknown Object (File)
Mar 1 2024, 5:44 AM
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.