From patchwork Tue Jul 4 15:31:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 9825323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5900C603B5 for ; Tue, 4 Jul 2017 15:31:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A6D3284D1 for ; Tue, 4 Jul 2017 15:31:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EF312851A; Tue, 4 Jul 2017 15:31:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF0C02850D for ; Tue, 4 Jul 2017 15:31:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752207AbdGDPbs (ORCPT ); Tue, 4 Jul 2017 11:31:48 -0400 Received: from mx2.suse.de ([195.135.220.15]:50981 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752184AbdGDPbs (ORCPT ); Tue, 4 Jul 2017 11:31:48 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 99C1EAAF2; Tue, 4 Jul 2017 15:31:46 +0000 (UTC) Subject: Re: Commit edf064e7c (btrfs: nowait aio support) breaks shells To: Markus Trippelsdorf , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org Cc: David Sterba , Jens Axboe References: <20170704042306.GA274@x4> <20170704074505.GA277@x4> From: Goldwyn Rodrigues Message-ID: Date: Tue, 4 Jul 2017 10:31:55 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20170704074505.GA277@x4> Content-Language: en-US Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 07/04/2017 02:45 AM, Markus Trippelsdorf wrote: > On 2017.07.04 at 06:23 +0200, Markus Trippelsdorf wrote: >> commit edf064e7c6fec3646b06c944a8e35d1a3de5c2c3 (HEAD, refs/bisect/bad) >> Author: Goldwyn Rodrigues >> Date: Tue Jun 20 07:05:49 2017 -0500 >> >> btrfs: nowait aio support >> >> apparently breaks several shell related features on my system. > > Here is a simple testcase: > > % echo "foo" >> test > % echo "foo" >> test > % cat test > foo > % > Thanks for testing. Yes, pos must be set with iocb->ki_pos for appends. I should not have removed the initialization. Could you try this patch? if (start_pos > oldsize) { diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 59e2dccdf75b..7947781229e5 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1931,6 +1931,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, */ update_time_for_write(inode); + pos = iocb->ki_pos; start_pos = round_down(pos, fs_info->sectorsize); oldsize = i_size_read(inode);