Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1336971ybm; Tue, 21 May 2019 12:21:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0qB7493zH6S0mo7CvxLZuz4cw7Vc/cUitVztyg6MYiFegx7lCDouiPoJse5JiVmsrKW/L X-Received: by 2002:a63:1d05:: with SMTP id d5mr83931510pgd.157.1558466507514; Tue, 21 May 2019 12:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558466507; cv=none; d=google.com; s=arc-20160816; b=qzav5be0bolscO0oPEODkDqu6LaeGK/+szMTUZGHoR+d9uX+5dSIGZRk8phBHCDY8P s9cp+Gfn0zNRmRW0VX0I6q3ffhMY24O3tAHGsgi6v1NcGS6odpNvw9FjIzRkE8MX2kBB aqnVgNvCsT+WRxE7ixMPfnFIQuPL5wy/SeOYngH6eEztYnXFkRcBQhz9Pe32FzYGFgJP MdozQjUxgKmJHh77uR0YL+BVZJOFYKEvwMbdps7yMyKNMMfkUiz+Y5DKAN3FIC8cEbHg LkOU1/sJ+UJyELv57C8yjftW1Jy4OyIYo8UnIsmRz5ANFA3TzFGvC49QvuAOcVXieXd2 ts5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=eS2kZd/cwF2rQ2RKoYQFf1O4YDgd1pDaETYfOuSqSvA=; b=QTILriYzx2y2AHewYoxUvA1hLcmk0GsnBgiNziThbkK5MlXgETeRuS9m9zkA4mshAJ cefHIh2Jqvbxou4BAWlL9YSJwqECs+OwffNlk2GhxQNVTrhI02F7PN87dangMSszlGII 4MTYgnyLZpQNSBIFE5KskL843TNabFtr1WzZzCutS0IteJUi8UYA0Za/tAJm4RGQTdvp sSghBPby0Saq8VYc0cJKq24nQkX2xgAEilLJlMKBiLk3k6TO/k2pbzyu6fWhH+WvdTvt tc2VtwKtwv5PDyh6U7DfEUconEYK5Umjrr768SoN1c1UkS/blV6eOq+AGsmjmzxcw5zf 6oBQ== ARC-Authentication-Results: i=1; mx.google.com; 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 d10si19203295pla.406.2019.05.21.12.21.30; Tue, 21 May 2019 12:21:47 -0700 (PDT) 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; 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 S1727304AbfEUTUX (ORCPT + 99 others); Tue, 21 May 2019 15:20:23 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:37620 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726525AbfEUTUW (ORCPT ); Tue, 21 May 2019 15:20:22 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hTAIz-0003v8-BX; Tue, 21 May 2019 19:20:09 +0000 Date: Tue, 21 May 2019 20:20:09 +0100 From: Al Viro To: David Howells Cc: Christian Brauner , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, jannh@google.com, fweimer@redhat.com, oleg@redhat.com, tglx@linutronix.de, torvalds@linux-foundation.org, arnd@arndb.de, shuah@kernel.org, tkjos@android.com, ldv@altlinux.org, miklos@szeredi.hu, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 1/2] open: add close_range() Message-ID: <20190521192009.GK17978@ZenIV.linux.org.uk> References: <20190521150006.GJ17978@ZenIV.linux.org.uk> <20190521113448.20654-1-christian@brauner.io> <28114.1558456227@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <28114.1558456227@warthog.procyon.org.uk> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 21, 2019 at 05:30:27PM +0100, David Howells wrote: > If we can live with close_from(int first) rather than close_range(), then this > can perhaps be done a lot more efficiently by: > > new = alloc_fdtable(first); > spin_lock(&files->file_lock); > old = files_fdtable(files); > copy_fds(new, old, 0, first - 1); > rcu_assign_pointer(files->fdt, new); > spin_unlock(&files->file_lock); > clear_fds(old, 0, first - 1); > close_fdt_from(old, first); > kfree_rcu(old); I really hate to think how that would interact with POSIX locks...