1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

Don't leak a file descriptor in _lock_file when flock fails.

* lib/locking/file_locking.c (_lock_file): Close fd upon flock failure.
This commit is contained in:
Jim Meyering 2007-07-20 12:12:52 +00:00
parent 35b13fdb5e
commit 57015b12e2
2 changed files with 10 additions and 9 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.28 - Version 2.02.28 -
================================ ================================
Don't leak a file descriptor in _lock_file(), when flock fails.
Add SUN's LDOM virtual block device to filters Add SUN's LDOM virtual block device to filters
Split metadata-external.h out from metadata.h for the tools to use. Split metadata-external.h out from metadata.h for the tools to use.
@ -928,7 +929,7 @@ Some bug fixes & minor enhancements, including:
You need to update libdevmapper before using 'vgmknodes' or 'vgscan --mknodes'. You need to update libdevmapper before using 'vgmknodes' or 'vgscan --mknodes'.
If your root filesystem is on an LV, you should run one of those two If your root filesystem is on an LV, you should run one of those two
commands to fix up the special files in /dev in your real root filesystem commands to fix up the special files in /dev in your real root filesystem
after finishing with your initrd. Also, remember you can use after finishing with your initrd. Also, remember you can use
'vgchange --ignorelockingfailure' on your initrd if the tool fails because 'vgchange --ignorelockingfailure' on your initrd if the tool fails because
it can't write a lock file to a read-only filesystem. it can't write a lock file to a read-only filesystem.
@ -938,7 +939,7 @@ Wednesday 30th April 2003
A pvmove implementation is now available for the new metadata format. A pvmove implementation is now available for the new metadata format.
When running a command that allocates space (e.g. lvcreate), you can now When running a command that allocates space (e.g. lvcreate), you can now
restrict not only which disk(s) may be used but also the Physical Extents restrict not only which disk(s) may be used but also the Physical Extents
on those disks. e.g. lvcreate -L 10 vg1 /dev/hda6:1000-2000:3000-4000 on those disks. e.g. lvcreate -L 10 vg1 /dev/hda6:1000-2000:3000-4000
@ -950,12 +951,12 @@ The new format of LVM metadata is ready for you to test!
It's more compact and supports transactional changes and replication. It's more compact and supports transactional changes and replication.
Should things go wrong on a system, it's human-readable (and editable). Should things go wrong on a system, it's human-readable (and editable).
Please report any problems you find to the mailing list, Please report any problems you find to the mailing list,
linux-lvm@sistina.com. The software has NOT yet been thoroughly linux-lvm@sistina.com. The software has NOT yet been thoroughly
tested and so quite possibly there'll still be some bugs in it. tested and so quite possibly there'll still be some bugs in it.
Be aware of the disclaimer in the COPYING file. Be aware of the disclaimer in the COPYING file.
While testing, we recommend turning logging on in the configuration file While testing, we recommend turning logging on in the configuration file
to provide us with diagnostic information: to provide us with diagnostic information:
log { log {
file="/tmp/lvm2.log" file="/tmp/lvm2.log"
@ -966,7 +967,7 @@ to provide us with diagnostic information:
You should schedule regular backups of your configuration file and You should schedule regular backups of your configuration file and
metadata backups and archives (normally kept under /etc/lvm). metadata backups and archives (normally kept under /etc/lvm).
Please read docs/example.conf and "man lvm.conf" to find out more about Please read docs/example.conf and "man lvm.conf" to find out more about
the configuration file. the configuration file.
To convert an existing volume group called vg1 to the new format using To convert an existing volume group called vg1 to the new format using
@ -995,7 +996,7 @@ first segment could have 3 stripes while the second segment has just 2.
LVM2 maintains a backup of the current metadata for each volume group LVM2 maintains a backup of the current metadata for each volume group
in /etc/lvm/backup, and puts copies of previous versions in in /etc/lvm/backup, and puts copies of previous versions in
/etc/lvm/archive. "vgcfgbackup" and "vgcfgrestore" can be used to /etc/lvm/archive. "vgcfgbackup" and "vgcfgrestore" can be used to
create and restore from these files. If you fully understand what create and restore from these files. If you fully understand what
you're doing, metadata can be changed by editing a copy of a current you're doing, metadata can be changed by editing a copy of a current
backup file and using vgcfgrestore to reload it. backup file and using vgcfgrestore to reload it.
@ -1012,8 +1013,8 @@ What's not finished?
The internal cache. If you turn on debugging output you'll see lots of The internal cache. If you turn on debugging output you'll see lots of
repeated messages, many of which will eventually get optimised out. repeated messages, many of which will eventually get optimised out.
--test sometimes causes a command to fail (e.g. vgconvert --test) even --test sometimes causes a command to fail (e.g. vgconvert --test) even
though the real command would work: again, fixing this is waiting for though the real command would work: again, fixing this is waiting for
the work on the cache. the work on the cache.
Several of the tools do not yet contain the logic to handle full Several of the tools do not yet contain the logic to handle full
@ -1026,4 +1027,3 @@ Display output. Some metadata information cannot yet be displayed.
Recovery tools to salvage "lost" metadata directly from the disks: Recovery tools to salvage "lost" metadata directly from the disks:
but we hope the new format will mean such tools are hardly ever needed! but we hope the new format will mean such tools are hardly ever needed!

View File

@ -185,6 +185,7 @@ static int _lock_file(const char *file, int flags)
if (r) { if (r) {
errno = old_errno; errno = old_errno;
log_sys_error("flock", ll->res); log_sys_error("flock", ll->res);
close(ll->lf);
goto err; goto err;
} }