Mike Frysinger [Mon, 7 Dec 2009 14:18:17 +0000 (15:18 +0100)]
flock: fix hang when parent ignores SIGCHLD
If flock is executed from a process which has set SIGCHLD to SIG_IGN, then
flock will eat cpu and hang indefinitely if given a command to execute.
So before we fork(), make sure to set SIGCHLD handling back to the default
so that the later waitpid() doesn't freak out on us.
[kzak@redhat.com: - add a check for waitpid() return value]
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 4 Dec 2009 14:45:19 +0000 (15:45 +0100)]
build-sys: rewrite TLS detection
* use more robust tls.m4 from gcc project
The old version (from util-linux-ng) used AC_TRY_COMPILE. That's
wrong. We need to use AC_RUN_IFELSE to check that the result is
link-able and executable.
The new version also test it TLS really works in multi-thread
applications.
* we need to detect TLS usability for cross-compiling
* this new version supports __thread keyword only, it seems that we
needn't to care about anything other
Ludwig Nussel [Fri, 27 Nov 2009 09:15:53 +0000 (10:15 +0100)]
fsck: honor nofail option in fsck
analog to mount gracefully ignoring non existing devices if the "nofail"
option is specified in fstab, also have fsck -A skip them. This way it's
possible to have devices optionally not available during boot but still
have them fsck'd if they are there.
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
On Wed, Nov 18, 2009 at 03:33:12PM +0000, Daniel Drake wrote:
> Booting into a system this way just leads to problems because
> you cannot remount the root read-only at shutdown (leading to unclean
> shutdowns).
> Miklos Szeredi pointed out a trick to turn any directory into a
> mount point which avoids this problem. Therefore we can simplify
> switch_root again and simply document that its users should set
Karel Zak [Thu, 19 Nov 2009 14:56:12 +0000 (15:56 +0100)]
mount: check for unsuccessful read-only bind mounts
Linux kernel allows to use MS_RDONLY together with MS_BIND,
unfortunately the MS_RDONLY is silently ignored and the target
mountpoint is still read-write. Then we have 'ro' in mtab and 'rw' in
/proc/mounts.
This patch checks for this situation by access(2) or futimens(2)
(change atime) and mtab is properly updated and user informed.
Reported-by: Terry Burton <tez@terryburton.co.uk> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 4 Nov 2009 14:14:04 +0000 (15:14 +0100)]
fdisk: offer aligned first sector
Typical "new partition" dialog looks like:
Partition number (1-4): 1
First sector (4-818687, default 4):
^^^^^^^^^
The range (e.g. 4-818687) depends on fdisk mode (DOS/non-DOS), but the
default value should be always aligned.
For example RAID5 device in the DOS mode:
Disk /dev/md0: 419 MB, 419168256 bytes
2 heads, 4 sectors/track, 102336 cylinders, total 818688 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 65536 bytes
Disk identifier: 0x081479c3
....
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (4-818687, default 128): <---- !!!
Using default value 128
Last sector, +sectors or +size{K,M,G} (128-818687, default 818687): +10M
Command (m for help): p
....
Device Boot Start End Blocks Id System
/dev/md0p1 128 20607 10240 83 Linux
Karel Zak [Tue, 3 Nov 2009 11:00:23 +0000 (12:00 +0100)]
fdisk: print info and recommendations about alignment
* inform user that phy.sector > log.sector
* warn user when alignment_offset is not provided does, DOS-compatible
mode is enabled and the default geo.sectors are not aligned
* suggest to change display units to sectors (oh yes, fdisk
default are cylinders...)
Karel Zak [Thu, 29 Oct 2009 10:25:59 +0000 (11:25 +0100)]
fdisk: read topology info from libblkid
and print ('p' command) info about logical and physical sectors and
alignment_offset.
minimum_io_size
we don't use physical sector size directly, because on RAIDs is
better to use minimum_io_size (aka stripe chunk size). For disk drives
is minimum_io_size the same value as physical sector size.
alignment_offset
For compatibility with legacy operating systems some vendors provide
disks where logical and physical sectors are aligned at sector 63
(= geometry.sectors). In other words the physical 4KB sectors
start at LBA -1. Then the physical boundary is at:
Karel Zak [Tue, 10 Nov 2009 11:48:34 +0000 (12:48 +0100)]
Revert "libblkid: fix buffer usage in FAT prober"
This patch is unnecessary, the library uses two buffers and the VFAT
superblock is always stored in the probe->sbbuf buffer which is never
overwritten. It seems that FAT fsinfo is also in the superblock
buffer. I was too paranoid :-) Sorry.
Karel Zak [Fri, 6 Nov 2009 22:43:46 +0000 (23:43 +0100)]
build-sys: clean up gtk-doc stuff
* gtk-doc.make does not care about difference between $srcdir and $builddir
and many things are generated into $srcdir. It's pretty difficult to support
out-of-source build...
* gtk-doc expects that many generated files are stored in repository
(we don't use XML templates, all documentation in source code only).
* we don't want to distribute generated html files, the docs is
attractive for very small group of people...
Frankly, it would be nice to found something more robust and better
than gtk-doc.
Karel Zak [Fri, 30 Oct 2009 11:20:51 +0000 (12:20 +0100)]
libblkid: does not return useless binary data
Currently, the binary blkid_probe_get_{topology,partitions}() API
returns empty structs when information has not been gathered. This is
confusing for applications. It's seems better to return NULL.
Reported-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 27 Oct 2009 10:30:37 +0000 (11:30 +0100)]
libblkid: add BLKID_{VERSION,DATE} to blkid.h
The original e2fsprogs has BLKID_{VERSION,DATE} macros in blkid.h.
Although the macros are not updated for many years in e2fsprogs. So I
guess nobody uses it.
Crypto devices may sometimes have multiple additional prober matches,
however just like RAID, there's no danger of activating the wrong one
since special help is needed to activate the block device before it
can be used.
Thus modify blkid_do_safeprobe() to break out of the loop when a
crypto device is detected, as it does already for RAID.
Signed-off-by: Scott James Remnant <scott@ubuntu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* on systems where DM is fully integrated with udev the /dev/mapper/<name>
files are symlinks to /dev/dm-N. It means we need a special care to hide
private device-mapper names.
Karel Zak [Thu, 22 Oct 2009 12:52:39 +0000 (14:52 +0200)]
libblkid: use BLKSSZGET for GPT sectors
The current implementation uses fixed sector size (512 bytes), that's
wrong. UEFI standard requires real logical sector size -- it means
BLKSSZGET for Linux.
The size of GPT header is not static, but whole sector is allocated
for the header. In theory the HeaderSize field could be greater than
sizeof(struct gpt_header). It means we have to read whole sector with
the header, because the header crc32 checksum is counted according to
HeaderSize.
Karel Zak [Fri, 16 Oct 2009 00:34:28 +0000 (02:34 +0200)]
libblkid: add missing packed attributes
This patch add __attribute__((packed)) to almost all superblock and
disk label definitions. Well, in many cases this is not necessary, but
it's a cheap way how to keep the code robust...