Page MenuHomeFreeBSD

Prevent g_access calls to bad multipath members
ClosedPublic

Authored by smh on Dec 7 2015, 4:18 AM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 18 2024, 12:07 AM
Unknown Object (File)
Oct 2 2024, 6:36 PM
Unknown Object (File)
Oct 2 2024, 4:50 PM
Unknown Object (File)
Oct 2 2024, 2:16 PM
Unknown Object (File)
Oct 2 2024, 12:50 AM
Unknown Object (File)
Sep 28 2024, 8:24 AM
Unknown Object (File)
Sep 27 2024, 9:17 AM
Unknown Object (File)
Sep 27 2024, 7:23 AM
Subscribers

Details

Summary

When a multipath member is orphaned its access members are zeroed before its removed if the marked for wither, so prevent any future calls to g_access on such members.

This prevents a panic on debug kernels which validates the resultant values aren't negative.

Also fix the fail loops use of break instead of continue.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 1476
Build 1482: arc lint + arc unit

Event Timeline

smh retitled this revision from to Prevent g_access calls to bad multipath members.
smh updated this object.
smh edited the test plan for this revision. (Show Details)
imp added a reviewer: imp.

This looks generally correct. Minor formatting nit is all.

sys/geom/multipath/g_multipath.c
472

We've generally not started using C++ comments wholesale.

This revision is now accepted and ready to land.Dec 7 2015, 4:57 AM
smh marked an inline comment as done.Dec 7 2015, 9:25 AM
smh edited edge metadata.

Style nit fix

This revision now requires review to proceed.Dec 7 2015, 9:27 AM
mav requested changes to this revision.Dec 7 2015, 6:26 PM
mav edited edge metadata.

I haven't looked into this code for quite some time, but I doubt this patch is correct.

sys/geom/multipath/g_multipath.c
476

I am not sure that check for MP_BAD is right here. MP_BAD includes several flags, including MP_FAIL, which has nothing to do about access counts.

500

In original version "break" here exited loop at the right point if original g_access() failed on this consumer. Now attempt to fix one bug introduced another.

This revision now requires changes to proceed.Dec 7 2015, 6:26 PM
sys/geom/multipath/g_multipath.c
476

I did think that might be the case, which is why I put in for review, so thanks for confirming.

Even checking for MP_LOST, which can result in g_mpd calls and hence can lead to g_access reset, its still not guaranteed to have run.

Given that maybe adding a new state bit that set if the reset has occurred is the a way forward as then it could be explicitly checked?

500

Correct it needs to abort as the previous loop did, will fix.

sys/geom/multipath/g_multipath.c
476

MP_POSTED looks somewhat related. Otherwise -- may be indeed a new flag.

smh edited edge metadata.

Introduce MP_WITHER which is used to flag a device thats had its access counters reset but required withering hence hasn't yet been destroyed.

Tests to confirm correct operation still pending...

smh marked 5 inline comments as done.Dec 7 2015, 8:25 PM
smh added inline comments.
sys/geom/multipath/g_multipath.c
476

It is related but still not enough unfortunately so I've introduced MP_WITHER.

smh marked 2 inline comments as done.Dec 15 2015, 8:22 PM

Are you happy with this now mav?

mav edited edge metadata.

Yes, now it seems fine to me.

This revision is now accepted and ready to land.Dec 15 2015, 8:57 PM
This revision was automatically updated to reflect the committed changes.