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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65300ECAAA1 for ; Fri, 28 Oct 2022 19:31:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbiJ1TbM (ORCPT ); Fri, 28 Oct 2022 15:31:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbiJ1TbI (ORCPT ); Fri, 28 Oct 2022 15:31:08 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2669E229E44; Fri, 28 Oct 2022 12:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rXRqCxzSwwJwUn6NUaDL+hX0MQGv2CPlx00T8de0cos=; b=k+le+6ssU0pzX5iaW/kTWOgm4b nhkSL3zT5nVqJVhVuRJK4TvRwmnHDnLaqUuWa+33dQ66uqwPEKjR4j4j9L4t1RboUwOc1Nk8nOWmt mz/UZSzC7pCS3TcjH1bbsoa537jLJ9WDiRH/HpVfMZj9CdcugRvy1mxB6bk4TGkhcCT5Ttoj96BuL bCfc5MewRDixyOuq+62XGtHBEts3nkQVf6Ij0WOUTS4g69Xtow1xtw/IxlhClbHYkhOkLGi5S4NAc 2Sd8qZ5nSnH+oEKtDPOYRfzj09tLz4dzrw4xJctoRVfgt6ij1Sy7ZerlgDLXj0BG/z3WRgj8TfwLG AThxBdyQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1ooV4A-00F1pm-0v; Fri, 28 Oct 2022 19:30:54 +0000 Date: Fri, 28 Oct 2022 20:30:54 +0100 From: Al Viro To: Linus Torvalds Cc: Christoph Hellwig , David Howells , willy@infradead.org, dchinner@redhat.com, Steve French , Shyam Prasad N , Rohith Surabattula , Jeff Layton , Ira Weiny , linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 12/12] use less confusing names for iov_iter direction initializers Message-ID: References: <20221028023352.3532080-1-viro@zeniv.linux.org.uk> <20221028023352.3532080-12-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 28, 2022 at 11:35:06AM -0700, Linus Torvalds wrote: > > Umm... How are you going to e.g. copy from ITER_DISCARD? I've no problem > > with WARN_ON_ONCE(), but when the operation really can't be done, what > > can we do except returning an error? > > Fair enough. But it's the "people got the direction wrong, but the > code worked" case that I would want tyo make sure still works - just > with a warning. > > Clearly the ITER_DISCARD didn't work before either, but all the cases > in patches 1-10 were things that _worked_, just with entirely the > wrong ->data_source (aka iov_iter_rw()) value. > > So things like copy_to_iter() should warn if it's not a READ (or > ITER_DEST), but it should still copy into the destination described by > the iter, in order to keep broken code working. > > That's simply because I worry that your patches 1-10 didn't actually > catch every single case. I'm not actually sure how you found them all > - did you have some automation, or was it with "boot and find warnings > from the first version of patch 11/12"? Went through the callers, replaced each with the right ITER_... (there's not that many of them and they are fairly easy to review), then went through mismatches and split their fixups into the beginning of the series (READ -> ITER_SOURCE becoming READ -> WRITE -> ITER_SOURCE, that is). FWIW, there used to be one case where we really tried to copy the wrong way - fixed a couple of cycles ago (f615625a44c4 "9p: handling Rerror without copy_from_iter_full()"). No such catches this time...