From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [Bug 50981] generic_file_aio_read ?: No locking means DATA CORRUPTION read and write on same 4096 page range Date: Mon, 26 Nov 2012 17:09:08 -0500 Message-ID: <20121126220908.GA20733@infradead.org> References: <20121126163328.ACEB011FE9C@bugzilla.kernel.org> <20121126164555.GL31891@thunk.org> <20121126201308.GA21050@infradead.org> <20121126214937.GA21590@thunk.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoph Hellwig , Hugh Dickins , Andrew Morton , Al Viro , bugzilla-daemon@bugzilla.kernel.org, meetmehiro@gmail.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org To: Theodore Ts'o Return-path: Received: from 173-166-109-252-newengland.hfc.comcastbusiness.net ([173.166.109.252]:51399 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755818Ab2KZWJP (ORCPT ); Mon, 26 Nov 2012 17:09:15 -0500 Content-Disposition: inline In-Reply-To: <20121126214937.GA21590@thunk.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Nov 26, 2012 at 04:49:37PM -0500, Theodore Ts'o wrote: > Christoph, can you give some kind of estimate for the overhead that > adding this locking in XFS actually costs in practice? I don't know any real life measurements, but in terms of implementation the over head is: a) taking a the rw_semaphore in shared mode for every buffered read b) taking the slightly slower exclusive rw_semaphore for buffered writes instead of the plain mutex On the other hand it significantly simplifies the locking for direct I/O and allows parallel direct I/O writers. > And does XFS > provide any kind of consistency guarantees if the reads/write overlap > spans multiple pages? I assume the answer to that is no, correct? The answer is yes as the lock is taken globally on the inode.