tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Finding an available fss device



    Date:        Sun, 12 Aug 2018 13:25:26 +0000
    From:        Emmanuel Dreyfus <manu%netbsd.org@localhost>
    Message-ID:  <20180812132526.GH17137%homeworld.netbsd.org@localhost>

  | I was wondering about the FSS_ACTIVE test.

It is just one bit, either it is set, or it is not....   SInce the code
is already referencing sc-> (the mutex lives inside it) it cannot
be concerned about the device structures being deleted, so
that bit and the field that contains it certainly exists, and can
be referenced.   Referencing it cannot hurt any other parallel
thread, the worst that can happen, is that we see a stale copy
which is just the race condition.

Perhaps if it is tested outside the lock, it should be tested again
after the lock is taken, I did not look carefully enough at
fss_create_snapshot() to see what would happen if it is
called with an already active device.   That second test
would rarely fail, but could.

  | Do you sugest the mutex should be replaced by a  rwlock? 

Now you're asking stuff that's way beyond my pay grade...

kre



Home | Main Index | Thread Index | Old Index