libuuid: Don't run uuidd if it would fail due to permission problems
Some distributions don't like installing uuidd setuid or setgid. So
if the setuid or setigid bit is not set with uuidd, and the current
process does not have write access to the UUIDD work directory, don't
try running uuidd, since it won't work properly.
libuuid, uuidd: Avoid infinite loop while reading from the socket fd
If for some reason the uuidd daemon or the process calling uuidd
exited unexpectely, the read_all() function would end up looping
forever, either in uuidd or in libuuid. Fix this terminating the loop
if no data can be read after five tries to read from the file
descriptor.
uuidd: Avoid closing the server socket when calling create_daemon()
In the event that file descriptors 0-2 are closed when uuidd is
started, the server socket could be created as a file descriptor that
will get closed when create_daemon() tries detaching the uuidd daemon
from its controlling tty. Avoid this case by using dup(2).
Theodore Ts'o [Tue, 30 Jun 2009 01:19:28 +0000 (21:19 -0400)]
libuuid: Make sure fd's 0, 1, and 2 are valid before exec'ing uuidd
When closing all of the file descriptors before starting uuidd, make
sure file descriptors 0, 1, and 2 are reserved by opening /dev/null.
This prevents strange bugs caused by assumptions regarding file
descriptors <= 2 as being special.
Jeff Mahoney [Mon, 29 Jun 2009 21:05:36 +0000 (23:05 +0200)]
raw: Use the RAW_SETBIND ioctl without stat'ing the raw# file
The in-kernel ioctl code creates a raw# device on-demand. udev will create
the /dev/raw/raw# file when the device is created automatically.
The current raw userspace code wants to stat the file before using it,
which is unnecessary for setting up the raw device.
This patch stats the file only when query() is called as a singleton, and
it's doubtful it's needed even there. I modified as little code as I could,
though.
Tilman Schmidt [Sun, 10 May 2009 11:54:51 +0000 (13:54 +0200)]
ldattach: add N_PPS support
Add support for a line discipline name "PPS" selecting the
Pulse Per Second line discipline N_PPS (18). The number has been
reserved since kernel release 2.6.28, and the implementation is
finally going to be submitted for kernel release 2.6.31.
Karel Zak [Tue, 9 Jun 2009 07:58:46 +0000 (09:58 +0200)]
switch_root: new command
Copied from Dracut project:
git://dracut.git.sourceforge.net/gitroot/dracut
switch_root history in dracut.git repository:
$ git shortlog switch_root.c
Harald Hoyer (5):
replace switch_root shell script with binary
add \n to switch_root
use switch_root code from http://pjones.fedorapeople.org/mkstart/usr/lib/mkstart/switchroot.c
mount move instead of umount and fix the search for fallback inits
setsid() and set controlling terminal for real /sbin/init
Victor Lowther (2):
Simplify switch_root.c a bit
Remove all files on the initramfs before switching root
Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 16 Jun 2009 22:30:51 +0000 (00:30 +0200)]
libblkid: don't require udev symlinks verification for non-root users
There is noway how to verify LABEL/UUID for non-root users, we have to
follow udev symlinks or use cached information from blkid.tab. Use
unverified symlinks is faster.
Karel Zak [Wed, 10 Jun 2009 07:37:43 +0000 (09:37 +0200)]
mount: move MS_{PROPAGATION,BIND,MOVE} detection
The previous commit does not properly fix the problem with "none"
fstype and MS_{PROPAGATION,BIND,MOVE} flags. The real fstype has to
be replaced with "none" before we try to use /sbin/mount.<type>
helper.
Allow users to set the "none" class on processes. Using the
none class has the distict advantage that the io priority
is inherited from the cpu nice level. Update the man page
to reflect the change.
Signed-off-by: Jakob Unterwurzacher <jakobunt@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Zdenek Behan [Tue, 19 May 2009 14:19:32 +0000 (16:19 +0200)]
fdisk: add simple test for doslabel stuff
Initial tests/fdisk patch to test most of the doslabel-related stuff.
Coverage of dos-related functions is about 60%, does not test the
verify/fix-PT code.
[kzak@redhat.com: - fix test design to match to
output/expect/diff idea]
Signed-off-by: Zdenek Behan <rain@matfyz.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
Chris Webb [Wed, 13 May 2009 14:54:23 +0000 (15:54 +0100)]
fdisk: (and cfdisk) fix to be consistent about maximum heads
Fix fdisk and cfdisk to be consistent about maximum heads
Without this patch, fdisk allows up to 256 heads to be set via the menu, but
only up to 255 heads by command line -H. Similarly, cfdisk's -H option also
enforces heads <= 255 instead of heads <= 256.
The strange limit of 256 comes about because (heads - 1) should fit in a
single byte for legacy CHS. Geometries of 256 heads and 32 sectors are seen
in disks from other operating systems where cylinder-aligned partitions
which are also aligned to a 4MB boundary are wanted.
Karel Zak [Thu, 14 May 2009 16:29:03 +0000 (18:29 +0200)]
blkid: blkid_do_safeprobe() has to be tolerant to RAIDs
It's pretty generic that RAID signature is on the same device as FS
signature. We have to be tolerant and ignore filesystems signatures
on such devices. The RAID signature is always preferred.
Karel Zak [Thu, 14 May 2009 16:04:55 +0000 (18:04 +0200)]
blkid: fix "hangs forever with partition type mdraid"
> #:> blkid /dev/sda7
> /dev/sda7: UUID="c193d159-1fd4-1a4b-4037-f3433e016f3d" TYPE="mdraid"
>
> The blkid binary build from the util-linux-ng sources just hangs
> forever with 100% cpu load with the same command.
Reported-by: Juergen Daubert <jue@jue.li> Signed-off-by: Karel Zak <kzak@redhat.com>
Mike Frysinger [Sun, 10 May 2009 20:57:31 +0000 (16:57 -0400)]
losetup: handle symlinks in /dev/loop/
The loop_scandir() expects all the files in /dev/loop/ to be actual
devices and not symlinks to devices. However, udev by default sets up
symlinks in /dev/loop/ thereby breaking the fallback scan logic when
looking for devices more than the default number of 8.
Simple way to reproduce is:
- <detach all devices>
- cd /dev/loop
- rm -f [2-7]
- losetup 0 autogen.sh
- mv 1 8
- for n in {1..7} ; do ln -s 0 $n ; done
- losetup -f
<error but should have found /dev/loop/8>
[kay.sievers@vrfy.org:
just a note, udev does not do that by default. It is
devfs-nonsense, which the "default" never did.]
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reported-by: Mario Bachmann <grafgrimm77@gmx.de>
Mike Frysinger [Sun, 10 May 2009 20:37:18 +0000 (16:37 -0400)]
lscpu: fix cpuid code on x86/PIC
If we build lscpu as PIE, we currently get a build failure:
lscpu.c: In function 'main':
lscpu.c:333: error: can't find a register in class 'BREG' while reloading 'asm'
lscpu.c:333: error: 'asm' operand has impossible constraints
make[2]: *** [lscpu.o] Error 1
So we need a little bit of register shuffling to keep gcc happy.
chrt: don't assume SCHED_BATCH and SCHED_IDLE exist
SCHED_FIFO, SCHED_OTHER, SCHED_RR are part of POSIX 1003.1b Process
Scheduling, so it is correct to assume they always exists.
SCHED_BATCH and SCHED_IDLE are Linux specific, we should not assume
they exists.
Defining SCHED_BATCH and SCHED_IDLE to random values (ie the ones found
on Linux systems) is not an option as they may *collide* with the one of
other systems. For example on GNU/kFreeBSD we have:
#define SCHED_RR 3
and on Linux we have:
#define SCHED_BATCH 3
[kzak@redhat.com: - add "Linux specific" notes to chrt.1
- add a note about BATCH and PR conflict to
this commit message]
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 5 May 2009 19:40:19 +0000 (21:40 +0200)]
blkid: use /dev/mapper/<name> rather than /dev/dm-<N>
The libblkid (since v1.41.1) returns private device-mapper names (e.g.
/dev/dm-0). It's because the probe_one() function scans /dev before
/dev/mapper.
brw-rw---- 1 root disk 253, 0 2009-04-27 13:41 /dev/dm-0
brw-rw---- 1 root disk 253, 0 2009-04-27 13:41 /dev/mapper/TestVolGroup-TestLogVolume
Old version:
# blkid -t LABEL="TEST-LABEL" -o device
/dev/dm-0