From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 2/2] xfs: fix splice/direct-IO deadlock Date: Wed, 10 Aug 2011 06:17:33 -0400 Message-ID: <20110810101733.GC27114@infradead.org> References: <1312785927-10662-1-git-send-email-david@fromorbit.com> <1312785927-10662-3-git-send-email-david@fromorbit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: xfs@oss.sgi.com, linux-fsdevel@vger.kernel.org To: Dave Chinner Return-path: Received: from 173-166-109-252-newengland.hfc.comcastbusiness.net ([173.166.109.252]:46081 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751040Ab1HJKRf (ORCPT ); Wed, 10 Aug 2011 06:17:35 -0400 Content-Disposition: inline In-Reply-To: <1312785927-10662-3-git-send-email-david@fromorbit.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Aug 08, 2011 at 04:45:27PM +1000, Dave Chinner wrote: > From: Dave Chinner > > lockdep reports splice vs direct-io write lock inversions due to > generic_file_splice_write() taking the inode->i_mutex inside > XFS_IOLOCK_EXCL context. These lock contexts are inverted, hence can > deadlock. Use splice_write_to_file() with an actor that does not > take the i_mutex to avoid these problems. I don't think the locking model is quite correct yet. We'll still hold the iolock and i_mutex over splice_from_pipe_begin/splice_from_pipe_next/splice_from_pipe_end, which call into the pipe code, and take other i_mutex instances that may deadlock against ours. It also means we hold the iolock over generic_write_sync which calls into ->fsync which takes the iolock with my latests changes. I think we'll have to take the locking and i_size updates into the actor, and behave like the other filesystems.