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:42:33 +0100 Message-ID: <20150409114232.GU889@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> <20150409112333.GT889@ZenIV.linux.org.uk> 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]:39542 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932903AbbDILnT (ORCPT ); Thu, 9 Apr 2015 07:43:19 -0400 Content-Disposition: inline In-Reply-To: <20150409112333.GT889@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Apr 09, 2015 at 12:23:33PM +0100, Al Viro wrote: > 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. BTW, what about the locks needed to stabilize the file size? generic_write_checks() in there looks like it's called too late - we can't tell a damn thing about alignment until we do it, so at the very least we might need to recheck that. Can we move it _before_ ocfs2_prepare_inode_for_write()? Having it done twice in case we end up on "can't really do O_DIRECT, unlock and redo everything without asking for direct IO" path is not a problem - we just need to save the original count and restore it before that goto relock in there. Do we hold enough locks to make sure that file size won't change under us?