Re: [PATCH 1/3] fs: distinguish between user initiated freeze and kernel initiated freeze

Jan Kara
2023-06-12T11:36:16Z

On Mon 12-06-23 13:08:11, Jan Kara wrote:
> On Sun 11-06-23 20:15:22, Darrick J. Wong wrote:
> > +
> > if (sb->s_writers.frozen != SB_UNFROZEN) {
>
> I still find it strange that:
>
> Task1 Task2
>
> while (1) { while (1) {
> ioctl(f, FIFREEZE); freeze_super(sb, FREEZE_HOLDER_KERNEL);
> ioctl(f, FITHAW); thaw_super(sb, FREEZE_HOLDER_KERNEL);
> } }
>
> will randomly end up returning EBUSY to Task1 or Task2 although there is no
> real conflict. I think it will be much more useful behavior if in case of
> this conflict the second holder just waited for freezing procedure to finish
> and then report success. Because I don't think either caller can do
> anything sensible with this race other than retry but it cannot really
> distinguish EBUSY as in "someone other holder of the same type has the sb
> already frozen" from "freezing raced with holder of a different type".

I take this back, you solve the problem in patch 2 :). I'm sorry for the
noise.

Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR