Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5465777ybl; Tue, 14 Jan 2020 09:21:33 -0800 (PST) X-Google-Smtp-Source: APXvYqxFrj2EShNMVu5FHu8cPt7D/F5kk8nNSPORNzVF/me6u9I6QJ/K/rTulVR2JnOl3fniJbYH X-Received: by 2002:aca:cf50:: with SMTP id f77mr18020245oig.60.1579022493114; Tue, 14 Jan 2020 09:21:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579022493; cv=none; d=google.com; s=arc-20160816; b=aaw/UnSs7YKs9WZzg1N+/WSNY6DXAOw5Mr1Wjs6uHYux2wjrF7LYbSUBIl0kfyE+p/ kjujmflhNKJZvvedCHpSqw5L/mwh5TOkV6cxji+O1rMNPFNRMKoTqcQKMyu7k7qL9d0N 8meKTPG/8HXvJkVmN5NlO/GcVqoRsojkLbWi5x3YbYpx+LmH58PzUf2M0UcC8lgJCdrP ervfbNiUnR/S5I9pg/0UCHzD4qNoemZhzpv8thz+ab+LAvyVHcFrbvPADcHbnLusaktI VWjZELmbfWTsdJt3SMjEZeayIFG+iKFW7eOaaU3ZM34hQ3CkJT9LAH9bvy+p4VrcSDQ/ UANQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=cCeMi+jNQFNnhof0EPbtcUZUya94DVdpVhN+eNvwn4U=; b=K49aOjYhiFCfCcWoP26V0/KGF/lhr77yWorlE7vs5gAMcWLtsx5pP1JuRMtFL32y9F U1tfxPzPrqW9K9cA2zqwNq2oeEZG7z8ChPeHZvuBn2W9E4fu4UsF0OtMkpPT9ACID0Lp cG31qfB7svYTjKJ+sZr+SlyPmgRauz1ydDWIz9xr0HmIyKVi+8Mhtz5Ni2U+siUYhQjw nrvaq1lJGn0fu4wq1F8bLeV5LtdM0WCvD98yRasWhxC0rpEwR3qVkcTp0hCjnriJcl2f 8YHCdoVtwpqtJioS98hu0wGTxcgeBifeAQ6hQtI/XuB4MZshgQGO4dwoKzAsVDiMXHvf 2NHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f25si8903372otl.36.2020.01.14.09.21.19; Tue, 14 Jan 2020 09:21:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726669AbgANRTh (ORCPT + 99 others); Tue, 14 Jan 2020 12:19:37 -0500 Received: from mx2.suse.de ([195.135.220.15]:44248 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728850AbgANRTh (ORCPT ); Tue, 14 Jan 2020 12:19:37 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E9989AD05; Tue, 14 Jan 2020 17:19:35 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id DF62D1E0CB4; Tue, 14 Jan 2020 18:19:34 +0100 (CET) Date: Tue, 14 Jan 2020 18:19:34 +0100 From: Jan Kara To: Christoph Hellwig Cc: Ritesh Harjani , linux-ext4@vger.kernel.org, tytso@mit.edu, jack@suse.cz Subject: Re: [RFC 1/2] iomap: direct-io: Move inode_dio_begin before filemap_write_and_wait_range Message-ID: <20200114171934.GB22081@quack2.suse.cz> References: <27607a16327fe9664f32d09abe565af0d1ae56c9.1578907891.git.riteshh@linux.ibm.com> <20200114163702.GA7127@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200114163702.GA7127@infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue 14-01-20 08:37:02, Christoph Hellwig wrote: > Using i_dio_count for any kind of detection is bogus. If you want to > pass flags to the writeback code please do so explicitly through > struct writeback_control. We want to detect in the writeback path whether there's direct IO (read) currently running for the inode. Not for the writeback issued from iomap_dio_rw() but for any arbitrary writeback that iomap_dio_rw() can be racing with - so struct writeback_control won't help. Now if you want to see the ugly details why this hack is needed, see my other email to Ritesh in this thread with details of the race. Honza -- Jan Kara SUSE Labs, CR