Comment 18 for bug 1873074

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Hi J. R. Okajima,

Good point. I recall that code path to change branches to read-only.

It's not exercised in the several tests I've done (for most common
scenarios.) Thanks for the additional testing.

It was a strong suspect early on, because it changes the underlying
inode's open file mode to read-only, and then an unbalance happens:

because the file was opened in read-write mode (no i_readcount_inc),
and after changed to read-only, on close it has is i_readcount_dec.

I remember the code having warnings that IMA messages could happen
if that is done in aufs; and possibly for this exact reason/change.

I'm not an aufs expert, but I think it's still wrong for aufs to
mess with the file mode of an already open file in the underlying
filesystem, and trying to remedy the failure as a result of that
by messing with the readcount again, under the covers.

Maybe another approach is to close the file if opened in RW mode,
and reopen in RO mode? so that the VFS continues to take care of
the i_readcount value, and aufs doesn't have to play tricks here.

(not sure if that is possible, i don't remember how aufs keeps
the access/syscalls from users of that file; but maybe it is
worth looking at it. -- and if it's too hard to do/not makes
sense, then maybe messing with the i_readcount under the hood
is what works for the time being. :)

Hope this helps,
Mauricio