Skip to contentSkip to conversation

NFSD: Fix problem of COMMIT and NFS4ERR_DELAY in infinite loop

PATCH Applied Dai Ngo 3 participants 3 messages Apr 19, 2023

Subsystems (2)
lore
Share & tools
lore

Dai Ngo

author reviewer
#0 lore raw

PATCH v2 1/1 NFSD: Fix problem of COMMIT and NFS4ERR_DELAY in infinite loop

The following request sequence to the same file causes the NFS client and server getting into an infinite loop with COMMIT and NFS4ERR_DELAY:

OPEN
REMOVE
WRITE
COMMIT

Problem reported by recall11, recall12, recall14, recall20, recall22, recall40, recall42, recall48, recall50 of nfstest suite.

This patch restores the handling of race condition in nfsd_file_do_acquire with unlink to that prior of the regression.

Fixes ac3a2585f018 ("nfsd: rework refcounting in filecache")
---
 fs/nfsd/filecache.c | 2 --
 1 file changed, 2 deletions(-)

V2: rebase with nfsd-next

fs/nfsd/filecache.c +0 -2
index f40d8f3b35a4..ee9c923192e0 100644
@@ -1099,8 +1099,6 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	 * then unhash.
 	 */
 	if (status != nfs_ok || inode->i_nlink == 0)
-		status = nfserr_jukebox;
-	if (status != nfs_ok)
 		nfsd_file_unhash(nf);
 	clear_and_wake_up_bit(NFSD_FILE_PENDING, &nf->nf_flags);
 	if (status == nfs_ok)
Signature · 1 line
2.9.5
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 27 lines · Dai Ngo

The following request sequence to the same file causes the NFS client and server getting into an infinite loop with COMMIT and NFS4ERR_DELAY:

OPEN
REMOVE
WRITE
COMMIT

Problem reported by recall11, recall12, recall14, recall20, recall22, recall40, recall42, recall48, recall50 of nfstest suite.

This patch restores the handling of race condition in nfsd_file_do_acquire with unlink to that prior of the regression.

Fixes ac3a2585f018 ("nfsd: rework refcounting in filecache")
---
 fs/nfsd/filecache.c | 2 --
 1 file changed, 2 deletions(-)

V2: rebase with nfsd-next

fs/nfsd/filecache.c +0 -0
index f40d8f3b35a4..ee9c923192e0 100644

fs/nfsd/filecache.c nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp, · line 1104

Quoted 8 lines
fs/nfsd/filecache.c +0 -2
@@ -1099,8 +1099,6 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
 	 * then unhash.
 	 */
 	if (status != nfs_ok || inode->i_nlink == 0)
-		status = nfserr_jukebox;
-	if (status != nfs_ok)
 		nfsd_file_unhash(nf);
 	clear_and_wake_up_bit(NFSD_FILE_PENDING, &nf->nf_flags);
 	if (status == nfs_ok)
#2 lore raw
Quoted 26 lines · Jeff Layton
Quoted 22 lines · Dai Ngo

The following request sequence to the same file causes the NFS client and server getting into an infinite loop with COMMIT and NFS4ERR_DELAY:

OPEN
REMOVE
WRITE
COMMIT

Problem reported by recall11, recall12, recall14, recall20, recall22, recall40, recall42, recall48, recall50 of nfstest suite.

This patch restores the handling of race condition in nfsd_file_do_acquire with unlink to that prior of the regression.

Fixes ac3a2585f018 ("nfsd: rework refcounting in filecache")

---
fs/nfsd/filecache.c | 2 --

1 file changed, 2 deletions(-)

V2: rebase with nfsd-next

Quoted 15 lines

fs/nfsd/filecache.c nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp, · line 1104

Quoted 13 lines
fs/nfsd/filecache.c +0 -2
index f40d8f3b35a4..ee9c923192e0 100644
@@ -1099,8 +1099,6 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
 * then unhash.
 */
 if (status != nfs_ok || inode->i_nlink == 0)
- status = nfserr_jukebox;
- if (status != nfs_ok)
 nfsd_file_unhash(nf);
 clear_and_wake_up_bit(NFSD_FILE_PENDING, &nf->nf_flags);
 if (status == nfs_ok)

Thanks, applied to nfsd-next.

--
Chuck Lever