From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [RFC] write(2) semantics wrt return values and current position Date: Thu, 9 Apr 2015 12:23:33 +0100 Message-ID: <20150409112333.GT889@ZenIV.linux.org.uk> References: <20150406153641.GL889@ZenIV.linux.org.uk> <20150408192450.GQ889@ZenIV.linux.org.uk> <20150408205737.GR889@ZenIV.linux.org.uk> <20150408212026.GS889@ZenIV.linux.org.uk> <552604AC.8030704@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, Linus Torvalds , Trond Myklebust , Christoph Hellwig , Dave Chinner , Theodore Ts'o , Miklos Szeredi , Oleg Drokin , Joseph Qi , Joel Becker , Mark Fasheh To: Junxiao Bi Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:39366 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932290AbbDILYu (ORCPT ); Thu, 9 Apr 2015 07:24:50 -0400 Content-Disposition: inline In-Reply-To: <552604AC.8030704@oracle.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Apr 09, 2015 at 12:48:44PM +0800, Junxiao Bi wrote: > Looks like if generic_file_direct_write() return -EIOCBQUEUED and > IS_SYNC(inode) is true, the sync range is also wrong. *blink* But in that case it shouldn't do any syncing at all... Oh, right. Unlike generic_file_write_iter(), if goes into the sync pathway in that case (which was another long-standing bug there)... Fixed and force-pushed. FWIW, once we get to the situation when generic_write_checks() takes iocb and iter, the next step will be mirroring O_DIRECT and O_APPEND state in iocb->ki_flags; then ocfs2_file_write_iter() will be able to use those instead of o_direct/o_append *and* start using __generic_file_write_iter() instead of open-coding it - the problem with "we can't rely on ->f_flags & O_DIRECT to tell if that should be a direct write, need to look at our local flag" will go away...