Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2078875imj; Fri, 8 Feb 2019 12:11:39 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib+EDeP9XwvyNeqQ26wKJ7DVyWgz8rLeUN8fAgLylOurpvFah1gEiEmdM68BtOnIP/co0WV X-Received: by 2002:a17:902:d83:: with SMTP id 3mr24139382plv.43.1549656699248; Fri, 08 Feb 2019 12:11:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549656699; cv=none; d=google.com; s=arc-20160816; b=YFXxsYI7NG3EowVu7Ll8Oryjq++BwAwGN8ak10iv6TTa7lWDUGMwAuqpfLP43frfxb Cuwc0Xi7kb81+6vpA15L65CxtTq3E+EUUNFIxAMFQlrEVoTg6Yt8KD5C6k5qNtAX+y5D hQHFkhsy5e+3j1nIoUsW6Y7iehTSmM+wmUoyM2gjV/eCzxAQlwpXA388OlpdBkAS6vet gc552Vwlsq/ObunsKwkmRzi1DHwDUp2XN5M1Ex+7a0A8ES6N2m4HNp2KYUeAfguByjb/ 4Lp8ipJ5RJtKLnjm2xyXQlgPaBQYm/HKqb+Ra761nUWeQjgF3qfOl5FYZJpeELc8xRmc Y7xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=B76XaR3QbTOtqsBdcaeIxymXrVQmlo80RwxPpo88CS0=; b=VnFnBKTYqOp80MAUWWiII4j/Mg3D/EiF/I3zf5Nd/8XexrBcFQm94XqQUUhpwbZzmM pncWmJOewF5SfJXvxQIfO8tpFik88IaWR3349+k12twBGh1OHKYnUyX1LLs39HD5nI/1 0oMbhb+MSXQyimfZcq1CUOtcJxHInWL4iPzAdbEGBeoG8MuQ6kakzWwqIFOyGd8iAEDH KjVMb5xRU27m53fgeQJYbSS9ubjQLkPST1H1B1qlPAS2SUMJyfx0ZYrsHHga3FVjZ0vN 8bQXpMbXvUTTD6nkvFCofjRRvQfIjoyR/h2LrFh7umnpd2eU8K7gWLNiGMThxzhQTGQh 8vxw== 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; dmarc=fail (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 w2si2788133pgp.546.2019.02.08.12.11.23; Fri, 08 Feb 2019 12:11:39 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727642AbfBHUKv (ORCPT + 99 others); Fri, 8 Feb 2019 15:10:51 -0500 Received: from fieldses.org ([173.255.197.46]:57022 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbfBHUKt (ORCPT ); Fri, 8 Feb 2019 15:10:49 -0500 Received: by fieldses.org (Postfix, from userid 2815) id BE6B31CE7; Fri, 8 Feb 2019 15:10:48 -0500 (EST) From: "J. Bruce Fields" To: linux-nfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Trond Myklebust , Jeff Layton , David Howells , Tejun Heo , Peter Zijlstra , Shaohua Li , Oleg Nesterov , "J. Bruce Fields" Subject: [PATCH 0/7] Eliminate delegation self-conflicts Date: Fri, 8 Feb 2019 15:10:40 -0500 Message-Id: <1549656647-25115-1-git-send-email-bfields@redhat.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "J. Bruce Fields" These patches allow NFSv4 clients holding delegations to keep them when the operation that would break a delegation comes from the same client. To do that, we somehow need to pass the identity of the delegation-breaker down through the VFS. This series uses the tgid, a solution suggested by Trond. To do that we need nfsd tasks to share the same tgid. I do that by extending the kthread code slightly to allow knfsd to run the kthreadd main loop in a task of its own, and spawn its server threads off of that task. Part of Trond's thinking was that this would work for userspace too. Delegations are currently only available to knfsd, but Ganesha and Samba may eventually be interested in a userspace interface (probably a minor variation on the fcntl F_{GET,SET}LEASE interface). A threaded userspace server would first resolve conflicts between its own clients, and then call into the kernel to break any leases acquired by other processes. That may require some careful locking of the server's own data structures, but it should work. Previously I considered instead adding a new field somewhere in the struct task. That might require a new system call to expose to user space. Or we might be able to put this in a keyring, if David Howells thought that would work. Before that I tried passing the identity of the breaker explicitly, but that looks like it would require passing the new argument around to huge swaths of the VFS. I'm testing this with some a locally modified pynfs; I'll fix that up and push it out at some point, but pynfs has a number of bugs in this area. I wasn't sure who to ask about the kthread.c changes, so I'm cc'ing a random assortment of developers in recent changelogs, hope that's OK. --b. J. Bruce Fields (7): kthreads: minor kthreadd refactoring kthreads: Simplify tsk_fork_get_node kthreads: allow multiple kthreadd's kthreads: allow cloning threads with different flags rpc: separate out body of svc_start_kthreads rpc: move rpc server threads into their own thread group nfsd: ignore delegation self-conflicts fs/locks.c | 39 +++++++++++ fs/nfsd/nfs4state.c | 61 ++++++++++++++++ fs/nfsd/state.h | 2 + fs/nfsd/vfs.c | 32 +++++++-- include/linux/fs.h | 2 + include/linux/kthread.h | 21 +++++- include/linux/sunrpc/svc.h | 1 + init/init_task.c | 3 + init/main.c | 4 +- kernel/fork.c | 4 ++ kernel/kthread.c | 140 +++++++++++++++++++++++++++---------- net/sunrpc/svc.c | 83 ++++++++++++++-------- 12 files changed, 317 insertions(+), 75 deletions(-) -- 2.20.1