Print this page
patch tsoome-feedback


 411                         cmn_err(CE_WARN, "export[%s]: failed accessing",
 412                             shrname);
 413                         continue;
 414                 }
 415 
 416                 if ((shr = smb_kshare_decode(share)) == NULL) {
 417                         cmn_err(CE_WARN, "export[%s]: failed decoding",
 418                             shrname);
 419                         continue;
 420                 }
 421 
 422                 /* smb_kshare_export consumes shr so it's not leaked */
 423                 if ((rc = smb_kshare_export(sv, shr)) != 0) {
 424                         smb_kshare_destroy(shr);
 425                         continue;
 426                 }
 427         }
 428         rc = 0;
 429 
 430 out:
 431         if (shrlist != NULL)
 432                 nvlist_free(shrlist);
 433         smb_server_release(sv);
 434         return (rc);
 435 }
 436 
 437 /*
 438  * This function is invoked when a share is disabled to disconnect trees
 439  * and close files.  Cleaning up may involve VOP and/or VFS calls, which
 440  * may conflict/deadlock with stuck threads if something is amiss with the
 441  * file system.  Queueing the request for asynchronous processing allows the
 442  * call to return immediately so that, if the unshare is being done in the
 443  * context of a forced unmount, the forced unmount will always be able to
 444  * proceed (unblocking stuck I/O and eventually allowing all blocked unshare
 445  * processes to complete).
 446  *
 447  * The path lookup to find the root vnode of the VFS in question and the
 448  * release of this vnode are done synchronously prior to any associated
 449  * unmount.  Doing these asynchronous to an associated unmount could run
 450  * the risk of a spurious EBUSY for a standard unmount or an EIO during
 451  * the path lookup due to a forced unmount finishing first.


 473                         continue;
 474 
 475                 shrname = nvpair_name(nvp);
 476                 ASSERT(shrname);
 477 
 478                 if ((rc = smb_kshare_unexport(sv, shrname)) != 0)
 479                         continue;
 480 
 481                 ux = kmem_cache_alloc(smb_kshare_cache_unexport, KM_SLEEP);
 482                 (void) strlcpy(ux->us_sharename, shrname, MAXNAMELEN);
 483 
 484                 smb_slist_insert_tail(&sv->sv_export.e_unexport_list, ux);
 485                 unexport = B_TRUE;
 486         }
 487 
 488         if (unexport)
 489                 smb_thread_signal(&sv->sv_export.e_unexport_thread);
 490         rc = 0;
 491 
 492 out:
 493         if (shrlist != NULL)
 494                 nvlist_free(shrlist);
 495         smb_server_release(sv);
 496         return (rc);
 497 }
 498 
 499 /*
 500  * Get properties (currently only shortname enablement)
 501  * of specified share.
 502  */
 503 int
 504 smb_kshare_info(smb_ioc_shareinfo_t *ioc)
 505 {
 506         ioc->shortnames = smb_shortnames;
 507         return (0);
 508 }
 509 
 510 /*
 511  * This function builds a response for a NetShareEnum RAP request.
 512  * List of shares is scanned twice. In the first round the total number
 513  * of shares which their OEM name is shorter than 13 chars (esi->es_ntotal)




 411                         cmn_err(CE_WARN, "export[%s]: failed accessing",
 412                             shrname);
 413                         continue;
 414                 }
 415 
 416                 if ((shr = smb_kshare_decode(share)) == NULL) {
 417                         cmn_err(CE_WARN, "export[%s]: failed decoding",
 418                             shrname);
 419                         continue;
 420                 }
 421 
 422                 /* smb_kshare_export consumes shr so it's not leaked */
 423                 if ((rc = smb_kshare_export(sv, shr)) != 0) {
 424                         smb_kshare_destroy(shr);
 425                         continue;
 426                 }
 427         }
 428         rc = 0;
 429 
 430 out:

 431         nvlist_free(shrlist);
 432         smb_server_release(sv);
 433         return (rc);
 434 }
 435 
 436 /*
 437  * This function is invoked when a share is disabled to disconnect trees
 438  * and close files.  Cleaning up may involve VOP and/or VFS calls, which
 439  * may conflict/deadlock with stuck threads if something is amiss with the
 440  * file system.  Queueing the request for asynchronous processing allows the
 441  * call to return immediately so that, if the unshare is being done in the
 442  * context of a forced unmount, the forced unmount will always be able to
 443  * proceed (unblocking stuck I/O and eventually allowing all blocked unshare
 444  * processes to complete).
 445  *
 446  * The path lookup to find the root vnode of the VFS in question and the
 447  * release of this vnode are done synchronously prior to any associated
 448  * unmount.  Doing these asynchronous to an associated unmount could run
 449  * the risk of a spurious EBUSY for a standard unmount or an EIO during
 450  * the path lookup due to a forced unmount finishing first.


 472                         continue;
 473 
 474                 shrname = nvpair_name(nvp);
 475                 ASSERT(shrname);
 476 
 477                 if ((rc = smb_kshare_unexport(sv, shrname)) != 0)
 478                         continue;
 479 
 480                 ux = kmem_cache_alloc(smb_kshare_cache_unexport, KM_SLEEP);
 481                 (void) strlcpy(ux->us_sharename, shrname, MAXNAMELEN);
 482 
 483                 smb_slist_insert_tail(&sv->sv_export.e_unexport_list, ux);
 484                 unexport = B_TRUE;
 485         }
 486 
 487         if (unexport)
 488                 smb_thread_signal(&sv->sv_export.e_unexport_thread);
 489         rc = 0;
 490 
 491 out:

 492         nvlist_free(shrlist);
 493         smb_server_release(sv);
 494         return (rc);
 495 }
 496 
 497 /*
 498  * Get properties (currently only shortname enablement)
 499  * of specified share.
 500  */
 501 int
 502 smb_kshare_info(smb_ioc_shareinfo_t *ioc)
 503 {
 504         ioc->shortnames = smb_shortnames;
 505         return (0);
 506 }
 507 
 508 /*
 509  * This function builds a response for a NetShareEnum RAP request.
 510  * List of shares is scanned twice. In the first round the total number
 511  * of shares which their OEM name is shorter than 13 chars (esi->es_ntotal)