From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B4E7C433EF for ; Fri, 22 Oct 2021 18:41:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4859B60F93 for ; Fri, 22 Oct 2021 18:41:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231997AbhJVSnc (ORCPT ); Fri, 22 Oct 2021 14:43:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:56434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbhJVSnb (ORCPT ); Fri, 22 Oct 2021 14:43:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CDECA60238; Fri, 22 Oct 2021 18:41:10 +0000 (UTC) Date: Fri, 22 Oct 2021 19:41:07 +0100 From: Catalin Marinas To: Andreas Gruenbacher Cc: Linus Torvalds , Al Viro , Christoph Hellwig , "Darrick J. Wong" , Jan Kara , Matthew Wilcox , cluster-devel , linux-fsdevel , Linux Kernel Mailing List , "ocfs2-devel@oss.oracle.com" , Josef Bacik , Will Deacon Subject: Re: [RFC][arm64] possible infinite loop in btrfs search_ioctl() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 08:00:50PM +0200, Andreas Gruenbacher wrote: > On Thu, Oct 21, 2021 at 7:09 PM Catalin Marinas wrote: > > This discussion started with the btrfs search_ioctl() where, even if > > some bytes were written in copy_to_sk(), it always restarts from an > > earlier position, reattempting to write the same bytes. Since > > copy_to_sk() doesn't guarantee forward progress even if some bytes are > > writable, Linus' suggestion was for fault_in_writable() to probe the > > whole range. I consider this overkill since btrfs is the only one that > > needs probing every 16 bytes. The other cases like the new > > fault_in_safe_writeable() can be fixed by probing the first byte only > > followed by gup. > > Hmm. Direct I/O request sizes are multiples of the underlying device > block size, so we'll also get stuck there if fault-in won't give us a > full block. This is getting pretty ugly. So scratch that idea; let's > stick with probing the whole range. Ah, I wasn't aware of this. I got lost in the call trees but I noticed __iomap_dio_rw() does an iov_iter_revert() only if direction is READ. Is this the case for writes as well? -- Catalin