diff options
author | NeilBrown <neilb@suse.de> | 2011-01-25 07:56:53 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-01-25 07:56:53 +1100 |
commit | 1cc7f4feb9a979fdf7ac4bb06e5632b065d4f4d9 (patch) | |
tree | ab73ac81e3c55388d07589401bdb6c3e6e2b33e7 /super-ddf.c | |
parent | 446d2a5ad48671be2e23676d9ea93af1b8dddf0b (diff) | |
download | mdadm-1cc7f4feb9a979fdf7ac4bb06e5632b065d4f4d9.tar.gz |
Don't close fds in write_init_super
We previously closed all 'fds' associated with an array in
write_init_super .. sometimes, and sometimes at bad times.
This isn't neat and free_super is a better place to close them.
So make sure free_super always closes the fds that the metadata
manager kept hold of, and stop closing them in write_init_super.
Also add a few more calls to free_super to make sure they really do
get closed.
Reported-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-ddf.c')
-rw-r--r-- | super-ddf.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/super-ddf.c b/super-ddf.c index bd3e884..287fa7f 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -2272,7 +2272,7 @@ static int add_to_super_ddf(struct supertype *st, static unsigned char null_conf[4096+512]; -static int __write_init_super_ddf(struct supertype *st, int do_close) +static int __write_init_super_ddf(struct supertype *st) { struct ddf_super *ddf = st->sb; @@ -2379,12 +2379,6 @@ static int __write_init_super_ddf(struct supertype *st, int do_close) successes++; } - if (do_close) - for (d = ddf->dlist; d; d=d->next) { - close(d->fd); - d->fd = -1; - } - return attempts != successes; } @@ -2437,7 +2431,7 @@ static int write_init_super_ddf(struct supertype *st) struct dl *d; for (d = ddf->dlist; d; d=d->next) while (Kill(d->devname, NULL, 0, 1, 1) == 0); - return __write_init_super_ddf(st, 1); + return __write_init_super_ddf(st); } } @@ -3239,7 +3233,7 @@ static void ddf_sync_metadata(struct supertype *st) if (!ddf->updates_pending) return; ddf->updates_pending = 0; - __write_init_super_ddf(st, 0); + __write_init_super_ddf(st); dprintf("ddf: sync_metadata\n"); } |