From patchwork Wed Nov 4 22:07:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew W Elble X-Patchwork-Id: 7554231 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B353CBEEA4 for ; Wed, 4 Nov 2015 22:07:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC04B20674 for ; Wed, 4 Nov 2015 22:07:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C084720684 for ; Wed, 4 Nov 2015 22:07:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965765AbbKDWHW (ORCPT ); Wed, 4 Nov 2015 17:07:22 -0500 Received: from discipline.rit.edu ([129.21.6.207]:11668 "HELO discipline.rit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S965397AbbKDWHV (ORCPT ); Wed, 4 Nov 2015 17:07:21 -0500 Received: (qmail 6758 invoked by uid 501); 4 Nov 2015 22:07:20 -0000 From: Andrew Elble To: linux-nfs@vger.kernel.org, bfields@fieldses.org, jlayton@poochiereds.net Cc: Andrew Elble Subject: [PATCH] nfsd: fix nfsd4_delegreturn to return correct error codes Date: Wed, 4 Nov 2015 17:07:17 -0500 Message-Id: <1446674837-4980-1-git-send-email-aweits@rit.edu> X-Mailer: git-send-email 2.4.6 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When delegations are revoked: In the NFSv4 case, NFS4ERR_BAD_STATEID In the NFSv4.1 case, NFS4ERR_DELEG_REVOKED Signed-off-by: Andrew Elble Reviewed-by: Jeff Layton --- fs/nfsd/nfs4state.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 66df2903ab8e..0f0634ca4158 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -5147,15 +5147,21 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0))) return status; - status = nfsd4_lookup_stateid(cstate, stateid, NFS4_DELEG_STID, &s, nn); + status = nfsd4_lookup_stateid(cstate, stateid, + NFS4_DELEG_STID|NFS4_REVOKED_DELEG_STID, + &s, nn); if (status) goto out; dp = delegstateid(s); status = check_stateid_generation(stateid, &dp->dl_stid.sc_stateid, nfsd4_has_session(cstate)); if (status) goto put_stateid; - - destroy_delegation(dp); + if (dp->dl_stid.sc_type == NFS4_DELEG_STID) + destroy_delegation(dp); + if (dp->dl_stid.sc_type == NFS4_REVOKED_DELEG_STID) + status = nfserr_bad_stateid; + if (cstate->minorversion) + status = nfserr_deleg_revoked; put_stateid: nfs4_put_stid(&dp->dl_stid); out: