Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2000904ybh; Sun, 4 Aug 2019 15:15:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVrRNpvVlqOSkReeWvaEmOTMpKCH8z/f82MjgBK5aCZe71xee88+NXgbsxlnaDGjKWM2om X-Received: by 2002:a17:90a:bb01:: with SMTP id u1mr14760624pjr.92.1564956952021; Sun, 04 Aug 2019 15:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564956952; cv=none; d=google.com; s=arc-20160816; b=xbxFhKFmfs5rZyX5TdI1tsPwnemBqEpvXnPH8V0efoFHOPbs6ktPfmcnTdkx/AHJ/F mRmnmyrpKUwd26Lv/DAIow+zSu6pIh/NGi7lYXc8H3Vx3/ZeniMmgBtTw1/2ZlFcxXg5 EZO9wX8/ZefmrpvysjOfM1H2Tojjxagqeojgx+wZLO6OgiUnIMSXJrWeR9ZCt5QHjy32 iRP1MnjwubXVJulluK/4Klc3R4t2guSPShhs+GlAk7tl5zZG1scsAkLY1B7iluN3I/ms 2a2B6/dHvleEYgM07AkJ8kID/f+A55u0ulx6nI1WVMDkngSKDumttq3MEBQhQ84tQCOG +x8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=v677hrxlPeLshJiXI80y6YO+c3xmiuK/L7QylOvvo1Q=; b=RMhJOvTZVYIs7ogrCfzqJnvxGdNYVCuhULtw7tbbwMLrQeIVdzyF7227qpV1ndNzrj YMTcurhT1VjmMhEPY1QLMNJ2MbQqRhBC/bDupLUIgbhViDqSlE4/IDngLeXmpslpz6vy lNnHv4fvrADzjPbYX9BaNr2t1ub3MVtTzMyYlpnIThgEpVW92tE91QTPb8j5Rk2wFxk0 SHEdWQBmjtgqHrteFOfEO3rHrE2jmtGyalr1zRp66mVyAscANWBpZ+/KSw90Vx45ukY4 X+RFSzDvTG90vWVYOEybXj83DtY35KHOyaUbYl6uoRgEHlnabA4K6GjeX1aVtIS2vvEr 6kAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=dPnqfpD8; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10si11110230pjp.74.2019.08.04.15.15.04; Sun, 04 Aug 2019 15:15:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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=@nvidia.com header.s=n1 header.b=dPnqfpD8; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbfHDWIQ (ORCPT + 99 others); Sun, 4 Aug 2019 18:08:16 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:11347 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726346AbfHDWIQ (ORCPT ); Sun, 4 Aug 2019 18:08:16 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Sun, 04 Aug 2019 15:08:16 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Sun, 04 Aug 2019 15:08:15 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Sun, 04 Aug 2019 15:08:15 -0700 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 4 Aug 2019 22:08:12 +0000 Subject: Re: [PATCH] NFSv4: Fix a potential sleep while atomic in nfs4_do_reclaim() To: Trond Myklebust CC: "linux-nfs@vger.kernel.org" References: <20190803144042.15187-1-trond.myklebust@hammerspace.com> <47e39b00da52c3b873f6f23b420cbc8b3ad9139e.camel@hammerspace.com> X-Nvconfidentiality: public From: John Hubbard Message-ID: Date: Sun, 4 Aug 2019 15:08:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <47e39b00da52c3b873f6f23b420cbc8b3ad9139e.camel@hammerspace.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL104.nvidia.com (172.18.146.11) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1564956496; bh=v677hrxlPeLshJiXI80y6YO+c3xmiuK/L7QylOvvo1Q=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=dPnqfpD8u8y6IjPAHAMTC51Rr0Br9/fCUmIX8x9YTh733HzgdRvelxh6ko0rYziMi OAoOjh0ao04QzZsMMlOVCf9nSufsbUY1mam/9mxGMQgDF5f53gxDqKD9gPcWkjfKTz jx74VF91zQccu+j5pdEo6NtISA04E1m6dEy2hDanp+bieL+c6qijuJPJhY9NLqLusd 4EkoZwD/6IYcv48ReELu6AuwxWsc/RI+/qYHQwD3OKe6nWunTfHf9wH3myZ7j8Ej1x 1Xo1BA3lBI5qVcISlJapcDPIqPA55OyQkBWj2yhjGpSHqRw5UFyvcNYOi9JJN1vDKl u86IyiSFn0wLQ== Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 8/3/19 3:22 PM, Trond Myklebust wrote: > On Sat, 2019-08-03 at 12:07 -0700, John Hubbard wrote: >> On 8/3/19 7:40 AM, Trond Myklebust wrote: >>> John Hubbard reports seeing the following stack trace: >>> >>> nfs4_do_reclaim >>> rcu_read_lock /* we are now in_atomic() and must not sleep */ >>> nfs4_purge_state_owners >>> nfs4_free_state_owner >>> nfs4_destroy_seqid_counter >>> rpc_destroy_wait_queue >>> cancel_delayed_work_sync >>> __cancel_work_timer >>> __flush_work >>> start_flush_work >>> might_sleep: >>> (kernel/workqueue.c:2975: >>> BUG) >>> >>> The solution is to separate out the freeing of the state owners >>> from nfs4_purge_state_owners(), and perform that outside the atomic >>> context. >>> >> >> All better now--this definitely fixes it. I can reboot the server, >> and >> of course that backtrace is gone. Then the client mounts hang, so I >> do >> a mount -a -o remount, and after about 1 minute, the client mounts >> start working again, with no indication of problems. I assume that >> the >> pause is by design--timing out somewhere, to recover from the server >> going missing for a while. If so, then all is well. >> > > Thanks very much for the report, and for testing! > > With regards to the 1 minute delay, I strongly suspect that what you > are seeing is the NFSv4 "grace period". > > After a NFSv4.x server reboot, the clients are given a certain amount > of time in which to recover the file open state and lock state that > they may have held before the reboot. All non-recovery opens, locks and > all I/O are stopped while this recovery process is happening to ensure > that locking conflicts do not occur. This ensures that all locks can > survive server reboots without any loss of atomicity. > > With NFSv4.1 and NFSv4.2, the server can determine when all the clients > have finished recovering state and end the grace period early, however > I've recently seen cases where that was not happening. I'm not sure yet > if that is a real server regression. > Aha, thanks for explaining. It's great to see such refined behavior now from NFS, definitely enjoying v4! :) thanks, -- John Hubbard NVIDIA