Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1248859

[PATCH v11 39/48] nfsd: Add support for unmapped richace identifiers

From Andreas Gruenbacher <agruenba@redhat.com>
Newsgroups linux.kernel
Subject [PATCH v11 39/48] nfsd: Add support for unmapped richace identifiers
Date 2015-10-16 17:30 +0200
Message-ID <qkf7b-1SN-3@gated-at.bofh.it> (permalink)
References <qkeXv-1Ha-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <agruenba@redhat.com>
---
 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;
 		}
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v11 00/48] Richacls Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:20 +0200
  [PATCH v11 10/48] vfs: Cache base_acl objects in inodes Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:20 +0200
  [PATCH v11 04/48] vfs: Make the inode passed to inode_change_ok non-const Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:20 +0200
  [PATCH v11 11/48] vfs: Add get_richacl and set_richacl inode operations Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:20 +0200
  [PATCH v11 05/48] vfs: Add permission flags for setting file attributes Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:20 +0200
  [PATCH v11 06/48] richacl: In-memory representation and helper functions Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:20 +0200
  [PATCH v11 01/48] vfs: Add IS_ACL() and IS_RICHACL() tests Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:20 +0200
  [PATCH v11 03/48] vfs: Add MAY_DELETE_SELF and MAY_DELETE_CHILD permission flags Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:20 +0200
  [PATCH v11 41/48] xfs: Don't allow unmapped identifiers in richacls Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 39/48] nfsd: Add support for unmapped richace identifiers Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 25/48] richacl: acl editing helper functions Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 22/48] xfs: Fix error path in xfs_get_acl Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 46/48] nfs: Distinguish missing users and groups from nobody Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 42/48] sunrpc: Allow to demand-allocate pages to encode into Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 31/48] richacl: Apply the file masks to a richacl Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 29/48] richacl: Set the other permissions to the other mask Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 38/48] richacl: Add support for unmapped identifiers Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 48/48] nfs: Add support for the v4.1 dacl attribute Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 24/48] xfs: Add richacl support Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 45/48] nfs: Remove unused xdr page offsets in getacl/setacl arguments Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 47/48] nfs: Add richacl support Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 12/48] vfs: Cache richacl in struct inode Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 19/48] vfs: Add richacl permission checking Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 23/48] xfs: Make xfs_set_mode non-static Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 21/48] ext4: Add richacl feature flag Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
    Re: [PATCH v11 21/48] ext4: Add richacl feature flag Austin S Hemmelgarn <ahferroin7@gmail.com> - 2015-10-16 19:40 +0200
      Re: [PATCH v11 21/48] ext4: Add richacl feature flag Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 19:50 +0200
        Re: [PATCH v11 21/48] ext4: Add richacl feature flag Austin S Hemmelgarn <ahferroin7@gmail.com> - 2015-10-16 20:30 +0200
          Re: [PATCH v11 21/48] ext4: Add richacl feature flag Dave Chinner <david@fromorbit.com> - 2015-10-18 01:30 +0200
  [PATCH v11 44/48] nfs: Fix GETATTR bitmap verification Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 37/48] nfsd: Add support for the MAY_CREATE_{FILE,DIR} permissions Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 16/48] richacl: Automatic Inheritance Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
    Re: [PATCH v11 16/48] richacl: Automatic Inheritance Andy Lutomirski <luto@amacapital.net> - 2015-10-16 18:10 +0200
      Re: [PATCH v11 16/48] richacl: Automatic Inheritance Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 18:20 +0200
  [PATCH v11 18/48] richacl: Add richacl xattr handler Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 43/48] sunrpc: Add xdr_init_encode_pages Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 28/48] richacl: Set the owner permissions to the owner mask Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 36/48] nfsd: Add support for the v4.1 dacl attribute Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 35/48] nfsd: Add richacl support Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 13/48] richacl: Update the file masks in chmod() Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 30/48] richacl: Isolate the owner and group classes Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 20/48] ext4: Add richacl support Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 27/48] richacl: Propagate everyone@ permissions to other aces Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:30 +0200
  [PATCH v11 40/48] ext4: Don't allow unmapped identifiers in richacls Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:40 +0200
  [PATCH v11 26/48] richacl: Move everyone@ aces down the acl Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:50 +0200
  [PATCH v11 33/48] nfsd: Keep list of acls to dispose of in compoundargs Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:50 +0200
  [PATCH v11 32/48] richacl: Create richacl from mode values Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:50 +0200
  [PATCH v11 34/48] nfsd: Use richacls as internal acl representation Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 17:50 +0200
  [PATCH v11 15/48] richacl: Create-time inheritance Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 18:00 +0200
  [PATCH v11 17/48] richacl: xattr mapping functions Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 18:00 +0200
  [PATCH v11 14/48] richacl: Check if an acl is equivalent to a file mode Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 18:10 +0200
  [PATCH v11 09/48] richacl: Permission check algorithm Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-16 18:10 +0200

csiph-web