From: Bob Peterson Date: Thu, 22 Apr 2021 11:57:14 -0400 (EDT) Subject: [Cluster-devel] Hole punch races in GFS2 In-Reply-To: <20210422131419.GI26221@quack2.suse.cz> References: <20210422112612.GF26221@quack2.suse.cz> <20210422131419.GI26221@quack2.suse.cz> Message-ID: <619588401.12709186.1619107034528.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ----- Original Message ----- > OK, thanks for explanation! I missed that GFS2 glocks are task local. But > then I have another question. We have the following: > > gfs2_file_read_iter() > grabs inode glock in shared mode > generic_file_read_iter() > filemap_read() > copy_page_to_iter() > > grabs mmap_sem > gfs2_fault() > - tries to grab inode glock again -> possible recursive locking > > And even if the locking isn't recursive, you have glock->mmap_sem and > mmap_sem->glock lock orderings so ABBA deadlocks are possible AFAICT. > > And there's a similar problem with the write path as well, just the lock is > grabbed exclusively. > > Honza > -- > Jan Kara > SUSE Labs, CR Hi Jan, IIRC, gfs2 tries to prevent the page fault by having gfs2_file_read_iter call into generic_file_read_iter twice: The first time without the glock held, but specifying IOCB_NOIO, which brings the pages in and returns -EAGAIN. Then it acquires the glock, then calls into generic_file_read_iter a second time. I'm not sure if that prevents the deadlock or just makes it less likely. I still need to investigate that. Regards, Bob Peterson Red Hat File Systems