Hi!
On 2021/1/5 0:04, Jan Kara wrote:
Consuming the reference here because we won't "set frozen =
SB_FREEZE_COMPLETE" in thaw_super_locked() now.
If don't do that, we never have a chance to consume it, thaw_super_locked()
will directly return "-EINVAL". But I do
agree that it's not a good idea to return 0. How about returning "-EINVAL or
-ENOTSUPP" ?
And, If we keep "frozen = SB_FREEZE_COMPLETE" in freeze_super() here, it
will cause another problem, thaw_super_locked()
will always release rwsems in my logic, but freeze_super() won't acquire the
rwsems when filesystem is read-only.
I was thinking about this for a while. I think the best solution would be
to track whether the fs was read only (and thus frozen without locking
percpu semaphores) at the time of freezing. I'm attaching that patch. Does
it fix your problem?
Honza
I tested your patch, and it can indeed fix this deadlock problem.
Thanks.