Skip to content

Commit 34e8f9e

Browse files
daimngochucklever
authored andcommitted
NFSD: fix leaked reference count of nfsd4_ssc_umount_item
The reference count of nfsd4_ssc_umount_item is not decremented on error conditions. This prevents the laundromat from unmounting the vfsmount of the source file. This patch decrements the reference count of nfsd4_ssc_umount_item on error. Fixes: f4e44b3 ("NFSD: delay unmount source's export after inter-server copy completed.") Signed-off-by: Dai Ngo <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 6ba434c commit 34e8f9e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

fs/nfsd/nfs4proc.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,13 +1813,17 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
18131813
release_copy_files(copy);
18141814
return status;
18151815
out_err:
1816+
if (nfsd4_ssc_is_inter(copy)) {
1817+
/*
1818+
* Source's vfsmount of inter-copy will be unmounted
1819+
* by the laundromat. Use copy instead of async_copy
1820+
* since async_copy->ss_nsui might not be set yet.
1821+
*/
1822+
refcount_dec(&copy->ss_nsui->nsui_refcnt);
1823+
}
18161824
if (async_copy)
18171825
cleanup_async_copy(async_copy);
18181826
status = nfserrno(-ENOMEM);
1819-
/*
1820-
* source's vfsmount of inter-copy will be unmounted
1821-
* by the laundromat
1822-
*/
18231827
goto out;
18241828
}
18251829

0 commit comments

Comments
 (0)