Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp5911455ybx; Mon, 11 Nov 2019 00:22:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzP6fOG2oLzNPjEw54DC11iiik8rxYvmNfE8BAWc55/QdTELD7LeZmnwd7NNP2N7dFZIcR1 X-Received: by 2002:a17:906:2546:: with SMTP id j6mr8734159ejb.132.1573460551617; Mon, 11 Nov 2019 00:22:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573460551; cv=none; d=google.com; s=arc-20160816; b=SdTGc6/osYAtpRawgBqTgh6A2UXuvQpGsqEkJnf7D+ufKkTQatf/i5L729uGRjMiM4 OsueVFsppT3HbjY5c2jjzpEBwKLyBYWC93gbxaczhcwHVnFsn0go6xNtOZ1KbUWcSH4e A5VO1qGOfA142ZSn23sNqWDMcLpbly38v6KQLMtWTJGtXhg1ZrdIqxn5rcDWhn0ttAle xb/U8IObbnB8j1Vn0V20gr/kqzFtgE7nyu41mvd3uRNIjQt0dAlqtVqbufLpneGrQcZW GXV08eqxHTJmH2qXDoQDX5gcdp2ptQtbrhwkvg6it+wA0XEHtg+Fpw9oCoQDtNO8Nipg LOCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:thread-index :thread-topic:mime-version:subject:references:in-reply-to:message-id :cc:to:from:date:dkim-signature; bh=Y+d9HgiQd/ROeqheIWevtzZ1281FA0vSMCBkopaTcHI=; b=G/pcYPI21TdGFMmegGsSYGyK77G0wzcXf7cJzfHirArVhkrTGvwVNiHnnIevY65fkb nG1nfJCGJcrkjsVf6OK5Q7LtEG7SPstRiY3AqpO8XMqLP4oBHsdmzPX9JSTs/BVRNmnk InMJSEaFlEUFuNvh4qxK2kLPNZY+QkZUkL9ZfOBjByzDtBzN2KnABj15PZ4oZggt+sOT Hx+oYaAPbbOFEdT2+am0ICQTpc0MkZMCUyhwAeD0GGMpw44aHohRUV+BWLaxsq4l4pnQ Ou7szhuFM4YWv94iEbgpEkykTo5/4PE/ylMDyeQv4XOX2ME1P1utiwKSmeVepgKZX6SB smEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FwF58rCx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q18si8902935eju.333.2019.11.11.00.21.59; Mon, 11 Nov 2019 00:22:31 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FwF58rCx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726793AbfKKITz (ORCPT + 99 others); Mon, 11 Nov 2019 03:19:55 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:56464 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726810AbfKKITx (ORCPT ); Mon, 11 Nov 2019 03:19:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573460391; 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=Y+d9HgiQd/ROeqheIWevtzZ1281FA0vSMCBkopaTcHI=; b=FwF58rCxdF5GKETwfEzbwtY0BWIdJrh4iE8J2MBZTRJg9hvhBysz18IyM2z+pIBSeDwcUD nghUnYQY+6VPqOuw7CoppXStiQ2n+lSRH6UmnY/hFmytRuaMMeLjHDUVmCJWoDZhVlzCb8 iC6wsiznt0ALFb0IJcjRFirktUovEic= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-_0XAJepROSaUejme0jEEIQ-1; Mon, 11 Nov 2019 03:19:44 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0CAFC107ACC4; Mon, 11 Nov 2019 08:19:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6BFE4100EBA6; Mon, 11 Nov 2019 08:19:41 +0000 (UTC) Received: from zmail17.collab.prod.int.phx2.redhat.com (zmail17.collab.prod.int.phx2.redhat.com [10.5.83.19]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9754118089C8; Mon, 11 Nov 2019 08:19:40 +0000 (UTC) Date: Mon, 11 Nov 2019 03:19:40 -0500 (EST) From: Jan Stancek To: "Darrick J. Wong" Cc: Naresh Kamboju , LTP List , Linux-Next Mailing List , linux-fsdevel@vger.kernel.org, chrubis , open list , Al Viro , Mark Brown , Arnd Bergmann , lkft-triage@lists.linaro.org, Christoph Hellwig , linux-ext4 , Theodore Ts'o Message-ID: <1751469294.11431533.1573460380206.JavaMail.zimbra@redhat.com> In-Reply-To: <20191111012614.GC6235@magnolia> References: <852514139.11036267.1573172443439.JavaMail.zimbra@redhat.com> <20191111012614.GC6235@magnolia> Subject: Re: LTP: diotest4.c:476: read to read-only space. returns 0: Success MIME-Version: 1.0 X-Originating-IP: [10.43.17.163, 10.4.195.18] Thread-Topic: diotest4.c:476: read to read-only space. returns 0: Success Thread-Index: OoFxfOUloBUkdPsY/du59GUryWTVqQ== X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: _0XAJepROSaUejme0jEEIQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org ----- Original Message ----- > I can't do a whole lot with a code snippet that lacks a proper SOB > header. I'll resend as a patch, maybe split it to 2 returns instead. > > diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c > > index 2f88d64c2a4d..8615b1f78389 100644 > > --- a/fs/iomap/direct-io.c > > +++ b/fs/iomap/direct-io.c > > @@ -318,7 +318,7 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos= , > > loff_t length, > > if (pad) > > iomap_dio_zero(dio, iomap, pos, fs_block_size - > > pad); > > } > > - return copied ? copied : ret; > > + return copied ? (loff_t) copied : ret; >=20 > I'm a little confused on this proposed fix -- why does casting size_t > (aka unsigned long) to loff_t (long long) on a 32-bit system change the > test outcome? Ternary operator has a return type and an attempt is made to convert each of operands to the type of the other. So, in this case "ret" appears to be converted to type of "copied" first. Both have size of 4 bytes on 32-bit x86: size_t copied =3D 0; int ret =3D -14; long long actor_ret =3D copied ? copied : ret; On x86_64: actor_ret =3D=3D -14; On x86 : actor_ret =3D=3D 4294967282 > Does this same diotest4 failure happen with XFS? I ask > because XFS has been using iomap for directio for ages. Yes, it fails on XFS too.