Print this page
6785 nfs4_attr_cache deadlock

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs4_vnops.c
          +++ new/usr/src/uts/common/fs/nfs/nfs4_vnops.c
↓ open down ↓ 2567 lines elided ↑ open up ↑
2568 2568           * open stream structure was created.
2569 2569           *
2570 2570           * We don't have to worry about calling 'open_stream_rele'
2571 2571           * since we our currently holding a reference to the open
2572 2572           * stream which means the count cannot go to 0 with this
2573 2573           * decrement.
2574 2574           */
2575 2575          ASSERT(osp->os_ref_count >= 2);
2576 2576          osp->os_ref_count--;
2577 2577  
2578      -        if (!ep->error)
     2578 +        if (ep->error == 0) {
     2579 +                /*
     2580 +                 * Avoid a deadlock with the r_serial thread waiting for
     2581 +                 * os_sync_lock in nfs4_get_otw_cred_by_osp() which might be
     2582 +                 * held by us. We will wait in nfs4_attr_cache() for the
     2583 +                 * completion of the r_serial thread.
     2584 +                 */
     2585 +                mutex_exit(&osp->os_sync_lock);
     2586 +                *have_sync_lockp = 0;
     2587 +
2579 2588                  nfs4_attr_cache(vp,
2580 2589                      &res.array[1].nfs_resop4_u.opgetattr.ga_res,
2581 2590                      t, cred_otw, TRUE, NULL);
     2591 +        }
2582 2592  
2583 2593          NFS4_DEBUG(nfs4_client_state_debug, (CE_NOTE, "nfs4close_otw:"
2584 2594              " returning %d", ep->error));
2585 2595  
2586 2596          (void) xdr_free(xdr_COMPOUND4res_clnt, (caddr_t)&res);
2587 2597  }
2588 2598  
2589 2599  /* ARGSUSED */
2590 2600  static int
2591 2601  nfs4_read(vnode_t *vp, struct uio *uiop, int ioflag, cred_t *cr,
↓ open down ↓ 13408 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX