diff options
author | Marcel Telka <marcel@telka.sk> | 2020-12-15 22:08:36 +0100 |
---|---|---|
committer | Gordon Ross <gordon.ross@tintri.com> | 2021-01-08 09:50:43 -0500 |
commit | 6dc7d05754d992040097e8ba8f85e77512125c60 (patch) | |
tree | e903855560ce49a18cc0cf277f362532c7e8f2a1 /usr/src | |
parent | 0a554e9f2c0d440dc40a97fae2d18f1d428ca786 (diff) | |
download | illumos-joyent-6dc7d05754d992040097e8ba8f85e77512125c60.tar.gz |
8040 NFSv4 client: 3-way deadlock between nfs4_bio(), nfs4_do_delegreturn(), and nfs4_flush_pages()
Reviewed by: Arne Jansen <arne@die-jansens.de>
Reviewed by: Vitaliy Gusev <gusev.vitaliy@icloud.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/fs/nfs/nfs4_client.c | 36 | ||||
-rw-r--r-- | usr/src/uts/common/fs/nfs/nfs4_vnops.c | 6 |
2 files changed, 9 insertions, 33 deletions
diff --git a/usr/src/uts/common/fs/nfs/nfs4_client.c b/usr/src/uts/common/fs/nfs/nfs4_client.c index 5456fc7c63..856da430ea 100644 --- a/usr/src/uts/common/fs/nfs/nfs4_client.c +++ b/usr/src/uts/common/fs/nfs/nfs4_client.c @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. + * Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. * All Rights Reserved */ @@ -464,33 +464,15 @@ nfs4_attr_cache(vnode_t *vp, nfs4_ga_res_t *garp, rp = VTOR4(vp); mutex_enter(&rp->r_statelock); was_serial = (rp->r_serial == curthread); - if (rp->r_serial && !was_serial) { - klwp_t *lwp = ttolwp(curthread); - + if (rp->r_serial != NULL && !was_serial) { /* - * If we're the recovery thread, then purge current attrs - * and bail out to avoid potential deadlock between another - * thread caching attrs (r_serial thread), recov thread, - * and an async writer thread. + * Purge current attrs and bail out to avoid potential deadlock + * between another thread caching attrs (r_serial thread), this + * thread, and a thread trying to read or write pages. */ - if (recov) { - PURGE_ATTRCACHE4_LOCKED(rp); - mutex_exit(&rp->r_statelock); - return; - } - - if (lwp != NULL) - lwp->lwp_nostop++; - while (rp->r_serial != NULL) { - if (!cv_wait_sig(&rp->r_cv, &rp->r_statelock)) { - mutex_exit(&rp->r_statelock); - if (lwp != NULL) - lwp->lwp_nostop--; - return; - } - } - if (lwp != NULL) - lwp->lwp_nostop--; + PURGE_ATTRCACHE4_LOCKED(rp); + mutex_exit(&rp->r_statelock); + return; } /* @@ -3067,7 +3049,7 @@ nfs_free_mi4(mntinfo4_t *mi) nfs4_oo_hash_bucket_t *bucketp; nfs4_debug_msg_t *msgp; int i; - servinfo4_t *svp; + servinfo4_t *svp; /* * Code introduced here should be carefully evaluated to make diff --git a/usr/src/uts/common/fs/nfs/nfs4_vnops.c b/usr/src/uts/common/fs/nfs/nfs4_vnops.c index 9f4099c3f8..db93bf2e72 100644 --- a/usr/src/uts/common/fs/nfs/nfs4_vnops.c +++ b/usr/src/uts/common/fs/nfs/nfs4_vnops.c @@ -2596,12 +2596,6 @@ nfs4close_otw(rnode4_t *rp, cred_t *cred_otw, nfs4_open_owner_t *oop, osp->os_ref_count--; if (ep->error == 0) { - /* - * Avoid a deadlock with the r_serial thread waiting for - * os_sync_lock in nfs4_get_otw_cred_by_osp() which might be - * held by us. We will wait in nfs4_attr_cache() for the - * completion of the r_serial thread. - */ mutex_exit(&osp->os_sync_lock); *have_sync_lockp = 0; |