[pnfs] [PATCH 1/4] nfsd41: pass writable attrs mask to nfsd4_decode_fattr

Benny Halevy bhalevy at panasas.com
Mon May 12 15:41:48 EDT 2008


On May. 12, 2008, 11:54 -0700, Dean Hildebrand <seattleplus at gmail.com> wrote:
> 
> Benny Halevy wrote:
>> In preparation for EXCLUSIVE4_1
>>
>> Signed-off-by: Benny Halevy <bhalevy at panasas.com>
>> ---
>>  fs/nfsd/nfs4xdr.c |   23 +++++++++++++++++------
>>  1 files changed, 17 insertions(+), 6 deletions(-)
>>
>> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
>> index fcaac54..cc5f62d 100644
>> --- a/fs/nfsd/nfs4xdr.c
>> +++ b/fs/nfsd/nfs4xdr.c
>> @@ -252,9 +252,14 @@ nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval)
>>  	DECODE_TAIL;
>>  }
>>  
>> +static u32 nfsd_attrmask[] = {
>> +	NFSD_WRITEABLE_ATTRS_WORD0,
>> +	NFSD_WRITEABLE_ATTRS_WORD1
>> +};
>> +
>>  static __be32
>> -nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *iattr,
>> -    struct nfs4_acl **acl)
>> +nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, u32 *writable,
>> +		   struct iattr *iattr, struct nfs4_acl **acl)
>>   
> 
>>  {
>>  	int expected_len, len = 0;
>>  	u32 dummy32;
>> @@ -272,7 +277,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
>>  	 */
>>  	if ((bmval[0] & ~NFSD_SUPPORTED_ATTRS_WORD0) || (bmval[1] & ~NFSD_SUPPORTED_ATTRS_WORD1))
>>  		return nfserr_attrnotsupp;
>> -	if ((bmval[0] & ~NFSD_WRITEABLE_ATTRS_WORD0) || (bmval[1] & ~NFSD_WRITEABLE_ATTRS_WORD1))
>> +	if ((bmval[0] & ~writable[0]) || (bmval[1] & ~writable[1]))
>>  		return nfserr_inval;
>>  
>>  	READ_BUF(4);
>> @@ -503,7 +508,9 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create
>>  	if ((status = check_filename(create->cr_name, create->cr_namelen, nfserr_inval)))
>>  		return status;
>>  
>> -	if ((status = nfsd4_decode_fattr(argp, create->cr_bmval, &create->cr_iattr, &create->cr_acl)))
>> +	status = nfsd4_decode_fattr(argp, create->cr_bmval, nfsd_attrmask,
>> +				    &create->cr_iattr, &create->cr_acl);
>> +	if (status)
>>  		goto out;
>>  
>>  	DECODE_TAIL;
>> @@ -666,7 +673,9 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
>>  		switch (open->op_createmode) {
>>  		case NFS4_CREATE_UNCHECKED:
>>  		case NFS4_CREATE_GUARDED:
>> -			if ((status = nfsd4_decode_fattr(argp, open->op_bmval, &open->op_iattr, &open->op_acl)))
>> +			status = nfsd4_decode_fattr(argp, open->op_bmval,
>> +				nfsd_attrmask, &open->op_iattr, &open->op_acl);
>>   
> Does this line up properly once patched?

Not really. It is indented in the "align right" flavor, otherwise
each of the last 3 parameters would have to be on its own line.

Benny


> Dean
>> +			if (status)
>>  				goto out;
>>  			break;
>>  		case NFS4_CREATE_EXCLUSIVE:
>> @@ -889,7 +898,9 @@ nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *seta
>>  	READ_BUF(sizeof(stateid_t));
>>  	READ32(setattr->sa_stateid.si_generation);
>>  	COPYMEM(&setattr->sa_stateid.si_opaque, sizeof(stateid_opaque_t));
>> -	if ((status = nfsd4_decode_fattr(argp, setattr->sa_bmval, &setattr->sa_iattr, &setattr->sa_acl)))
>> +	status = nfsd4_decode_fattr(argp, setattr->sa_bmval, nfsd_attrmask,
>> +				    &setattr->sa_iattr, &setattr->sa_acl);
>> +	if (status)
>>  		goto out;
>>  
>>  	DECODE_TAIL;
>>   
> _______________________________________________
> pNFS mailing list
> pNFS at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs



More information about the pNFS mailing list