Colin Watson [Sat, 13 Mar 2010 00:46:35 +0000 (00:46 +0000)]
libblkid: fix infinite loop when probe chain bails out early
The superblocks probe bails out early with no results in some cases. If
this happens, blkid_do_probe needs to go to the next chain, rather than
entering an infinite loop calling superblocks_probe over and over again.
[kzak@redhat.com: - print debug message always when leaving
superblocks_probe()]
Addresses: https://bugs.launchpad.net/bugs/528073 Signed-off-by: Colin Watson <cjwatson@canonical.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Mike Frysinger [Sun, 7 Mar 2010 05:16:41 +0000 (00:16 -0500)]
mount: properly ignore comments in /etc/filesystems
The POSIX spec for sscanf() says that whitespace may be matched against 0
bytes which means doing sscanf(" %s") against "#foo" will result in a
match. You can see this behavior by using the verbose options on a garbage
file:
...
mount: you didn't specify a filesystem type for /dev/null
I will try all types mentioned in /etc/filesystems or /proc/filesystems
Trying #
mount: mount(2) syscall: source: "/dev/null", target: "/", filesystemtype: "#", mountflags: -1058209792, data: (null)
Trying #vfat
mount: mount(2) syscall: source: "/dev/null", target: "/", filesystemtype: "#vfat", mountflags: -1058209792, data: (null)
...
Reported-by: Dave Barton <dave.barton@comodo.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Karel Zak [Wed, 10 Mar 2010 22:08:26 +0000 (23:08 +0100)]
swapon: remove " (deleted)" from filenames from /proc/swaps
The filenames in /proc/swaps are generated by seq_path() and this
function uses __d_path() from fs/dcache.c. The filename could
generated with " (deleted)" suffix. We need real filenames without
the suffix.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=562403 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 10 Mar 2010 11:49:56 +0000 (12:49 +0100)]
libblkid: support alignment_offset=-1
Unfortunately, Linux kernel uses "signed int" for alignment_offset and
the offset could be -1 for devices with undefined alignment (if no
compatible sizes and alignments exist for stacked devices).
There is no way how libblkid caller can respond to the value -1, so we
are going to hide this corner case...
This patch also cleanups usage of empty topology values (e.g.
MINIMUM_IO_SIZE=0 value should not be returned by NAME=value API. The
binary blkid_topology_get_* is not affected by this change.)
Summary of changes from v2.5.42 to v2.5.43
[PATCH] removes posix option of fat (3/5)
This removes the posix option of vfat. The current posix options works
only as an alias of name_check=s.
Henne Vogelsang [Mon, 1 Mar 2010 10:35:54 +0000 (11:35 +0100)]
lscpu: fix cpuid opcode detection
Fixes commit c9239f23acdc8b50f8bcbfadf967c6a490fd4693. The author
didn't care for matching constraints when resorting the register
constraints. The eax register (with the cpuid opcode) is now in
operand 1, not zero anymore.
Signed-off-by: Henne Vogelsang <hvogel@opensuse.org>
Andreas Dilger [Wed, 17 Feb 2010 09:21:27 +0000 (10:21 +0100)]
libblkid: fix ZSF detection
Fix the ZFS device detection by looking at multiple uberblocks to see
if any are present, rather than looking for the ZFS boot block which
is not always present.
There may be up to 128 uberblocks, but the first 4 are not written to
disk on a newly-formatted filesystem so check several of them at
different offsets within the uberblock array.
[kzak@redhat.com: - port e2fsprogs patch to util-linux-ng]
Signed-off-by: Andreas Dilger <adilger@sun.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 15 Feb 2010 14:55:22 +0000 (15:55 +0100)]
fdisk: use 1MiB offset and grain always when possible
It would be nice to minimize dependence between the disk layout and
disk topology. We have to follow disk topology for alignment_offset
and huge (> 1MiB) I/O sizes only. For all others disks we can use 1MiB
grain and 1MiB offset.
Reported-by: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 12 Feb 2010 09:21:05 +0000 (10:21 +0100)]
build-sys: remove duplicate #includes
$ make checkincludes
fsck/fsck.c: errno.h is included more than once.
lib/canonicalize.c: string.h is included more than once.
shlibs/blkid/src/blkidP.h: stdio.h is included more than once.
shlibs/blkid/src/devname.c: string.h is included more than once.
shlibs/blkid/src/devno.c: string.h is included more than once.
Karel Zak [Thu, 4 Feb 2010 14:02:16 +0000 (15:02 +0100)]
fdisk: cleanup warnings
* don't print:
The number of cylinders for this disk is set to 12161.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
we really don't care about MS-DOS or extremely old LILO.
* inform users that DOS-compatible mode is bad and deprecated thing
(It's difficult to use 2048 sectors grain or 4KiB sectors or
alignment_offset in DOS mode where all is based on cylinders...)
* don't check for cylinders boundary in non-DOS mode
Karel Zak [Tue, 9 Feb 2010 10:06:42 +0000 (11:06 +0100)]
fdisk: fix default first sector
The previous release 2.17 introduces aligned defaults for the first
and last sectors on the partition. Unfortunately, there is endless
loop when the code looks for first unused aligned sector.
Karel Zak [Mon, 8 Feb 2010 16:45:42 +0000 (17:45 +0100)]
fdisk: don't check alignment_offset against geometry
The alignment_offset is compensation for DOS compatible partitioning.
It usually matches with disk geometry (e.g. 63 sectors), but the
offset is also exported from phy.disks to RAIDs there the geometry
don't match with the offset. So.. don't print unnecessary warning.
Karel Zak [Thu, 4 Feb 2010 21:19:38 +0000 (22:19 +0100)]
libblkid: don't return error on empty files
Currently, the library does not allow to initialize blkid_probe if the
file (or block device) is empty. The empty file is reported as an
error. That's wrong. The empty file should be interpreted as a file
without any FS or PT. It means that
blkid_do_{probe,safeprobe,fullprobe}()
have to return 1 ("nothing").
Reported-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 28 Jan 2010 18:42:04 +0000 (19:42 +0100)]
fdisk: use optimal_io_size
* rename the minimum_io_size variable to io_size
* use blkid_topology_get_optimal_io_size() for io_size initialization
* use blkid_topology_get_minimum_io_size() as a fallback solution for
io_size initialization
Karel Zak [Thu, 28 Jan 2010 15:25:52 +0000 (16:25 +0100)]
login: check that after tty reopen we still work with a terminal
* the login code assumes that stdin is a terminal, it's better to
check (by isatty()) that after tty reopen we still have a terminal
* this patch also removes very old obscure fallback for situations where
ttyname() returns nothing (then ttyn = "/dev/tty??"). I guess that the
fake string was originally for utmp records or so. Currently (in last 10
years...) code requires that the tty name is a real open-able file.
It means the fake tty name is completely useless.
Reported-by: Yann Droneaud <yann@droneaud.fr> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 27 Jan 2010 12:31:16 +0000 (13:31 +0100)]
login: don't link PAMed version with libcrypt
The login, chsh and chfn utils don't need to be linked against libcrypt.
The libcrypt library is necessary only when login utils are not liked
with PAM.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=559196 Signed-off-by: Karel Zak <kzak@redhat.com>
Linus Torvalds [Mon, 18 Jan 2010 23:09:21 +0000 (00:09 +0100)]
libblkid: disable read-ahead when probing device files
Read-ahead doesn't work very well on device probing, and can hurt a lot
when we do essentially random accesses on very slow devices. So disable it
if possible.
Karel Zak [Mon, 18 Jan 2010 14:43:25 +0000 (15:43 +0100)]
libblkid: read() optimization for small devices
- don't read the begin (69kB) of the device by one large read()
- fill in the SB buffer dynamically
- use extra buffer for FATs root dir entries (FAT FS label)
on small devices to avoid large reads
Karel Zak [Mon, 18 Jan 2010 11:50:36 +0000 (12:50 +0100)]
libblkid: restrict RAID/FS proving for small devices (1.4MiB)
- don't ignore @size in blkid_probe_set_device()
- ignore extremely small devices (<= 1024 bytes, e.g. extended partitions)
- don't use safe probing for small devices
- don't probe for RAIDs on small devices
Karel Zak [Wed, 6 Jan 2010 10:12:43 +0000 (11:12 +0100)]
fdisk: sleep-after-sync and fsync usage
It seems that sleep() after sync() is unnecessary legacy. It's very
probably unnecessary since kernel 1.3.20. For example the libparted
does not to use sleep() at all.
It seems that more important is fsync() usage in fdisks. For more
details see
DRBD is the Distributed Replicated Block Device, a replication service for low
level block devices.
The attached patch provides libblkid detection for v08 type drbd devices
(v08 is the current one).
[kzak@redhat.com: - port to libblkid 2.17
- use BLKID_USAGE_RAID flag
- remove BLKID_IDINFO_TOLERANT flag
- note that DRBD is supported since kernel v2.6.33-rc1]
Signed-off-by: Bastian Friedrich <bastian.friedrich@collax.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 4 Jan 2010 10:34:13 +0000 (11:34 +0100)]
sfdisk: confused about disk size
The size of disk in the sfdisk command is based on number of cylinders
(this is probably legacy from CHS epoch). That's wrong because
partitions are addressed in sectors (LBA), so cylinders don't provide
necessary resolution (granularity).
On Sat, Jan 02, 2010 at 01:01:16PM +0100, Giulio wrote:
> $ cat /sys/block/sda/size
> 184549376
>
> $ sfdisk -d /dev/sda > part.dump
> $ cat part.dump
> # partition table of /dev/sda
> unit: sectors
>
> /dev/sda1 : start= 2048, size= 2097152, Id=83
> /dev/sda2 : start= 2099200, size= 12582912, Id=83
> /dev/sda3 : start= 14682112, size= 84934656, Id=83
> /dev/sda4 : start= 99616768, size= 84932608, Id=83
>
>
> $ sfdisk -L /dev/sda < part.dump
> Checking that no-one is using this disk right now ...
> OK
>
> Disk /dev/sda: 11487 cylinders, 255 heads, 63 sectors/track
> Old situation:
> Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
>
> Device Boot Start End #cyls #blocks Id System
> /dev/sda1 0+ 130- 131- 1048576 83 Linux
> /dev/sda2 130+ 913- 784- 6291456 83 Linux
> /dev/sda3 913+ 6200- 5287- 42467328 83 Linux
> /dev/sda4 6200+ 11487- 5287- 42466304 83 Linux
> Warning: given size (84932608) exceeds max allowable size (84921887)