Introduction
Subsystems (3)
PATCH 1/1 Introduction
Following are 5 patches for knfsd suitable for immediate inclusion in 2.6.14-rc
There are either code cleanups, or bug fixes.
4 From Bruce Fields, one from me.
(and my 'From:' address is different from the 'Signed-off-by:' address, so as to get through the subscriber-only [email protected] list.. I wonder if I am going to pay for that :-)
NeilBrown
[PATCH kNFSd 001 of 5] nfsd4: printk reduction
[PATCH kNFSd 002 of 5] nfsd4: move replay_owner
[PATCH kNFSd 003 of 5] nfsd4: fix open seqid incrementing in lock [PATCH kNFSd 004 of 5] nfsd4: fix setclientid unlock of unlocked state lock [PATCH kNFSd 005 of 5] Code cleanups in callbacks in svcsock.
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: printk reduction
Demote some printk's that look like they could be triggered by non-buggy clients to dprintk's. (For example, stale clientid's are normal occurrences on reboot, and on a server with a lot of clients these messages could become annoying.)
Also remove some redundant dprintk's (e.g. no need for both STALE_CLIENTID and its callers to do dprintks).
### Diffstat output
./fs/nfsd/nfs4state.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +10 -17
@@ -624,7 +624,7 @@ gen_callback(struct nfs4_client *clp, st cb->cb_ident = se->se_callback_ident;return ; out_err: -printk (KERN_INFO "NFSD: this client (clientid %08x/%08x) " +dprintk (KERN_INFO "NFSD: this client (clientid %08x/%08x) " "will not receive delegations\n" , clp->cl_clientid.cl_boot, clp->cl_clientid.cl_id);
@@ -2014,7 +2014,7 @@ STALE_STATEID(stateid_t *stateid) {if (stateid->si_boot == boot_time)return 0 ; -printk ("NFSD: stale stateid (%08x/%08x/%08x/%08x)!\n" , +dprintk ("NFSD: stale stateid (%08x/%08x/%08x/%08x)!\n" , stateid->si_boot, stateid->si_stateownerid, stateid->si_fileid, stateid->si_generation);return 1 ;
@@ -2275,7 +2275,7 @@ nfs4_preprocess_seqid_op(struct svc_fh * check_replay:if (seqid == sop->so_seqid -1 ) { -printk ("NFSD: preprocess_seqid_op: retransmission?\n" ); +dprintk ("NFSD: preprocess_seqid_op: retransmission?\n" );/* indicate replay to calling function */ return NFSERR_REPLAY_ME ; }
@@ -2500,8 +2500,7 @@ find_stateid(stateid_t *stid, int flags) (local->st_stateid.si_fileid == f_id))return local; } - }else -printk ("NFSD: find_stateid: ERROR: no state flag\n" ); + }return NULL ; }
@@ -2705,10 +2704,8 @@ nfsd4_lock(struct svc_rqst *rqstp, strucstruct nfs4_file *fp; status = nfserr_stale_clientid; -if (STALE_CLIENTID (&lock->lk_new_clientid)) { -printk ("NFSD: nfsd4_lock: clientid is stale!\n" ); +if (STALE_CLIENTID (&lock->lk_new_clientid)) goto out; - }/* validate and update open stateid and open seqid */ status = nfs4_preprocess_seqid_op(current_fh,
@@ -2751,7 +2748,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struc filp = lock_stp->st_vfs_file;if ((status =fh_verify (rqstp, current_fh,S_IFREG ,MAY_LOCK ))) { -printk ("NFSD: nfsd4_lock: permission denied!\n" ); +dprintk ("NFSD: nfsd4_lock: permission denied!\n" ); goto out; }
@@ -2866,13 +2863,11 @@ nfsd4_lockt(struct svc_rqst *rqstp, strunfs4_lock_state (); status = nfserr_stale_clientid; -if (STALE_CLIENTID (&lockt->lt_clientid)) { -printk ("NFSD: nfsd4_lockt: clientid is stale!\n" ); +if (STALE_CLIENTID (&lockt->lt_clientid)) goto out; - }if ((status =fh_verify (rqstp, current_fh,S_IFREG ,0 ))) { -printk ("NFSD: nfsd4_lockt: fh_verify() failed!\n" ); +dprintk ("NFSD: nfsd4_lockt: fh_verify() failed!\n" );if (status == nfserr_symlink) status = nfserr_inval; goto out;
@@ -2976,7 +2971,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struif (file_lock.fl_ops && file_lock.fl_ops->fl_release_private) file_lock.fl_ops->fl_release_private (&file_lock);if (status) { -printk ("NFSD: nfs4_locku: posix_lock_file failed!\n" ); +dprintk ("NFSD: nfs4_locku: posix_lock_file failed!\n" ); goto out_nfserr; }/*
@@ -3036,10 +3031,8 @@ nfsd4_release_lockowner(struct svc_rqst/* XXX check for lease expiration */ status = nfserr_stale_clientid; -if (STALE_CLIENTID (clid)) { -printk ("NFSD: nfsd4_release_lockowner: clientid is stale!\n" ); +if (STALE_CLIENTID (clid))return status; - }nfs4_lock_state ();
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 Code cleanups in calbacks in svcsock.
In reply to NeilBrownChange a printk(KERN_WARNING to dprintk, and it is really only interesting when trying to debug a problem, and can occur normally without error.
Remove various gratuitous gotos in surrounding code, and remove some type-cast assignments from inside 'if' conditionals, as that is just obscuring what it going on.
### Diffstat output
./net/sunrpc/svcsock.c | 83 +++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 44 deletions(-)
net/sunrpc/svcsock.c renamed from net/sunrpc/svcsock.c~current~ +39 -44
@@ -512,15 +512,14 @@ svc_sock_setbufsize(struct socket *sock,static void svc_udp_data_ready (struct sock *sk,int count) { -struct svc_sock *svsk = (struct svc_sock *)(sk->sk_user_data); +struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; -if (!svsk) - goto out; -dprintk ("svc: socket %p(inet %p), count=%d, busy=%d\n" , - svsk, sk, count,test_bit (SK_BUSY , &svsk->sk_flags)); -set_bit (SK_DATA , &svsk->sk_flags); -svc_sock_enqueue (svsk); - out: +if (svsk) { +dprintk ("svc: socket %p(inet %p), count=%d, busy=%d\n" , + svsk, sk, count,test_bit (SK_BUSY , &svsk->sk_flags)); +set_bit (SK_DATA , &svsk->sk_flags); +svc_sock_enqueue (svsk); + }if (sk->sk_sleep &&waitqueue_active (sk->sk_sleep))wake_up_interruptible (sk->sk_sleep); }
@@ -540,7 +539,7 @@ svc_write_space(struct sock *sk) }if (sk->sk_sleep &&waitqueue_active (sk->sk_sleep)) { -printk (KERN_WARNING "RPC svc_write_space: some sleeping on %p\n" , +dprintk ("RPC svc_write_space: someone sleeping on %p\n" , svsk);wake_up_interruptible (sk->sk_sleep); }
@@ -689,31 +688,29 @@ svc_udp_init(struct svc_sock *svsk)static void svc_tcp_listen_data_ready (struct sock *sk,int count_unused) { -struct svc_sock *svsk; +struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;dprintk ("svc: socket %p TCP (listen) state change %d\n" , - sk, sk->sk_state); + sk, sk->sk_state); -if (sk->sk_state !=TCP_LISTEN ) { -/* -* This callback may called twice when a new connection -* is established as a child socket inherits everything -* from a parent LISTEN socket. -* 1) data_ready method of the parent socket will be called -* when one of child sockets become ESTABLISHED. -* 2) data_ready method of the child socket may be called -* when it receives data before the socket is accepted. -* In case of 2, we should ignore it silently. -*/ - goto out; - } -if (!(svsk = (struct svc_sock *) sk->sk_user_data)) { -printk ("svc: socket %p: no user data\n" , sk); - goto out; +/* +* This callback may called twice when a new connection +* is established as a child socket inherits everything +* from a parent LISTEN socket. +* 1) data_ready method of the parent socket will be called +* when one of child sockets become ESTABLISHED. +* 2) data_ready method of the child socket may be called +* when it receives data before the socket is accepted. +* In case of 2, we should ignore it silently. +*/ +if (sk->sk_state ==TCP_LISTEN ) { +if (svsk) { +set_bit (SK_CONN , &svsk->sk_flags); +svc_sock_enqueue (svsk); + }else +printk ("svc: socket %p: no user data\n" , sk); } -set_bit (SK_CONN , &svsk->sk_flags); -svc_sock_enqueue (svsk); - out: +if (sk->sk_sleep &&waitqueue_active (sk->sk_sleep))wake_up_interruptible_all (sk->sk_sleep); }
@@ -724,18 +721,17 @@ svc_tcp_listen_data_ready(struct sock *sstatic void svc_tcp_state_change (struct sock *sk) { -struct svc_sock *svsk; +struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;dprintk ("svc: socket %p TCP (connected) state change %d (svsk %p)\n" , - sk, sk->sk_state, sk->sk_user_data); + sk, sk->sk_state, sk->sk_user_data); -if (!(svsk = (struct svc_sock *) sk->sk_user_data)) { +if (!svsk)printk ("svc: socket %p: no user data\n" , sk); - goto out; +else { +set_bit (SK_CLOSE , &svsk->sk_flags); +svc_sock_enqueue (svsk); } -set_bit (SK_CLOSE , &svsk->sk_flags); -svc_sock_enqueue (svsk); - out:if (sk->sk_sleep &&waitqueue_active (sk->sk_sleep))wake_up_interruptible_all (sk->sk_sleep); }
@@ -743,15 +739,14 @@ svc_tcp_state_change(struct sock *sk)static void svc_tcp_data_ready (struct sock *sk,int count) { -struct svc_sock * svsk; +struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data;dprintk ("svc: socket %p TCP data ready (svsk %p)\n" , - sk, sk->sk_user_data); -if (!(svsk = (struct svc_sock *)(sk->sk_user_data))) - goto out; -set_bit (SK_DATA , &svsk->sk_flags); -svc_sock_enqueue (svsk); - out: + sk, sk->sk_user_data); +if (svsk) { +set_bit (SK_DATA , &svsk->sk_flags); +svc_sock_enqueue (svsk); + }if (sk->sk_sleep &&waitqueue_active (sk->sk_sleep))wake_up_interruptible (sk->sk_sleep); }
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: fix setclientid unlock of unlocked state lock
In reply to NeilBrownWe could try to unlock the state lock here without having first locked it.
### Diffstat output
./fs/nfsd/nfs4state.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +2 -3
@@ -678,13 +678,12 @@ nfsd4_setclientid(struct svc_rqst *rqstpint status;char dname[HEXDIR_LEN ]; - status = nfserr_inval;if (!check_name (clname)) - goto out; +return nfserr_inval; status =nfs4_make_rec_clidname (dname, &clname);if (status) - goto out; +return status;/* * XXX The Duplicate Request Cache (DRC) has been checked (??)
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: move replay_owner
In reply to NeilBrownIt seems more natural to move the setting of the replay_owner into the relevant procedure instead of doing it in nfsv4_proc_compound.
### Diffstat output
./fs/nfsd/nfs4proc.c | 24 ++++++++++-------------- ./fs/nfsd/nfs4state.c | 30 ++++++++++++++++++++---------- ./include/linux/nfsd/xdr4.h | 15 ++++++++++----- 3 files changed, 40 insertions(+), 29 deletions(-)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +10 -14
@@ -162,7 +162,7 @@ do_open_fhandle(struct svc_rqst *rqstp,static inline int -nfsd4_open (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_open *open) +nfsd4_open (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_open *open,struct nfs4_stateowner **replay_owner) {int status; dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n",
@@ -238,8 +238,10 @@ nfsd4_open(struct svc_rqst *rqstp, struc*/ status =nfsd4_process_open2 (rqstp, current_fh, open); out: -if (open->op_stateowner) +if (open->op_stateowner) {nfs4_get_stateowner (open->op_stateowner); + *replay_owner = open->op_stateowner; + }nfs4_unlock_state ();return status; }
@@ -809,8 +811,7 @@ nfsd4_proc_compound(struct svc_rqst *rqs op->status =nfsd4_access (rqstp, current_fh, &op->u.access);break ;case OP_CLOSE : - op->status =nfsd4_close (rqstp, current_fh, &op->u.close); - replay_owner = op->u.close.cl_stateowner; + op->status =nfsd4_close (rqstp, current_fh, &op->u.close, &replay_owner);break ;case OP_COMMIT : op->status =nfsd4_commit (rqstp, current_fh, &op->u.commit);
@@ -831,15 +832,13 @@ nfsd4_proc_compound(struct svc_rqst *rqs op->status =nfsd4_link (rqstp, current_fh, save_fh, &op->u.link);break ;case OP_LOCK : - op->status =nfsd4_lock (rqstp, current_fh, &op->u.lock); - replay_owner = op->u.lock.lk_stateowner; + op->status =nfsd4_lock (rqstp, current_fh, &op->u.lock, &replay_owner);break ;case OP_LOCKT : op->status =nfsd4_lockt (rqstp, current_fh, &op->u.lockt);break ;case OP_LOCKU : - op->status =nfsd4_locku (rqstp, current_fh, &op->u.locku); - replay_owner = op->u.locku.lu_stateowner; + op->status =nfsd4_locku (rqstp, current_fh, &op->u.locku, &replay_owner);break ;case OP_LOOKUP : op->status =nfsd4_lookup (rqstp, current_fh, &op->u.lookup);
@@ -853,16 +852,13 @@ nfsd4_proc_compound(struct svc_rqst *rqs op->status = nfs_ok;break ;case OP_OPEN : - op->status =nfsd4_open (rqstp, current_fh, &op->u.open); - replay_owner = op->u.open.op_stateowner; + op->status =nfsd4_open (rqstp, current_fh, &op->u.open, &replay_owner);break ;case OP_OPEN_CONFIRM : - op->status =nfsd4_open_confirm (rqstp, current_fh, &op->u.open_confirm); - replay_owner = op->u.open_confirm.oc_stateowner; + op->status =nfsd4_open_confirm (rqstp, current_fh, &op->u.open_confirm, &replay_owner);break ;case OP_OPEN_DOWNGRADE : - op->status =nfsd4_open_downgrade (rqstp, current_fh, &op->u.open_downgrade); - replay_owner = op->u.open_downgrade.od_stateowner; + op->status =nfsd4_open_downgrade (rqstp, current_fh, &op->u.open_downgrade, &replay_owner);break ;case OP_PUTFH : op->status =nfsd4_putfh (rqstp, current_fh, &op->u.putfh);
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +20 -10
@@ -2286,7 +2286,7 @@ check_replay: }int -nfsd4_open_confirm (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_open_confirm *oc) +nfsd4_open_confirm (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_open_confirm *oc,struct nfs4_stateowner **replay_owner) {int status;struct nfs4_stateowner *sop;
@@ -2320,8 +2320,10 @@ nfsd4_open_confirm(struct svc_rqst *rqstnfsd4_create_clid_dir (sop->so_client); out: -if (oc->oc_stateowner) +if (oc->oc_stateowner) {nfs4_get_stateowner (oc->oc_stateowner); + *replay_owner = oc->oc_stateowner; + }nfs4_unlock_state ();return status; }
@@ -2352,7 +2354,7 @@ reset_union_bmap_deny(unsigned long deny }int -nfsd4_open_downgrade (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_open_downgrade *od) +nfsd4_open_downgrade (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_open_downgrade *od,struct nfs4_stateowner **replay_owner) {int status;struct nfs4_stateid *stp;
@@ -2394,8 +2396,10 @@ nfsd4_open_downgrade(struct svc_rqst *rqmemcpy (&od->od_stateid, &stp->st_stateid,sizeof (stateid_t)); status = nfs_ok; out: -if (od->od_stateowner) +if (od->od_stateowner) {nfs4_get_stateowner (od->od_stateowner); + *replay_owner = od->od_stateowner; + }nfs4_unlock_state ();return status; }
@@ -2404,7 +2408,7 @@ out:* nfs4_unlock_state() called after encode */ int -nfsd4_close (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_close *close) +nfsd4_close (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_close *close,struct nfs4_stateowner **replay_owner) {int status;struct nfs4_stateid *stp;
@@ -2430,8 +2434,10 @@ nfsd4_close(struct svc_rqst *rqstp, stru/* release_state_owner() calls nfsd_close() if needed */ release_state_owner (stp,OPEN_STATE ); out: -if (close->cl_stateowner) +if (close->cl_stateowner) {nfs4_get_stateowner (close->cl_stateowner); + *replay_owner = close->cl_stateowner; + }nfs4_unlock_state ();return status; }
@@ -2675,7 +2681,7 @@ check_lock_length(u64 offset, u64 length* LOCK operation */ int -nfsd4_lock (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_lock *lock) +nfsd4_lock (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_lock *lock,struct nfs4_stateowner **replay_owner) {struct nfs4_stateowner *open_sop =NULL ;struct nfs4_stateid *lock_stp;
@@ -2835,8 +2841,10 @@ out_destroy_new_stateid:release_state_owner (lock_stp,LOCK_STATE ); } out: -if (lock->lk_stateowner) +if (lock->lk_stateowner) {nfs4_get_stateowner (lock->lk_stateowner); + *replay_owner = lock->lk_stateowner; + }nfs4_unlock_state ();return status; }
@@ -2925,7 +2933,7 @@ out: }int -nfsd4_locku (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_locku *locku) +nfsd4_locku (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_locku *locku,struct nfs4_stateowner **replay_owner) {struct nfs4_stateid *stp;struct file *filp =NULL ;
@@ -2981,8 +2989,10 @@ nfsd4_locku(struct svc_rqst *rqstp, strumemcpy (&locku->lu_stateid, &stp->st_stateid,sizeof (stateid_t)); out: -if (locku->lu_stateowner) +if (locku->lu_stateowner) {nfs4_get_stateowner (locku->lu_stateowner); + *replay_owner = locku->lu_stateowner; + }nfs4_unlock_state ();return status;
include/linux/nfsd/xdr4.h renamed from include/linux/nfsd/xdr4.h~current~ +10 -5
@@ -438,17 +438,22 @@ extern int nfsd4_process_open1(struct nfextern int nfsd4_process_open2 (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_open *open);extern int nfsd4_open_confirm (struct svc_rqst *rqstp, -struct svc_fh *current_fh,struct nfsd4_open_confirm *oc); +struct svc_fh *current_fh,struct nfsd4_open_confirm *oc, +struct nfs4_stateowner **);extern int nfsd4_close (struct svc_rqst *rqstp,struct svc_fh *current_fh, -struct nfsd4_close *close); +struct nfsd4_close *close, +struct nfs4_stateowner **replay_owner);extern int nfsd4_open_downgrade (struct svc_rqst *rqstp, -struct svc_fh *current_fh,struct nfsd4_open_downgrade *od); +struct svc_fh *current_fh,struct nfsd4_open_downgrade *od, +struct nfs4_stateowner **replay_owner);extern int nfsd4_lock (struct svc_rqst *rqstp,struct svc_fh *current_fh, -struct nfsd4_lock *lock); +struct nfsd4_lock *lock, +struct nfs4_stateowner **replay_owner);extern int nfsd4_lockt (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_lockt *lockt);extern int nfsd4_locku (struct svc_rqst *rqstp,struct svc_fh *current_fh, -struct nfsd4_locku *locku); +struct nfsd4_locku *locku, +struct nfs4_stateowner **replay_owner);extern int nfsd4_release_lockowner (struct svc_rqst *rqstp,struct nfsd4_release_lockowner *rlockowner);
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: fix open seqid incrementing in lock
In reply to NeilBrownIn the case of a lock which introduces a new lockowner, the openowner's sequence id should be incremented, even when the operation fails, if the error is a sequence-id-mutating error. The current code fails to do that in some cases. Fix this by using the same sequence-id-incrementing mechanism that all other such operations use.
### Diffstat output
./fs/nfsd/nfs4state.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +15 -13
@@ -2629,7 +2629,9 @@ alloc_init_lock_stateowner(unsigned int sop->so_is_open_owner =0 ; sop->so_id = current_ownerid++; sop->so_client = clp; - sop->so_seqid = lock->lk_new_lock_seqid; +/* It is the openowner seqid that will be incremented in encode in the +* case of new lockowners; so increment the lock seqid manually: */ + sop->so_seqid = lock->lk_new_lock_seqid +1 ; sop->so_confirmed =1 ; rp = &sop->so_replay; rp->rp_status =NFSERR_SERVERFAULT ;
@@ -2684,6 +2686,7 @@ int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock *lock, struct nfs4_stateowner **replay_owner) { struct nfs4_stateowner *open_sop = NULL; +struct nfs4_stateowner *lock_sop =NULL ;struct nfs4_stateid *lock_stp;struct file *filp;struct file_lock file_lock;
@@ -2718,9 +2721,11 @@ nfsd4_lock(struct svc_rqst *rqstp, struc lock->lk_new_open_seqid, &lock->lk_new_open_stateid,CHECK_FH |OPEN_STATE , - &open_sop, &open_stp, lock); + &lock->lk_stateowner, &open_stp, + lock);if (status) goto out; + open_sop = lock->lk_stateowner;/* create lockowner and lock stateid */ fp = open_stp->st_file; strhashval = lock_ownerstr_hashval(fp->fi_inode,
@@ -2730,16 +2735,15 @@ nfsd4_lock(struct svc_rqst *rqstp, struc* the same file, or should they just be allowed (and * create new stateids)? */ status = nfserr_resource; -if (!(lock->lk_stateowner =alloc_init_lock_stateowner (strhashval, open_sop->so_client, open_stp, lock))) + lock_sop =alloc_init_lock_stateowner (strhashval, + open_sop->so_client, open_stp, lock); +if (lock_sop ==NULL ) goto out; -if ((lock_stp =alloc_init_lock_stateid (lock->lk_stateowner, - fp, open_stp)) ==NULL ) { -release_stateowner (lock->lk_stateowner); - lock->lk_stateowner =NULL ; + lock_stp =alloc_init_lock_stateid (lock_sop, fp, open_stp); +if (lock_stp ==NULL ) { +release_stateowner (lock_sop); goto out; } -/* bump the open seqid used to create the lock */ - open_sop->so_seqid++; }else {/* lock (lock owner + lock stateid) already exists */ status = nfs4_preprocess_seqid_op(current_fh,
@@ -2749,6 +2753,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struc &lock->lk_stateowner, &lock_stp, lock);if (status) goto out; + lock_sop = lock->lk_stateowner; }/* lock->lk_stateowner and lock_stp have been created or found */ filp = lock_stp->st_vfs_file;
@@ -2779,7 +2784,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struc status = nfserr_inval; goto out; } - file_lock.fl_owner = (fl_owner_t ) lock->lk_stateowner; + file_lock.fl_owner = (fl_owner_t )lock_sop; file_lock.fl_pid = current->tgid; file_lock.fl_file = filp; file_lock.fl_flags =FL_POSIX ;
@@ -2835,9 +2840,6 @@ out_destroy_new_stateid:* An error encountered after instantiation of the new * stateid has forced us to destroy it. */ -if (!seqid_mutating_err (status)) - open_sop->so_seqid--; -release_state_owner (lock_stp,LOCK_STATE ); } out:
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs