1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

filters: dump filter returns error code

Add int return value from dump() function.
Report stack for error case.
Update composable filter.
This commit is contained in:
Zdenek Kabelac 2013-06-02 23:27:34 +02:00
parent 4a657a13b1
commit f05c5a97c3
5 changed files with 17 additions and 13 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
Report backtrace from dump filter error path.
Do not use persistent filter with lvmetad.
Composable persistent filter functionality for global filter.
Override system's global_filter settings for vgimportclone.

View File

@ -708,8 +708,9 @@ int lvmcache_label_scan(struct cmd_context *cmd, int full_scan)
* device cache for the benefit of short-lived processes.
*/
if (full_scan == 2 && cmd->is_long_lived &&
cmd->dump_filter && cmd->filter && cmd->filter->dump)
cmd->filter->dump(cmd->filter, 0);
cmd->dump_filter && cmd->filter && cmd->filter->dump &&
!cmd->filter->dump(cmd->filter, 0))
stack;
r = 1;

View File

@ -1652,8 +1652,9 @@ void destroy_toolcontext(struct cmd_context *cmd)
struct dm_config_tree *cft_cmdline;
FILE *new_stream;
if (cmd->dump_filter && cmd->filter && cmd->filter->dump)
cmd->filter->dump(cmd->filter, 1);
if (cmd->dump_filter && cmd->filter && cmd->filter->dump &&
!cmd->filter->dump(cmd->filter, 1))
stack;
archive_exit(cmd);
backup_exit(cmd);

View File

@ -26,7 +26,7 @@ struct dev_filter {
int (*passes_filter) (struct dev_filter * f, struct device * dev);
void (*destroy) (struct dev_filter * f);
void (*wipe) (struct dev_filter * f);
void (*dump) (struct dev_filter * f, int merge_existing);
int (*dump) (struct dev_filter * f, int merge_existing);
void *private;
unsigned use_count;
};

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2013 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@ -49,15 +49,16 @@ static void _composite_destroy(struct dev_filter *f)
dm_free(f);
}
static void _dump(struct dev_filter *f, int merge_existing)
static int _dump(struct dev_filter *f, int merge_existing)
{
struct dev_filter **filters = (struct dev_filter **) f->private;
struct dev_filter **filters;
while (*filters) {
if ((*filters)->dump)
(*filters)->dump(*filters, merge_existing);
filters++;
}
for (filters = (struct dev_filter **) f->private; *filters; ++filters)
if ((*filters)->dump &&
!(*filters)->dump(*filters, merge_existing))
return_0;
return 1;
}
static void _wipe(struct dev_filter *f)