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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E321C433FE for ; Mon, 14 Nov 2022 17:35:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3FC6C6B0075; Mon, 14 Nov 2022 12:35:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3AC1C8E0002; Mon, 14 Nov 2022 12:35:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2740F8E0001; Mon, 14 Nov 2022 12:35:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1485A6B0075 for ; Mon, 14 Nov 2022 12:35:24 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E06C2120CD6 for ; Mon, 14 Nov 2022 17:35:23 +0000 (UTC) X-FDA: 80132749326.05.17E0901 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf26.hostedemail.com (Postfix) with ESMTP id 275AE140011 for ; Mon, 14 Nov 2022 17:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668447322; 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: in-reply-to:in-reply-to:references:references; bh=EdMkF+oTf72wiNp5K2GVn33g0KOW73h/feSRwzy2/Wk=; b=SRsp3pPf0+BU6j0XhIMOrVrf//AeBH0rcejCXdrW5lJqdqh4wm3+Ot6yAyj4104sVanLqN IiLvNjoTKtz1gQjP46GvX/hxPrnnF+EyDPh7Km+dJH/wRbgttFHon8h9YvbIIOLpAHiLsi LbbANUPQrvS/FIehJkpXEY3mrFZ5MJw= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-374-YOAGPTqkNIeDlBw-CmmF4A-1; Mon, 14 Nov 2022 12:35:21 -0500 X-MC-Unique: YOAGPTqkNIeDlBw-CmmF4A-1 Received: by mail-qv1-f70.google.com with SMTP id w12-20020a056214012c00b004c6257ca968so5442288qvs.16 for ; Mon, 14 Nov 2022 09:35:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EdMkF+oTf72wiNp5K2GVn33g0KOW73h/feSRwzy2/Wk=; b=Q26uixmVipbiQCOE8NzBqiPhLThk3CrJeocaWNeoxauWEg/+aUZf/JFbzcS4rhqaSr bR8SOzyIWaJXOzbmIBWtD+FVG6kmyAA+DmnU8sbY8Rdbdd8UXmLK+AYZHhhoGO6KDzF5 OVgkUiL5DcNKclLtvI9WEKEy3LcsIG/qmoiqYKe3bnKOH07nFv9VcIHgWcbMVjyi8JfQ lMe2q4P0caIyYCSGXkqRAFXE5qyS/19Oz8t4Nj0eZJUQxyAC4eONv4/TIAJxPeFCzT47 fOjCwxMoqyHI+vHH+rGd77m+2AhwBlUDNBmHPNpEiVExttV3KjILTrJcfFYYC1H/xwVy I3wg== X-Gm-Message-State: ANoB5plW9drPMCgb6eZFnBzvlhYQRdpA1R4gfq/BkuVI+hpu654rAyjt j6OC0Rdt6qqg6em/LqKrL4GfufygVDUy00RZOV1FhKGXoS67bPwBCCYY3VPGHpx35sOv270OwvE CneU44Cc0QO4= X-Received: by 2002:ad4:53ac:0:b0:4af:9543:2eee with SMTP id j12-20020ad453ac000000b004af95432eeemr13442679qvv.2.1668447320495; Mon, 14 Nov 2022 09:35:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf4jzO6jDZcDxBkWHmGbbm0x5MCZhirSww6O2FUqN8VfyHyiwJc6HDr+GEYDMlFC8T1TNIzaGQ== X-Received: by 2002:ad4:53ac:0:b0:4af:9543:2eee with SMTP id j12-20020ad453ac000000b004af95432eeemr13442653qvv.2.1668447320258; Mon, 14 Nov 2022 09:35:20 -0800 (PST) Received: from bfoster (c-24-61-119-116.hsd1.ma.comcast.net. [24.61.119.116]) by smtp.gmail.com with ESMTPSA id d16-20020a05622a15d000b003a540320070sm6016746qty.6.2022.11.14.09.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 09:35:19 -0800 (PST) Date: Mon, 14 Nov 2022 12:35:24 -0500 From: Brian Foster To: Andrew Morton Cc: linux-mm@kvack.org Subject: Re: [PATCH] filemap: skip range writeback if end offset precedes start Message-ID: References: <20221028125428.976549-1-bfoster@redhat.com> <20221030215100.f5e7116e848077c96d86591d@linux-foundation.org> <20221107122802.d214dd0a3c546d3a35c71e9c@linux-foundation.org> MIME-Version: 1.0 In-Reply-To: <20221107122802.d214dd0a3c546d3a35c71e9c@linux-foundation.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668447323; a=rsa-sha256; cv=none; b=gdKcHwG9YPKeKS33XiR4hG07SK7sYjvwxBSFxvngk6gVPFbu0Jbl4moFfPRGIQR9Di+VSQ +B9wjREJDspX/raGVD2uw/tQ3+MgBGN/crmZFC++LocOyvpxk1z/kU7kP6Z2Kcap7AC7ve I4CQ/SOCQ1mNoyziN5Q66sto/w1CF48= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SRsp3pPf; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf26.hostedemail.com: domain of bfoster@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bfoster@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668447323; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=EdMkF+oTf72wiNp5K2GVn33g0KOW73h/feSRwzy2/Wk=; b=D6HoG54jYUw2z2KGZ/l3bQexCA2ph18nC92p+tUlsqRm4GwqDAfy4mvK973p0axCA3GKIO NxyMdsaLA0xjorL8q9ckGF5wA449O2Ox/QyzsqkA9iJDcTHF6BBXnOaV2gs+LirnuKHEE4 0y1SEVwvQCTXzHMYQSriUXqcJZ+/ryA= X-Rspamd-Queue-Id: 275AE140011 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SRsp3pPf; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf26.hostedemail.com: domain of bfoster@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bfoster@redhat.com X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 796p6fk5gewgtru398dxo7hntog5eosn X-HE-Tag: 1668447322-745431 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Nov 07, 2022 at 12:28:02PM -0800, Andrew Morton wrote: > On Mon, 7 Nov 2022 11:33:46 -0500 Brian Foster wrote: > > > Perhaps a good starting point would be to wrap the check in > > this patch with a WARN_ON_ONCE() and let it soak in -next for a while? > > That would avoid excessive noise from repetitive callers [1] but still > > allow those callsites to be identified/fixed. If there is some really > > weird fdatawrite-only caller that conflicts, the change could always be > > loosened up from there (as unlikely as that seems).. Hm? > > Sounds reasonable. > > Please let's be clear in the changelog why we're adding this. I mean, > we could add a zillion checks everywhere for misbehaving callers. Why > choose this one place in particular? > Ok, so TLDR.. this patch is broken as is. I was probably thinking the generic_fadvise() case of end == -1 was cast to unsigned by the caller, but testing shows that is not the case and -1 is passed down as a valid input. This obviously conflicts with the check as proposed here. I suppose it might make some sense to drop the analogous check from __filemap_fdatawait_range() so underlying write/wait behavior is consistent, and perhaps consider adding a higher level check in the write_and_wait_range() wrappers. I'd have to make a pass through some of the callers and think about that some more. I.e., filemap_write_and_wait_range() documents that end = -1 is acceptable, fdatawrite presumably does the right thing in that case, fdatawait skips when end_byte < start_byte, and most callers seem to actually use LLONG_MAX anyways. Brian