Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2367210rwp; Fri, 14 Jul 2023 05:16:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlFCiDCYMMvvYHBNHIongAoo8+gqqOw/NQ+eFRvPfnQKORe9dW4U7hcXtv54LbWDsPzcS38N X-Received: by 2002:a17:902:e805:b0:1ab:11c8:777a with SMTP id u5-20020a170902e80500b001ab11c8777amr5264627plg.13.1689336989122; Fri, 14 Jul 2023 05:16:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689336989; cv=none; d=google.com; s=arc-20160816; b=yBi/Z/f/wduY2eeyLyjdtgZQqfeLnhdYJs+RNrhY2uUqs+Xxlw5NW9YHUWV6g1K3RQ ZmDN1YzhhaSujsAoaulQV7DwCiejbT7pv+sHCeHKrbCozXKXyOQWOF3XdjcMZmIbSErm Occu2FnKgh41veWMFL6KMYilFWBEvb9m/IYeFOBY/kWpLMMZYI2Sm2jwCtqeI+KeqX44 HsFSEhG3h6iiZXygqZEyF5zJX/gABoS/Lj6Y58R+mfltUYD9PxaJnc0W5qV6sAh0wrU4 c5SIBbuaQg647egzdJ7qAjBxrUNzHPz/eJWoGiu3vJjeHfaZdrwJVGre60ZL0kqua3MP XrKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=hHYKpItuEcJuo5Jv3chYxiDW/iXWwzUQH5pKsFYaAmw=; fh=aLeZtljNIvB+wRIVIDQeipxMrcyqs0GIyHl8yT7ckts=; b=eI2vUNp3kFmvZ2KyJ/x6ITQUQFrDGiNWPmomFslKN9ZRj/+IP5doywm+Edx4AhMO1n UnSyDQFPZ2LpTDNGtrV2ZebtpZeZIkynubkyU3ppgG2BcwVFizGZgjWfv2HtqYMqyAH9 FrNyjbuJyq5vN/Ndpad0d4RP02qJ7Mu3yQC6bD088ueeqJwWH5CIU/5JnFUPob5aKtuZ 4plw4LEJgoLIHE7gyclx8z4btzwch7sa6e/Gu4VXcx01JlnPZzzMcjFZ5dOtYyM4wzWx BpMU3R2CxGKDWLf3od05guoqNw+48DbhZgkY62CtHUCAJawxlMufXcAGKzghCpgTpLLn IxBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L8wnRMNZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g1-20020a170902934100b001b9d5fb7fc8si6719021plp.101.2023.07.14.05.16.17; Fri, 14 Jul 2023 05:16:29 -0700 (PDT) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L8wnRMNZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235659AbjGNLwH (ORCPT + 99 others); Fri, 14 Jul 2023 07:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235502AbjGNLwG (ORCPT ); Fri, 14 Jul 2023 07:52:06 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC56530CB for ; Fri, 14 Jul 2023 04:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689335477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hHYKpItuEcJuo5Jv3chYxiDW/iXWwzUQH5pKsFYaAmw=; b=L8wnRMNZifC1c53LgoWHxnbCJh1MMmoT0syjf1FsvnXsxjlyVtmlqIh/o2AmLISRskG2ig LvYiJg0dqg45ABDf6DLB5ardQJLKq2giywjEwmiZk/ktsxt+VNeb3GnunjUtKZUsf51YAG ihmaNLzejGUL8AhfUSYv0sIdN8Mk3rQ= Received: from mail-ua1-f70.google.com (mail-ua1-f70.google.com [209.85.222.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660-F3XoLn_ZNyuGc-iE0Oh82A-1; Fri, 14 Jul 2023 07:51:16 -0400 X-MC-Unique: F3XoLn_ZNyuGc-iE0Oh82A-1 Received: by mail-ua1-f70.google.com with SMTP id a1e0cc1a2514c-78f62807a12so197876241.3 for ; Fri, 14 Jul 2023 04:51:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689335475; x=1691927475; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hHYKpItuEcJuo5Jv3chYxiDW/iXWwzUQH5pKsFYaAmw=; b=KffccYqscVT6N2sa0BPOGPoo7TqApjjTsU9qtqMWu51/pXvdI9Iszjqaa4PFrFjO3F dYWxZJw/SH0vZtRfWcHw6tZVbYHtE1O3bVCFJP+Es0eZVDtl7slsAyQxBwP5KqVi34N/ KqsDi7p/krZiAvSKTvbzl0/YUkCwiXYgK9WyFyVfgXqzQYtrvzuZzLcn0XTc778J13Qa LTRrUlOSRKZFC04Vu7QYtPXJ8yiK0GEfVbb/QP8I7TYqAygJ6fIeuV3xwJsluylkCeY0 IdoptZ1+6aqQ7Lojjq0JnwNOgbZK6m654zZInLVUPN43YpYKyI7j6AcI+G5pzn3WtnST BvgA== X-Gm-Message-State: ABy/qLaqLKa6gZG1MNUs6FI+zmmOt2/r5kQ+gKvZNAam6teqK3wfWzJV 1pDa6ucEB4SAG24q9MWOXbH/gD2oKB9JIoDy+8tJ0gNajkG0Qhpfud5MDJVb+UGBHQEHS5E0bWl pEYa/DDPfAf5yipWZQif9r20ru0K9CDJUeVeCKlsj X-Received: by 2002:a05:6102:356d:b0:443:6a86:7cdb with SMTP id bh13-20020a056102356d00b004436a867cdbmr2336834vsb.26.1689335475688; Fri, 14 Jul 2023 04:51:15 -0700 (PDT) X-Received: by 2002:a05:6102:356d:b0:443:6a86:7cdb with SMTP id bh13-20020a056102356d00b004436a867cdbmr2336824vsb.26.1689335475401; Fri, 14 Jul 2023 04:51:15 -0700 (PDT) MIME-Version: 1.0 References: <202307132107.2ce4ea2f-oliver.sang@intel.com> <20230713150923.GA28246@lst.de> In-Reply-To: From: Jan Stancek Date: Fri, 14 Jul 2023 13:50:58 +0200 Message-ID: Subject: Re: [LTP] [linus:master] [iomap] 219580eea1: ltp.writev07.fail To: Cyril Hrubis Cc: Christoph Hellwig , "Darrick J. Wong" , Andreas Gruenbacher , Miklos Szeredi , Matthew Wilcox , cluster-devel@redhat.com, Ilya Dryomov , Miklos Szeredi , Chao Yu , oe-lkp@lists.linux.dev, Al Viro , Jaegeuk Kim , Xiubo Li , Trond Myklebust , ltp@lists.linux.it, lkp@intel.com, Jens Axboe , Christian Brauner , "Theodore Ts'o" , Johannes Thumshirn , linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, kernel test robot , Anna Schumaker , linux-fsdevel@vger.kernel.org, Andrew Morton , Hannes Reinecke Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 On Thu, Jul 13, 2023 at 5:38=E2=80=AFPM Cyril Hrubis wrot= e: > > Hi! > > I can't reproduce this on current mainline. Is this a robust failure > > or flapping test? Especiall as the FAIL conditions look rather > > unrelated. It's consistently reproducible for me on xfs with HEAD at: eb26cbb1a754 ("Merge tag 'platform-drivers-x86-v6.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86") > > Actually the test is spot on, the difference is that previously the > error was returned form the iomap_file_buffered_write() only if we > failed with the first buffer from the iov, now we always return the > error and we do not advance the offset. > > The change that broke it: > > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index 063133ec77f4..550525a525c4 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -864,16 +864,19 @@ iomap_file_buffered_write(struct kiocb *iocb, struc= t iov_iter *i, > .len =3D iov_iter_count(i), > .flags =3D IOMAP_WRITE, > }; > - int ret; > + ssize_t ret; > > if (iocb->ki_flags & IOCB_NOWAIT) > iter.flags |=3D IOMAP_NOWAIT; > > while ((ret =3D iomap_iter(&iter, ops)) > 0) > iter.processed =3D iomap_write_iter(&iter, i); > - if (iter.pos =3D=3D iocb->ki_pos) > + > + if (unlikely(ret < 0)) > return ret; > - return iter.pos - iocb->ki_pos; > + ret =3D iter.pos - iocb->ki_pos; > + iocb->ki_pos +=3D ret; > + return ret; > } > > I suppose that we shoudl fix is with something as: > > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index adb92cdb24b0..bfb39f7bc303 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -872,11 +872,12 @@ iomap_file_buffered_write(struct kiocb *iocb, struc= t iov_iter *i, > while ((ret =3D iomap_iter(&iter, ops)) > 0) > iter.processed =3D iomap_write_iter(&iter, i); > > + iocb->ki_pos +=3D iter.pos - iocb->ki_pos; > + > if (unlikely(ret < 0)) > return ret; > - ret =3D iter.pos - iocb->ki_pos; > - iocb->ki_pos +=3D ret; > - return ret; > + > + return iter.pos - iocb->ki_pos; Replacing "ret" with "iter.pos - iocb->ki_pos" here doesn't look equivalent to original, because you already updated "iocb->ki_pos" few lines above. Wouldn't it be enough to bring the old condition back? diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index adb92cdb24b0..7cc9f7274883 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -872,7 +872,7 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i, while ((ret =3D iomap_iter(&iter, ops)) > 0) iter.processed =3D iomap_write_iter(&iter, i); - if (unlikely(ret < 0)) + if (unlikely(iter.pos =3D=3D iocb->ki_pos)) return ret; ret =3D iter.pos - iocb->ki_pos; iocb->ki_pos +=3D ret; (with hunk above applied) # ./writev07 tst_test.c:1526: TINFO: Timeout per run is 0h 00m 30s writev07.c:50: TINFO: starting test with initial file offset: 0 writev07.c:94: TINFO: writev() has written 64 bytes writev07.c:105: TPASS: file has expected content writev07.c:116: TPASS: offset at 64 as expected writev07.c:50: TINFO: starting test with initial file offset: 65 writev07.c:94: TINFO: writev() has written 64 bytes writev07.c:105: TPASS: file has expected content writev07.c:116: TPASS: offset at 129 as expected writev07.c:50: TINFO: starting test with initial file offset: 4096 writev07.c:94: TINFO: writev() has written 64 bytes writev07.c:105: TPASS: file has expected content writev07.c:116: TPASS: offset at 4160 as expected writev07.c:50: TINFO: starting test with initial file offset: 4097 writev07.c:94: TINFO: writev() has written 64 bytes writev07.c:105: TPASS: file has expected content writev07.c:116: TPASS: offset at 4161 as expected > } > EXPORT_SYMBOL_GPL(iomap_file_buffered_write); > > > -- > Cyril Hrubis > chrubis@suse.cz > > -- > Mailing list info: https://lists.linux.it/listinfo/ltp >