On Fri, Feb 23, 2018 at 11:26:35AM +0900, Misono, Tomohiro wrote:
> 
> 
> On 2018/02/16 4:05, Omar Sandoval wrote:
> > From: Omar Sandoval <osan...@fb.com>
> 
> > +static struct subvol_list *btrfs_list_deleted_subvols(int fd,
> > +                                                 struct 
> > btrfs_list_filter_set *filter_set)
> > +{
> > +   struct subvol_list *subvols = NULL;
> > +   uint64_t *ids = NULL;
> > +   size_t i, n;
> > +   enum btrfs_util_error err;
> > +   int ret = -1;
> > +
> > +   err = btrfs_util_deleted_subvolumes_fd(fd, &ids, &n);
> > +   if (err) {
> > +           error_btrfs_util(err);
> > +           return NULL;
> > +   }
> > +
> > +   subvols = malloc(sizeof(*subvols) + n * sizeof(subvols->subvols[0]));
> > +   if (!subvols) {
> > +           error("out of memory");
> > +           goto out;
> > +   }
> > +
> > +   subvols->num = 0;
> > +   for (i = 0; i < n; i++) {
> > +           struct listed_subvol *subvol = &subvols->subvols[subvols->num];
> > +
> > +           err = btrfs_util_subvolume_info_fd(fd, ids[i], &subvol->info);
> > +           if (err) {
> 
> I think there is a small chance that subvolume would be removed from tree 
> between 
> btrfs_util_deleted_subvolumes_fd() and btrfs_util_subvolume_info_fd().
> So, error of BTRFS_UTIL_ERROR_SUBVOLUME_NOT_FOUND should be ignored.

Thanks, since this patch isn't in the devel branch in, I'll fold the fix
in.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to