minor cleanup for 3.14
Subsystems (3)
These are just some minor bits of cleanup I'm queueing for 3.14.
--b.
PATCH 1/4 nfsd4: better VERIFY comment
From: "J. Bruce Fields" <[email protected]>
This confuses me every time.
--- fs/nfsd/nfs4proc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/nfsd/nfs4proc.c +4 -2
@@ -1069,8 +1069,10 @@ _nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, cstate->current_fh.fh_dentry, &p, count, verify->ve_bmval, rqstp, 0); - -/* this means that nfsd4_encode_fattr() ran out of space */ +/* +* If nfsd4_encode_fattr() ran out of space, assume that's because +* the attributes are longer (hence different) than those given: +*/ if (status == nfserr_resource) status = nfserr_not_same;if (status)
Signature · 1 line
1.7.9.5
PATCH 2/4 minor svcauth_gss.c cleanup
In reply to J. Bruce FieldsFrom: "J. Bruce Fields" <[email protected]>
--- net/sunrpc/auth_gss/svcauth_gss.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/sunrpc/auth_gss/svcauth_gss.c +2 -5
@@ -1591,8 +1591,7 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp)BUG_ON (integ_len %4 ); *p++ =htonl (integ_len); *p++ =htonl (gc->gc_seq); -if (xdr_buf_subsegment (resbuf, &integ_buf, integ_offset, - integ_len)) +if (xdr_buf_subsegment (resbuf, &integ_buf, integ_offset, integ_len))BUG ();if (resbuf->tail[0 ].iov_base ==NULL ) {if (resbuf->head[0 ].iov_len +RPC_MAX_AUTH_SIZE >PAGE_SIZE )
@@ -1600,10 +1599,8 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp) resbuf->tail[0 ].iov_base = resbuf->head[0 ].iov_base + resbuf->head[0 ].iov_len; resbuf->tail[0 ].iov_len =0 ; - resv = &resbuf->tail[0 ]; - }else { - resv = &resbuf->tail[0 ]; } + resv = &resbuf->tail[0 ]; mic.data = (u8 *)resv->iov_base + resv->iov_len +4 ;if (gss_get_mic (gsd->rsci->mechctx, &integ_buf, &mic)) goto out_err;
Signature · 1 line
1.7.9.5
PATCH 3/4 nfsd4: nfsd4_encode_fattr cleanup
In reply to J. Bruce FieldsFrom: "J. Bruce Fields" <[email protected]>
Remove some pointless goto's.
--- fs/nfsd/nfs4xdr.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
fs/nfsd/nfs4xdr.c +4 -13
@@ -2230,8 +2230,10 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,if ((buflen -=4 ) <0 ) goto out_resource; dummy =nfs4_file_type (stat.mode); -if (dummy ==NF4BAD ) - goto out_serverfault; +if (dummy ==NF4BAD ) { + status = nfserr_serverfault; + goto out; + }WRITE32 (dummy); }if (bmval0 &FATTR4_WORD0_FH_EXPIRE_TYPE ) {
@@ -2325,8 +2327,6 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,WRITE32 (ace->flag);WRITE32 (ace->access_mask &NFS4_ACE_MASK_ALL ); status =nfsd4_encode_aclname (rqstp, ace, &p, &buflen); -if (status == nfserr_resource) - goto out_resource;if (status) goto out; }
@@ -2387,8 +2387,6 @@ out_acl: }if (bmval0 &FATTR4_WORD0_FS_LOCATIONS ) { status =nfsd4_encode_fs_locations (rqstp, exp, &p, &buflen); -if (status == nfserr_resource) - goto out_resource;if (status) goto out; }
@@ -2439,15 +2437,11 @@ out_acl: }if (bmval1 &FATTR4_WORD1_OWNER ) { status =nfsd4_encode_user (rqstp, stat.uid, &p, &buflen); -if (status == nfserr_resource) - goto out_resource;if (status) goto out; }if (bmval1 &FATTR4_WORD1_OWNER_GROUP ) { status =nfsd4_encode_group (rqstp, stat.gid, &p, &buflen); -if (status == nfserr_resource) - goto out_resource;if (status) goto out; }
@@ -2550,9 +2544,6 @@ out_nfserr: out_resource: status = nfserr_resource; goto out; -out_serverfault: - status = nfserr_serverfault; - goto out; }static inline int attributes_need_mount (u32 *bmval)
Signature · 1 line
1.7.9.5
PATCH 4/4 nfsd4: encode_rdattr_error cleanup
In reply to J. Bruce FieldsFrom: "J. Bruce Fields" <[email protected]>
There's a simpler way to write this.
--- fs/nfsd/nfs4xdr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
fs/nfsd/nfs4xdr.c +1 -4
@@ -2620,17 +2620,14 @@ out_put:static __be32 *nfsd4_encode_rdattr_error (__be32 *p,int buflen,__be32 nfserr) { -__be32 *attrlenp; -if (buflen <6 )return NULL ; *p++ =htonl (2 ); *p++ =htonl (FATTR4_WORD0_RDATTR_ERROR );/* bmval0 */ *p++ =htonl (0 );/* bmval1 */ - attrlenp = p++; + *p++ =htonl (4 );/* attribute length */ *p++ = nfserr;/* no htonl */ - *attrlenp =htonl ((char *)p - (char *)attrlenp -4 );return p; }
Signature · 1 line
1.7.9.5
[PATCH 5/4] nfsd4: simplify xdr encoding of nfsv4 names
In reply to J. Bruce FieldsFrom: "J. Bruce Fields" <[email protected]>
We can simplify the idmapping code if it does its own encoding and returns nfs errors.
--- fs/nfsd/acl.h | 2 +- fs/nfsd/idmap.h | 4 ++-- fs/nfsd/nfs4acl.c | 20 +++++++++++++------- fs/nfsd/nfs4idmap.c | 50 ++++++++++++++++++++++++++++++++----------------- fs/nfsd/nfs4xdr.c | 52 ++++++--------------------------------------------- 5 files changed, 55 insertions(+), 73 deletions(-)
Quoted 1 line · J. Bruce Fields
These are just some minor bits of cleanup I'm queueing for 3.14.
And one more.--b.
fs/nfsd/acl.h +1 -1
@@ -43,7 +43,7 @@struct nfs4_acl *nfs4_acl_new (int );int nfs4_acl_get_whotype (char *,u32 ); -int nfs4_acl_write_who (int who,char *p); +int nfs4_acl_write_who (int who,__be32 **p,int *len);#define NFS4_ACL_TYPE_DEFAULT 0x01#define NFS4_ACL_DIR 0x02
fs/nfsd/idmap.h +2 -2
@@ -56,7 +56,7 @@ static inline void nfsd_idmap_shutdown(struct net *net)__be32 nfsd_map_name_to_uid (struct svc_rqst *,const char *,size_t ,kuid_t *);__be32 nfsd_map_name_to_gid (struct svc_rqst *,const char *,size_t ,kgid_t *); -int nfsd_map_uid_to_name (struct svc_rqst *,kuid_t ,char *); -int nfsd_map_gid_to_name (struct svc_rqst *,kgid_t ,char *); +__be32 nfsd4_encode_user (struct svc_rqst *,kuid_t ,__be32 **,int *); +__be32 nfsd4_encode_group (struct svc_rqst *,kgid_t ,__be32 **,int *);#endif /* LINUX_NFSD_IDMAP_H */
fs/nfsd/nfs4acl.c +13 -7
@@ -37,6 +37,7 @@#include <linux/slab.h> #include <linux/nfs_fs.h> #include <linux/export.h> +#include "nfsd.h" #include "acl.h"
@@ -848,18 +849,23 @@ nfs4_acl_get_whotype(char *p, u32 len)return NFS4_ACL_WHO_NAMED ; } -int -nfs4_acl_write_who (int who,char *p) +__be32 nfs4_acl_write_who (int who,__be32 **p,int *len) {int i; +int bytes;for (i =0 ; i <ARRAY_SIZE (s2t_map); i++) { -if (s2t_map[i].type == who) { -memcpy (p, s2t_map[i].string, s2t_map[i].stringlen); -return s2t_map[i].stringlen; - } +if (s2t_map[i].type != who) +continue ; + bytes =4 + (XDR_QUADLEN (s2t_map[i].stringlen) <<2 ); +if (bytes > *len) +return nfserr_resource; + *p =xdr_encode_opaque (*p, s2t_map[i].string, + s2t_map[i].stringlen); + *len -= bytes; +return 0 ; } -BUG (); +WARN_ON_ONCE (1 );return -1 ; }
fs/nfsd/nfs4idmap.c +33 -17
88 lines not on this page · raw message
fs/nfsd/nfs4xdr.c +6 -46
62 lines not on this page · raw message
Signature · 1 line
1.7.9.5