Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp496165ybl; Mon, 2 Dec 2019 14:01:14 -0800 (PST) X-Google-Smtp-Source: APXvYqzkcFsgjG3QYJsNHNjqLuA5jkYEbmsQX6EMhyF+8Y5qQx2HGZzPLS+L5oRG/ObEefeIopLE X-Received: by 2002:a9d:3b8:: with SMTP id f53mr1013266otf.180.1575324074757; Mon, 02 Dec 2019 14:01:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575324074; cv=none; d=google.com; s=arc-20160816; b=POQJjPQ/+fanT1BOXwk3zeEK8+RFyBhfU553UVwzhPW1PVP9PI5WsAseL5hRtJyq0k +F5PMg3M9XcUyzMQMcXv2EbLxfTWaU51KQpnuusm5wAYi/cWEA8DErkeAE/xZxp7D54h o+7pFn2j+Nni15ZZJHZINVdldbJqnkJQl4xVVNlEG69CfE1vw07L1yZ7Acs0SU0I4ztr TfSOvGgKTKqs8F0u59HguhDUHoajk0cyQhM+nmq+YJEuMNS4zu7IQTM7nu4eAJZQHitp 4akw6Cl17WcwESYwOK7sQucagGRfxBZpF673nSGm86RGbZpRZPc6GEF22LMjUBFSjHfN UbDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=AouDAgA+J4VybjzNvK6JJ1TaiqXLV/JGnpANufytYVM=; b=iz01LqpUZAwhETbHjUJYP/dHZIXbnNP2zjPjkZ65wUSgNlIM/gUTe3FIOhcMWm6zQF llr7yN3vjIA7oL5Af1ZWT7LjlnicihmCQZTvveDl7YllblSyUp8A8rfjN88P+GLSZoK5 /+6KWBp7yJzhdanl8Vm56rcyrDuBDZu77IU+KW4qd/SewwCqEW8sryIARkyE7VjAqabV +jTPRLUCMgnz6wAVvuZE2TQON8oCo0bVE1kQ0CIojhfWCzsL64cbl2PiECkc1zt8yl+C fp0A5q9K/bcs6TkInybuNIlf2ASkdHXcMvHdGvUBwVgybnvXJnyCG3BJ1qSxa6rNm3fq nG9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=NWARLlNt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q5si199183otn.33.2019.12.02.14.01.00; Mon, 02 Dec 2019 14:01:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@linux-foundation.org header.s=google header.b=NWARLlNt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726474AbfLBV6S (ORCPT + 99 others); Mon, 2 Dec 2019 16:58:18 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:34022 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725874AbfLBV6R (ORCPT ); Mon, 2 Dec 2019 16:58:17 -0500 Received: by mail-lj1-f194.google.com with SMTP id m6so1326847ljc.1 for ; Mon, 02 Dec 2019 13:58:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AouDAgA+J4VybjzNvK6JJ1TaiqXLV/JGnpANufytYVM=; b=NWARLlNt+JDbaPQTlbt/lW+z4ZiRUQtoroXOODH5gyyBcR1jSXyl99/JGwHHvI6rjG ilQ6WOfhi1QDoOdZ6MgYvA4Ur6Mi4YohIK3ZW3Dp7b/Fg7mABEzEeRZ9HfixQdriPM3I hXluwApQE6wB/zXtq0ygo/a7X7Oyr+BrlkUV4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AouDAgA+J4VybjzNvK6JJ1TaiqXLV/JGnpANufytYVM=; b=OCbkhjX1jEY77aIn4Qc3pde8lYrRpXOFPjTW4twydEf5avCRXhbXPPxIIPlwnD+Ksu sBiphV/vxXSwAxZvdjqiAF5bKwbWwpqGIqGdBR+zHnc0meLefCrgugc+o7dg8BFo8dra lmh3+0M2NpI6LjVhHrXGgJ87MNHM2OwMqFxhh1zeV6Hts9mvaITobkb9hPq9UbMNlMl8 sEb64LXN+cf1F7ohGJR3umaCo7Kq52STZISa0oHLSbOnsRK2r0wf5IXqsDoJ4b6gyL9A 8f1ojmb5rbwgvEdZ9L3TFYoe37jS4CdgnolGTaifXT1baf/WV0SSBMg03hD4dX+JrpIp wwBw== X-Gm-Message-State: APjAAAX195JluCSMumLo0atRvhmoilMuqRQ0p0NUX0HK7EOTxznmkj1G LGgxwwr54cBJo9n3QDTZevO3E8N0e2o= X-Received: by 2002:a2e:161b:: with SMTP id w27mr565865ljd.183.1575323894650; Mon, 02 Dec 2019 13:58:14 -0800 (PST) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id b190sm219852lfd.39.2019.12.02.13.58.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Dec 2019 13:58:13 -0800 (PST) Received: by mail-lj1-f178.google.com with SMTP id z17so1234535ljk.13 for ; Mon, 02 Dec 2019 13:58:13 -0800 (PST) X-Received: by 2002:a2e:9041:: with SMTP id n1mr568601ljg.133.1575323892985; Mon, 02 Dec 2019 13:58:12 -0800 (PST) MIME-Version: 1.0 References: <1575137443.5563.18.camel@HansenPartnership.com> In-Reply-To: <1575137443.5563.18.camel@HansenPartnership.com> From: Linus Torvalds Date: Mon, 2 Dec 2019 13:57:57 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] first round of SCSI updates for the 5.4+ merge window To: James Bottomley , Al Viro , Arnd Bergmann Cc: Andrew Morton , linux-scsi , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 30, 2019 at 10:10 AM James Bottomley wrote: > > The two major core > changes are Al Viro's reworking of sg's handling of copy to/from user, > Ming Lei's removal of the host busy counter to avoid contention in the > multiqueue case and Damien Le Moal's fixing of residual tracking across > error handling. Math is hard. You say "The two major core changes are.." and then you list _three_ changes. Anyway, the sg copyin/out changes by Al conflicted fairly badly with Arnd's compat_ioctl changes. Al did c35a5cfb4150 ("scsi: sg: sg_read(): simplify reading ->pack_id of userland sg_io_hdr_t") which avoided doing a whole allocation of an 'sg_io_hdr_t' to just read the one field of it. But Arnd did 98aaaec4a150 ("compat_ioctl: reimplement SG_IO handling") which created a get_sg_io_hdr() helper that copied the 'sg_io_hdr_t' from user space the right way for both compat and native, which basically relied on the old approach. So I effectively reverted Al's patch in order to take Arnd's patch in the crazy sg legacy case that presumably nobody really cares about anyway, since everybody should use SG_IO rather than the sg_read() thing. But I know not everybody is. I added a comment in that place: /* * This is stupid. * * We're copying the whole sg_io_hdr_t from user * space just to get the 'pack_id' field. But the * field is at different offsets for the compat * case, so we'll use "get_sg_io_hdr()" to copy * the whole thing and convert it. * * We could do something like just calculating the * offset based of 'in_compat_syscall()', but the * 'compat_sg_io_hdr' definition is in the wrong * place for that. */ since it turns out that the one 'pack_id' field we want does have the same format in compat mode as in native mode ("int" and "compat_int_t" are the same), it's just at different offsets. But the definition of 'compat_sg_io_hdr' isn't available in that place. I'm leaving it to Al and Arnd to decide if they want to fix the stupidity. I tried to make the minimally invasive merge resolution. Al, Arnd? Comments? It looks like linux-next punted on this entirely, and took Al's simplified version that doesn't work with the compat case. Maybe I should have done the same - if you use read() on the /dev/sg* device, you deserve to get broken for the compat case. And it didn't historically work anyway. But it was kind of sad to see how Arnd fixed it, and then it got broken again. I really really wish we could get rid of sg_read/sg_write() entirely, and have SG_IO_SUBMIT and SG_IO_RECEIVE ioctl's that can handle the queued cases that apparently some people need. Because the read/write case really is disgusting. Linus