On Wed, Jan 19, 2022 at 10:34:15PM +0100, Jan Kara wrote: > On Wed 19-01-22 20:30:52, Tetsuo Handa wrote: > > I found a way to avoid this race by splitting lo_open() into two phases > > using task_work_add(). Christoph Hellwig is trying to take a look at > > https://lkml.kernel.org/r/f6b947d0-1047-66b3-0243-af5017c9ab55@xxxxxxxxxxxxxxxxxxx > > . > > No, you have found a way to make the race window for mount(8) smaller. And > I still disagree with that kernel change because it is making kernel more > complex only to make the race window smaller. On another machine or with > different scheduling decisions, you can still hit this race. This problem > must be fixed in mount... +1 I think Jan is right. In this case mount(8) is not robust enough. It reads info about the device from /sys and then it opens the device. Unfortunately, whatever can happen before the open() call. Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com