Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1999805pxb; Fri, 22 Oct 2021 11:42:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9XkCfK4Qm9bR8xmNK6k1dSA5ammQkTiqxd0lh4OOB6Cp2Y32Dl16bii/NcWB3O2OKRakN X-Received: by 2002:a17:902:d2cd:b0:13f:14dd:aeff with SMTP id n13-20020a170902d2cd00b0013f14ddaeffmr1662886plc.67.1634928161466; Fri, 22 Oct 2021 11:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634928161; cv=none; d=google.com; s=arc-20160816; b=Iztiv4udG1+a8P5SWJdUzOUOCou+UC35Ji3faFAw5wKSkSJXjCV0aSMOlFRM0KIB0u uDpVssLND9xnWEokb4D50wB+IuJee6GPKqYBvhXOL9Ca71iR8gzLB877sS4XxiCkgb3e 2HfLEqN7ESyti1MUXA+YZiXlJg6EChJbaVJQY/ledwI2+AkpIjRSsQUzcEFrFKZcNPom 66RtsSQ+MX7cD4UsnsiczvD0hehPSYADHcqEc6D/L2bagVPexuPx54koKRvaGCGsXGs8 aTsNcCz4Qes7Zpz2ajBoobLU36kDmftgFefNlAlHha+SQ4hXtvKPqLz9EQPIZQ6ORcWV cU6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=sF/D0I8BkdRzD14dMseCNXvoMXhMf8gM58GtPIJZgac=; b=zTS5j4+xq35wRM1X+PVl6ge/47L+AWoxpbcRibnF06vFnj7lSA4KdDPB7B+qTuR131 OvBuQOQY0bnfQQcXuhgbhG0XfbQmS4mUlxoyX7XgrT1CEwpqBg7Hje/PouCOiHBXnZ8G 7u5g9zD5KvP/7+0dshzQUADSAiISw9eBWqDGi9IR43d3tXFtMDbKVwCZ3SyM0L1uSffl HwS6lHJrTadK5tIdX6ybGxux8OAIUcvx6kGUBXUS3l5YZUNBrWvaMFTzqVJQ2R/hkeT4 EMAIQfcHFPoSG1KKumywsogfpMkFzxsTtBVmQRqr7DY3Lu7+ru3u86qaeb1HaRsXZAsw TAiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si11501858pfr.267.2021.10.22.11.42.28; Fri, 22 Oct 2021 11:42:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231627AbhJVSnc (ORCPT + 99 others); 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