Skip to content

Commit b9fa4cb

Browse files
committed
Merge tag 'nfsd-6.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd fixes from Chuck Lever: - Fix in-kernel RPC UDP transport - Fix NFSv4.0 RELEASE_LOCKOWNER * tag 'nfsd-6.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: nfsd: fix RELEASE_LOCKOWNER SUNRPC: use request size to initialize bio_vec in svc_udp_sendto()
2 parents 3cb9871 + edcf972 commit b9fa4cb

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

fs/nfsd/nfs4state.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7911,14 +7911,16 @@ check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner)
79117911
{
79127912
struct file_lock *fl;
79137913
int status = false;
7914-
struct nfsd_file *nf = find_any_file(fp);
7914+
struct nfsd_file *nf;
79157915
struct inode *inode;
79167916
struct file_lock_context *flctx;
79177917

7918+
spin_lock(&fp->fi_lock);
7919+
nf = find_any_file_locked(fp);
79187920
if (!nf) {
79197921
/* Any valid lock stateid should have some sort of access */
79207922
WARN_ON_ONCE(1);
7921-
return status;
7923+
goto out;
79227924
}
79237925

79247926
inode = file_inode(nf->nf_file);
@@ -7934,7 +7936,8 @@ check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner)
79347936
}
79357937
spin_unlock(&flctx->flc_lock);
79367938
}
7937-
nfsd_file_put(nf);
7939+
out:
7940+
spin_unlock(&fp->fi_lock);
79387941
return status;
79397942
}
79407943

@@ -7944,10 +7947,8 @@ check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner)
79447947
* @cstate: NFSv4 COMPOUND state
79457948
* @u: RELEASE_LOCKOWNER arguments
79467949
*
7947-
* The lockowner's so_count is bumped when a lock record is added
7948-
* or when copying a conflicting lock. The latter case is brief,
7949-
* but can lead to fleeting false positives when looking for
7950-
* locks-in-use.
7950+
* Check if theree are any locks still held and if not - free the lockowner
7951+
* and any lock state that is owned.
79517952
*
79527953
* Return values:
79537954
* %nfs_ok: lockowner released or not found
@@ -7983,10 +7984,13 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,
79837984
spin_unlock(&clp->cl_lock);
79847985
return nfs_ok;
79857986
}
7986-
if (atomic_read(&lo->lo_owner.so_count) != 2) {
7987-
spin_unlock(&clp->cl_lock);
7988-
nfs4_put_stateowner(&lo->lo_owner);
7989-
return nfserr_locks_held;
7987+
7988+
list_for_each_entry(stp, &lo->lo_owner.so_stateids, st_perstateowner) {
7989+
if (check_for_locks(stp->st_stid.sc_file, lo)) {
7990+
spin_unlock(&clp->cl_lock);
7991+
nfs4_put_stateowner(&lo->lo_owner);
7992+
return nfserr_locks_held;
7993+
}
79907994
}
79917995
unhash_lockowner_locked(lo);
79927996
while (!list_empty(&lo->lo_owner.so_stateids)) {

net/sunrpc/svcsock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,12 +717,12 @@ static int svc_udp_sendto(struct svc_rqst *rqstp)
717717
ARRAY_SIZE(rqstp->rq_bvec), xdr);
718718

719719
iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec,
720-
count, 0);
720+
count, rqstp->rq_res.len);
721721
err = sock_sendmsg(svsk->sk_sock, &msg);
722722
if (err == -ECONNREFUSED) {
723723
/* ICMP error on earlier request. */
724724
iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec,
725-
count, 0);
725+
count, rqstp->rq_res.len);
726726
err = sock_sendmsg(svsk->sk_sock, &msg);
727727
}
728728

0 commit comments

Comments
 (0)