NFSv4 client's BUG?

Wei Yongjun yjwei at cn.fujitsu.com
Sun Jul 13 22:03:01 EDT 2008


J. Bruce Fields wrote:
>> The error return by the server is NFSERR_OPENMODE in setattr.
>> 646 nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>> 647               struct nfsd4_setattr *setattr)
>> 648 {
>> 649         __be32 status = nfs_ok;
>> 650
>> 651         if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
>> 652                 nfs4_lock_state();
>> 653                 status = nfs4_preprocess_stateid_op(&cstate->current_fh,
>> 654                         &setattr->sa_stateid, CHECK_FH | WR_STATE, NULL);
>> 655                 nfs4_unlock_state();
>>
>> 2002 nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int flags, struct file **filpp)
>> ...
>> 2049         if (stp) {
>> 2050                 if ((status = nfs4_check_openmode(stp,flags)))
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> 2051                         goto out;
>> 2052                 renew_client(stp->st_stateowner->so_client);
>> 2053                 if (filpp)
>> 2054                         *filpp = stp->st_vfs_file;
>> 2055         }
>>
>> ...
>>
>> This error only happend when NFSv4 callback is enabled. See the  
>> following code,  if cb->cb_set is 1, deleg will be alloc, if cb->cb_set  
>> is 0, the error will never happend. I confirm this by drop callback tcp  
>> packet used iptables.
>> if cb->cb_set is 1, the message "NFSD: setlease failed [11], no  
>> delegation" is print when open file with NFS4_SHARE_ACCESS_WRITE mode,  
>> when vfs_setlease(), the dir and inode count is 2 (may be one is hold by  
>> stp, the other is hold by dp), so the setlease for F_WRLCK always fail.
>>     
>
> That's normal; the server doesn't support write delegations (and doesn't
> give out read delegations on write opens).
>
> So, is the problem occuring because the client is doing a setattr to
> modify the size using a sequence id returned from a read delegation?
>
>   
This happend in special case:

OPEN (OPEN4_SHARE_ACCESS_BOTH)    ---> 
                                     <---      OPEN Reply OK
SETATTR (size=0)                  --->
OPEN (OPEN4_SHARE_ACCESS_READ)    --->
                                     <---      SETATTR Reply NFSERR_OPENMODE
                                     <---      OPEN Reply OK










More information about the NFSv4 mailing list