From patchwork Tue Nov 3 15:17:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Gruenbacher X-Patchwork-Id: 7544141 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 900CDBEEA4 for ; Tue, 3 Nov 2015 15:33:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC78020465 for ; Tue, 3 Nov 2015 15:33:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D74AC203E3 for ; Tue, 3 Nov 2015 15:32:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964920AbbKCPWc (ORCPT ); Tue, 3 Nov 2015 10:22:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36932 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932337AbbKCPW3 (ORCPT ); Tue, 3 Nov 2015 10:22:29 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 3D1EDA37F8; Tue, 3 Nov 2015 15:22:29 +0000 (UTC) Received: from nux.redhat.com (vpn1-5-101.ams2.redhat.com [10.36.5.101]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA3FHRa8029477; Tue, 3 Nov 2015 10:22:22 -0500 From: Andreas Gruenbacher To: Alexander Viro , "Theodore Ts'o" , Andreas Dilger , "J. Bruce Fields" , Jeff Layton , Trond Myklebust , Anna Schumaker , Dave Chinner , linux-ext4@vger.kernel.org, xfs@oss.sgi.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-api@vger.kernel.org Cc: Andreas Gruenbacher Subject: [PATCH v13 42/51] nfsd: Add support for unmapped richace identifiers Date: Tue, 3 Nov 2015 16:17:18 +0100 Message-Id: <1446563847-14005-43-git-send-email-agruenba@redhat.com> In-Reply-To: <1446563847-14005-1-git-send-email-agruenba@redhat.com> References: <1446563847-14005-1-git-send-email-agruenba@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 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=unavailable 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 Add support for encoding unmapped identifiers in richacl entries: local filesystems are not usually supposed to store unmapped identifiers, but allowing that for debugging purposes can be useful; for that, nfsd must also be able to encode them. Signed-off-by: Andreas Gruenbacher --- fs/nfsd/acl.h | 2 +- fs/nfsd/nfs4acl.c | 17 +++++++++++------ fs/nfsd/nfs4xdr.c | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/fs/nfsd/acl.h b/fs/nfsd/acl.h index d73c664..4935144 100644 --- a/fs/nfsd/acl.h +++ b/fs/nfsd/acl.h @@ -51,7 +51,7 @@ struct svc_rqst; __be32 nfsd4_decode_ace_who(struct richace *ace, struct svc_rqst *rqstp, char *who, u32 len); __be32 nfsd4_encode_ace_who(struct xdr_stream *xdr, struct svc_rqst *rqstp, - struct richace *ace); + struct richace *ace, struct richacl *acl); struct richacl *nfsd4_get_acl(struct svc_rqst *rqstp, struct dentry *dentry); __be32 nfsd4_set_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index f017a76..3cc83fd 100644 --- a/fs/nfsd/nfs4acl.c +++ b/fs/nfsd/nfs4acl.c @@ -885,17 +885,22 @@ __be32 nfsd4_decode_ace_who(struct richace *ace, struct svc_rqst *rqstp, } __be32 nfsd4_encode_ace_who(struct xdr_stream *xdr, struct svc_rqst *rqstp, - struct richace *ace) + struct richace *ace, struct richacl *acl) { - if (ace->e_flags & RICHACE_SPECIAL_WHO) { - unsigned int special_id = ace->e_id.special; + if (ace->e_flags & (RICHACE_SPECIAL_WHO | RICHACE_UNMAPPED_WHO)) { const char *who; unsigned int len; __be32 *p; - if (!nfs4acl_special_id_to_who(special_id, &who, &len)) { - WARN_ON_ONCE(1); - return nfserr_serverfault; + if (ace->e_flags & RICHACE_SPECIAL_WHO) { + if (!nfs4acl_special_id_to_who(ace->e_id.special, + &who, &len)) { + WARN_ON_ONCE(1); + return nfserr_serverfault; + } + } else { + who = richace_unmapped_identifier(ace, acl); + len = strlen(who); } p = xdr_reserve_space(xdr, len + 4); if (!p) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 33d028c..8728d0e 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2325,7 +2325,7 @@ static __be32 nfsd4_encode_acl_entries(struct xdr_stream *xdr, { __be32 *p; - flags_mask &= ~RICHACE_SPECIAL_WHO; + flags_mask &= ~(RICHACE_SPECIAL_WHO | RICHACE_UNMAPPED_WHO); p = xdr_reserve_space(xdr, 4); if (!p) @@ -2347,7 +2347,7 @@ static __be32 nfsd4_encode_acl_entries(struct xdr_stream *xdr, *p++ = cpu_to_be32(ace->e_type); *p++ = cpu_to_be32(ace->e_flags & flags_mask); *p++ = cpu_to_be32(ace->e_mask & ace_mask); - status = nfsd4_encode_ace_who(xdr, rqstp, ace); + status = nfsd4_encode_ace_who(xdr, rqstp, ace, acl); if (status) return status; }