Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2155775rwb; Thu, 8 Dec 2022 21:17:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf5k//NHVrlOkt3K0Tw8xunUUeUdyNFAE7ZBJoCAlL13jEA9/QdlANVmZFULAKR2b6NT1RIh X-Received: by 2002:a62:3342:0:b0:575:ff07:cb1e with SMTP id z63-20020a623342000000b00575ff07cb1emr4338795pfz.31.1670563033965; Thu, 08 Dec 2022 21:17:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670563033; cv=none; d=google.com; s=arc-20160816; b=tKRhnWD455+Ne2nNY7BwTtnDC+iCplOFlAl5vEjF20t0Rx9bKSvvjGco6ltuc0QTzD QbV307vNsXS45w1sgxESfKgy1WQAFPIhQmVnDYubIlBVMzSbYhOR3Tv11bi0d4gLT5w0 hilITtc68M/pUBUwx8yvMWfog7Fd+hdUCZIBUkmE6KT+YdHxvLENpW2yC+FOECyfFySK GYyA95ZABnvIymAqF8vX9uBq+9aA22NHzG6E0wQT1A9ZgeftJwGqjxKj9HhNyLiHjWIb 1t4eWNK5IOBevvuyC7GDIewpC5YCazW6qodls+zyXo+cH+jNERNWmB8WBkBJVBfosOeC hRsg== 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:mail-followup-to:message-id:subject:to:from:date; bh=zxXHPeERro7eac5j9QLvwoK7T66T0Wumad1G7wR58lI=; b=YsTcPw8mrV1jvR05WIqVU3YoA8lPqwozicUAW3Slp61e+ZOzq5T53IESNFe01JUEzN UkrKxes11DkpQLgD0Jzi+Qpwbl7dWlBAQrAGGLr/MgIVC0ebPj7MhhWQbUecGPJFOWMY lUwRvoVNtVEKxjtT5WdSrWIDYKbgwV9BK/vbY1yYl4nIuVZxzWdXMKyP04ij4KSudhgd i6RsknLLBkMiVJ4KgWmfE7lbS1koqnsCuKLwT98bMJv1xbmezLq5pUZsJpStZ6TT0dNE tcZYpHzujxqC+q2Vd/DEjS2CRB/vAQLaxKzEhNc0dslbp7sFFz8asFeP2TOItG8ZXT7V XlUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020aa79548000000b00574fb9f77dcsi822110pfq.226.2022.12.08.21.17.02; Thu, 08 Dec 2022 21:17:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229550AbiLIEvD (ORCPT + 74 others); Thu, 8 Dec 2022 23:51:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbiLIEvC (ORCPT ); Thu, 8 Dec 2022 23:51:02 -0500 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EBE81B1F3; Thu, 8 Dec 2022 20:50:54 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R311e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=hsiangkao@linux.alibaba.com;NM=0;PH=DS;RN=5;SR=0;TI=SMTPD_---0VWt-q52_1670561448; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VWt-q52_1670561448) by smtp.aliyun-inc.com; Fri, 09 Dec 2022 12:50:51 +0800 Date: Fri, 9 Dec 2022 12:50:47 +0800 From: Gao Xiang To: Siddh Raman Pant , linux-kernel , linux-fsdevel , Yue Hu , linux-erofs Subject: Re: [RFC PATCH] erofs/zmap.c: Bail out when no further region remains Message-ID: Mail-Followup-To: Siddh Raman Pant , linux-kernel , linux-fsdevel , Yue Hu , linux-erofs References: <917344b4-4256-6d77-b89b-07fa96ec4539@siddh.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Siddh, On Tue, Nov 15, 2022 at 06:50:33PM +0800, Gao Xiang wrote: > On Tue, Nov 15, 2022 at 03:39:38PM +0530, Siddh Raman Pant via Linux-erofs wrote: > > On Tue, 15 Nov 2022 08:54:47 +0530, Gao Xiang wrote: > > > I just wonder if we should return -EINVAL for post-EOF cases or > > > IOMAP_HOLE with arbitrary length? > > > > Since it has been observed that length can be zeroed, and we > > must stop, I think we should return an error appropriately. > > > > For a read-only filesystem, we probably don't really need to > > care what's after the EOF or in unmapped regions, nothing can > > be changed/extended. The definition of IOMAP_HOLE in iomap.h > > says it stands for "no blocks allocated, need allocation". > > For fiemap implementation, yes. So it looks fine to me. > > Let's see what other people think. Anyway, I'd like to apply it later. > Very sorry for late response. I've just confirmed that the reason is that 796 /* 797 * No strict rule how to describe extents for post EOF, yet 798 * we need do like below. Otherwise, iomap itself will get 799 * into an endless loop on post EOF. 800 */ 801 if (iomap->offset >= inode->i_size) 802 iomap->length = length + map.m_la - offset; Here iomap->length should be length + offset - map.m_la here. Because the extent start (map.m_la) is always no more than requested `offset'. We should need this code sub-block since userspace (filefrag -v) could pass ioctl(3, FS_IOC_FIEMAP, {fm_start=0, fm_length=18446744073709551615, fm_flags=0, fm_extent_count=292} => {fm_flags=0, fm_mapped_extents=68, ...}) = 0 without this sub-block, fiemap could get into a very long loop as below: [ 574.030856][ T7030] erofs: m_la 70000000 offset 70457397 length 9223372036784318410 m_llen 457398 [ 574.031622][ T7030] erofs: m_la 70000000 offset 70457398 length 9223372036784318409 m_llen 457399 [ 574.032397][ T7030] erofs: m_la 70000000 offset 70457399 length 9223372036784318408 m_llen 457400 So could you fix this as? iomap->length = length + offset - map.m_la; I've already verified it can properly resolve the issue and do the correct thing although I'd like to submit this later since we're quite close to the merge window. Thanks, Gao Xiang