kraxel / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
a0e7ac1
From patchwork Sat Apr 20 10:15:48 2019
a0e7ac1
Content-Type: text/plain; charset="utf-8"
a0e7ac1
MIME-Version: 1.0
a0e7ac1
Content-Transfer-Encoding: 7bit
a0e7ac1
X-Patchwork-Submitter: Jeff Layton <jlayton@kernel.org>
a0e7ac1
X-Patchwork-Id: 10910147
a0e7ac1
Return-Path: <linux-nfs-owner@kernel.org>
a0e7ac1
Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
a0e7ac1
 [172.30.200.125])
a0e7ac1
	by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C1AE14DB
a0e7ac1
	for <patchwork-linux-nfs@patchwork.kernel.org>;
a0e7ac1
 Sat, 20 Apr 2019 10:15:53 +0000 (UTC)
a0e7ac1
Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
a0e7ac1
	by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E858821FAC
a0e7ac1
	for <patchwork-linux-nfs@patchwork.kernel.org>;
a0e7ac1
 Sat, 20 Apr 2019 10:15:52 +0000 (UTC)
a0e7ac1
Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
a0e7ac1
	id D5EA228818; Sat, 20 Apr 2019 10:15:52 +0000 (UTC)
a0e7ac1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
a0e7ac1
	pdx-wl-mail.web.codeaurora.org
a0e7ac1
X-Spam-Level: 
a0e7ac1
X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED,
a0e7ac1
	DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham
a0e7ac1
	version=3.3.1
a0e7ac1
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
a0e7ac1
	by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF69021FAC
a0e7ac1
	for <patchwork-linux-nfs@patchwork.kernel.org>;
a0e7ac1
 Sat, 20 Apr 2019 10:15:51 +0000 (UTC)
a0e7ac1
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
a0e7ac1
        id S1726082AbfDTKPu (ORCPT
a0e7ac1
        <rfc822;patchwork-linux-nfs@patchwork.kernel.org>);
a0e7ac1
        Sat, 20 Apr 2019 06:15:50 -0400
a0e7ac1
Received: from mail.kernel.org ([198.145.29.99]:36092 "EHLO mail.kernel.org"
a0e7ac1
        rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
a0e7ac1
        id S1725920AbfDTKPu (ORCPT <rfc822;linux-nfs@vger.kernel.org>);
a0e7ac1
        Sat, 20 Apr 2019 06:15:50 -0400
a0e7ac1
Received: from tleilax.poochiereds.net (cpe-71-70-156-158.nc.res.rr.com
a0e7ac1
 [71.70.156.158])
a0e7ac1
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
a0e7ac1
        (No client certificate requested)
a0e7ac1
        by mail.kernel.org (Postfix) with ESMTPSA id 649D32087B;
a0e7ac1
        Sat, 20 Apr 2019 10:15:49 +0000 (UTC)
a0e7ac1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
a0e7ac1
        s=default; t=1555755349;
a0e7ac1
        bh=Sqynm2vSbQ1pAh/3FcXrwFTMrJUwFTkrxoodJHFBfA0=;
a0e7ac1
        h=From:To:Cc:Subject:Date:From;
a0e7ac1
        b=TFlYii+F3H67zOX8b/mENa/XRCx1SjMI2/gLtscPnA5l6T0dG8aC/E+FJLvMeNLHo
a0e7ac1
         pu2zlPSdszk+MBMfWQrfUpKGCP7CPqfyk7F1rXRIr6kNYp2tE2gKYyIWvCkVPE45iX
a0e7ac1
         LngnHXERmf/R52j7gg2ENj+yjuOh07AifhxH1J00=
a0e7ac1
From: Jeff Layton <jlayton@kernel.org>
a0e7ac1
To: bfields@fieldses.org
a0e7ac1
Cc: slawek1211@gmail.com, neilb@suse.com, linux-nfs@vger.kernel.org
a0e7ac1
Subject: [PATCH] nfsd: wake waiters blocked on file_lock before deleting it
a0e7ac1
Date: Sat, 20 Apr 2019 06:15:48 -0400
a0e7ac1
Message-Id: <20190420101548.8552-1-jlayton@kernel.org>
a0e7ac1
X-Mailer: git-send-email 2.20.1
a0e7ac1
MIME-Version: 1.0
a0e7ac1
Sender: linux-nfs-owner@vger.kernel.org
a0e7ac1
Precedence: bulk
a0e7ac1
List-ID: <linux-nfs.vger.kernel.org>
a0e7ac1
X-Mailing-List: linux-nfs@vger.kernel.org
a0e7ac1
X-Virus-Scanned: ClamAV using ClamSMTP
a0e7ac1
a0e7ac1
After a blocked nfsd file_lock request is deleted, knfsd will send a
a0e7ac1
callback to the client and then free the request. Commit 16306a61d3b7
a0e7ac1
("fs/locks: always delete_block after waiting.") changed it such that
a0e7ac1
locks_delete_block is always called on a request after it is awoken,
a0e7ac1
but that patch missed fixing up blocked nfsd request handling.
a0e7ac1
a0e7ac1
Call locks_delete_block on the block to wake up any locks still blocked
a0e7ac1
on the nfsd lock request before sending the callback.
a0e7ac1
a0e7ac1
URL: https://bugzilla.kernel.org/show_bug.cgi?id=203363
a0e7ac1
Fixes: 16306a61d3b7 ("fs/locks: always delete_block after waiting.")
a0e7ac1
Reported-by: Slawomir Pryczek <slawek1211@gmail.com>
a0e7ac1
Cc: Neil Brown <neilb@suse.com>
a0e7ac1
Signed-off-by: Jeff Layton <jlayton@kernel.org>
a0e7ac1
---
a0e7ac1
 fs/nfsd/nfs4state.c | 9 +++++++++
a0e7ac1
 1 file changed, 9 insertions(+)
a0e7ac1
a0e7ac1
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
a0e7ac1
index 6a45fb00c5fc..1960e8fd9ad1 100644
a0e7ac1
--- a/fs/nfsd/nfs4state.c
a0e7ac1
+++ b/fs/nfsd/nfs4state.c
a0e7ac1
@@ -298,6 +298,14 @@ remove_blocked_locks(struct nfs4_lockowner *lo)
a0e7ac1
 	}
a0e7ac1
 }
a0e7ac1
 
a0e7ac1
+static void
a0e7ac1
+nfsd4_cb_notify_lock_prepare(struct nfsd4_callback *cb)
a0e7ac1
+{
a0e7ac1
+	struct nfsd4_blocked_lock	*nbl = container_of(cb,
a0e7ac1
+						struct nfsd4_blocked_lock, nbl_cb);
a0e7ac1
+	locks_delete_block(&nbl->nbl_lock);
a0e7ac1
+}
a0e7ac1
+
a0e7ac1
 static int
a0e7ac1
 nfsd4_cb_notify_lock_done(struct nfsd4_callback *cb, struct rpc_task *task)
a0e7ac1
 {
a0e7ac1
@@ -325,6 +333,7 @@ nfsd4_cb_notify_lock_release(struct nfsd4_callback *cb)
a0e7ac1
 }
a0e7ac1
 
a0e7ac1
 static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops = {
a0e7ac1
+	.prepare	= nfsd4_cb_notify_lock_prepare,
a0e7ac1
 	.done		= nfsd4_cb_notify_lock_done,
a0e7ac1
 	.release	= nfsd4_cb_notify_lock_release,
a0e7ac1
 };