Print this page
*** NO COMMENTS ***


1926 top:
1927         if (error = dmu_objset_hold(zc->zc_name, FTAG, &os)) {
1928                 if (error == ENOENT)
1929                         error = ESRCH;
1930                 return (error);
1931         }
1932 
1933         p = strrchr(zc->zc_name, '/');
1934         if (p == NULL || p[1] != '\0')
1935                 (void) strlcat(zc->zc_name, "/", sizeof (zc->zc_name));
1936         p = zc->zc_name + strlen(zc->zc_name);
1937 
1938         /*
1939          * Pre-fetch the datasets.  dmu_objset_prefetch() always returns 0
1940          * but is not declared void because its called by dmu_objset_find().
1941          */
1942         if (zc->zc_cookie == 0) {
1943                 uint64_t cookie = 0;
1944                 int len = sizeof (zc->zc_name) - (p - zc->zc_name);
1945 
1946                 while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0)
1947                         (void) dmu_objset_prefetch(p, NULL);

1948         }

1949 
1950         do {
1951                 error = dmu_dir_list_next(os,
1952                     sizeof (zc->zc_name) - (p - zc->zc_name), p,
1953                     NULL, &zc->zc_cookie);
1954                 if (error == ENOENT)
1955                         error = ESRCH;
1956         } while (error == 0 && dataset_name_hidden(zc->zc_name) &&
1957             !(zc->zc_iflags & FKIOCTL));
1958         dmu_objset_rele(os, FTAG);
1959 
1960         /*
1961          * If it's an internal dataset (ie. with a '$' in its name),
1962          * don't try to get stats for it, otherwise we'll return ENOENT.
1963          */
1964         if (error == 0 && strchr(zc->zc_name, '$') == NULL) {
1965                 error = zfs_ioc_objset_stats(zc); /* fill in the stats */
1966                 if (error == ENOENT) {
1967                         /* We lost a race with destroy, get the next one. */
1968                         zc->zc_name[orig_len] = '\0';




1926 top:
1927         if (error = dmu_objset_hold(zc->zc_name, FTAG, &os)) {
1928                 if (error == ENOENT)
1929                         error = ESRCH;
1930                 return (error);
1931         }
1932 
1933         p = strrchr(zc->zc_name, '/');
1934         if (p == NULL || p[1] != '\0')
1935                 (void) strlcat(zc->zc_name, "/", sizeof (zc->zc_name));
1936         p = zc->zc_name + strlen(zc->zc_name);
1937 
1938         /*
1939          * Pre-fetch the datasets.  dmu_objset_prefetch() always returns 0
1940          * but is not declared void because its called by dmu_objset_find().
1941          */
1942         if (zc->zc_cookie == 0) {
1943                 uint64_t cookie = 0;
1944                 int len = sizeof (zc->zc_name) - (p - zc->zc_name);
1945 
1946                 while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) {
1947                         if (!dataset_name_hidden(zc->zc_name))
1948                                 (void) dmu_objset_prefetch(zc->zc_name, NULL);
1949                 }
1950         }
1951 
1952         do {
1953                 error = dmu_dir_list_next(os,
1954                     sizeof (zc->zc_name) - (p - zc->zc_name), p,
1955                     NULL, &zc->zc_cookie);
1956                 if (error == ENOENT)
1957                         error = ESRCH;
1958         } while (error == 0 && dataset_name_hidden(zc->zc_name) &&
1959             !(zc->zc_iflags & FKIOCTL));
1960         dmu_objset_rele(os, FTAG);
1961 
1962         /*
1963          * If it's an internal dataset (ie. with a '$' in its name),
1964          * don't try to get stats for it, otherwise we'll return ENOENT.
1965          */
1966         if (error == 0 && strchr(zc->zc_name, '$') == NULL) {
1967                 error = zfs_ioc_objset_stats(zc); /* fill in the stats */
1968                 if (error == ENOENT) {
1969                         /* We lost a race with destroy, get the next one. */
1970                         zc->zc_name[orig_len] = '\0';