Karel Zak [Thu, 22 Apr 2010 19:30:04 +0000 (21:30 +0200)]
libblkid: fix collision between RAID and PT probing
The RAID signature is usually at end of the block device. We have to
differentiate between:
- RAID signature at the end of disk, and
- RAID signature at the end of the last partition
The position of the signature is same in both cases... It means we have
to the parse partition table and check if the area where is RAID signature
is covered by any partition. If yes, then the RAID signature belongs to the
partition and has to be ignored during whole-disk probing.
The second problem are RAID1 underlaying disks (=raid members). The
RAID device could be partitioned, in such a case the partition table
is visible from underlaying devices. These partition tables has to be
ignored. The libblkid ignores partition tables on raid members now.
Note that all these changes are implemented for blkid_do_safeprobe()
only. The others functions allow to access all detected superblocks or
partition tables.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=543749 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 21 Apr 2010 12:24:52 +0000 (14:24 +0200)]
liblkid: export magic strings from raids
The library provides detected magic strings by SBMAGIC= and offsets of
the magic strings by SBMAGIC_OFFSET= variables. This patch allows to
support this feature for RAIDs and filesystems where the magic string
is not on fixed position.
Karel Zak [Thu, 8 Apr 2010 14:38:23 +0000 (16:38 +0200)]
mount: use auto-loopdev for all known filesystems
The commit e580266914734898999f652025f9c7141023df66 introduced
"automatically detect and loop-mount regular files". This should be
used only for filesystems that require block devices.
All known filesystems in libblkid depend block devices, so we can
use blkid_known_fstype() as a filter for this feature.
M.S.Colclough [Wed, 31 Mar 2010 16:11:00 +0000 (18:11 +0200)]
libblkid: avoid probing CDs for RAID
RAID probing of CD/DVD can yield errors because of well-known problem
in reading the end of the disk with some disk/drive combinations.
Borrow CD detection method from udev and skip the RAID tests for
these devices.
[kzak@redhat.com: - check for linux/cdrom.h in ./configure
- add #ifdef around the ioctl call
- call the ioctl for block devices only]
Signed-off-by: Mark Colclough <m.s.colclough@bham.ac.uk> Signed-off-by: Karel Zak <kzak@redhat.com>
Yann Droneaud [Wed, 31 Mar 2010 14:14:04 +0000 (16:14 +0200)]
build-sys: improved check for fallocate()
With glibc 2.10 on a 32bits system, fallocate64() function is not
exported. This a problem, since _FILE_OFFSET_BITS is set to 64 and
fallocate() is redirected to fallocate64().
Sadly, AC_CHECK_FUNC() doesn't catch such problem, since it's overriding
the function prototype.
See this for references:
http://sources.redhat.com/ml/libc-hacker/2009-05/msg00003.html
Karel Zak [Wed, 31 Mar 2010 14:38:51 +0000 (16:38 +0200)]
partx: fix infinite loop
On Wed, Mar 24, 2010 at 04:39:35PM -0400, Phillip Susi wrote:
> I noticed that running partx -d /dev/sda hangs so I looked into it
> and it seems that it keeps trying to delete partitions forever.
Reported-By: Phillip Susi <psusi@cfl.rr.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Phillip Susi [Wed, 31 Mar 2010 13:52:08 +0000 (15:52 +0200)]
partx: do not add nonexistent partitions
This simple patch fixes partx -a to not add nonexistent zero length
partitions for unused primary partition slots to to the kernel. This
makes partx conform to the usual kernel behavior.
Signed-off-by: Phillip Susi <psusi@cfl.rr.com> Signed-off-by: Karel Zak <kzak@redhat.com>
hwclock: add --predict for predicting RTC reading at a given time
Implement new option --predict that predicts what the RTC will read
at a time given by the --date option. This is useful for example if
you need to setup an RTC wakeup time to distant future and want to
account for the RTC drift.
Signed-off-by: Timo Juhani Lindfors <timo.lindfors@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 19 Mar 2010 14:56:27 +0000 (15:56 +0100)]
fdisk: fix -b <sectorsize>
The old fdisk (<2.17) does not differentiate between logical and
physical sector size, it uses the <sectorsize> for everything.
Now, we have logical and physical sectors size, but the -b option
changes the logical size only. The second bug is that "fdisk -b <sz>"
does not read topology information (it means that all I/O limits and
physical sector size are 512 (default).
The backwardly compatible bug fix is to override both sizes, logical
and physical if "-b" is used.
In future we can add a special option for physical size only.
Karel Zak [Wed, 17 Mar 2010 13:49:14 +0000 (14:49 +0100)]
libblkid: add microsecond resolution for cache entries
The libblkid library uses stat.st_mtine to detect changes on the
device. The last update time of of the device in the cache is stored
as TIME= tag in the /etc/blkid.tab file.
Linux since 2.5.48 supports nanosecond resolution and more precise
time is available in the stat.st_mtim timespec struct.
This patch add microsecond precision to TIME= tag in the cache file,
old format:
TIME="<sec>"
the new format:
TIME="<sec>.<usec>"
This change is backwardly compatible.
Now, the blkid_verify() function checks stat.st_mtime and
stat.st_mtim.tv_nsec/1000.
Karel Zak [Mon, 15 Mar 2010 16:10:35 +0000 (17:10 +0100)]
mount: automatically detect and loop-mount regular files
This patch allows to automatically create a loop device from a regular
file if a filesystem type is not specified, for example:
mount /path/disk.img /mnt
If the filesystem type is specified than "-o loop" is required.
Note that there is not a restriction (on kernel side) that prevents
regular file as a mount(2) source argument. A filesystem that is able
to mount regular files could be implemented.
Based on a patch from Adam Jackson <ajax@redhat.com>.
Karel Zak [Mon, 15 Mar 2010 12:46:43 +0000 (13:46 +0100)]
mount: report ambivalent FS detection, improve brute force detection
The ambivalent probing result should be properly reported and user
should be informed that the problem is possible to bypass by "-t
<type>" or resolved by wipefs(8).
The mount(8) command uses a brute force stage (calls mount(2) for all
/{proc,etc}/fylesystems) if there is not any other way how to detect
the filesystem type. The brute force stage should not be restricted by
libblkid. It's possible that libblkid is not able to detect slightly
corrupted filesystem, but kernel is able to mount such filesystem.
Note that the brute force stage should not be used if libblkid returns
ambivalent probing result. In this case user's intervention is required
(e.g. mount -t <type>).
Reported-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
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>
Andreas Dilger [Thu, 11 Mar 2010 14:16:46 +0000 (15:16 +0100)]
libblkid: improve ZFS detection and add LABEL and UUID extraction
Improve ZFS uberblock detection to loop over multiple uberblocks,
and detect at least 4 magic values, to avoid random collisions.
It doesn't yet probe the VDEV LABEL at the end of the device, though
it wouldn't be too hard to add it at this point if needed.
Add extraction of the pool name (as LABEL), the VDEV (block device)
guid as UUID_SUB, and pool_guid (volume) as UUID from the nvlist in
the VDEV LABEL. Do simple sanity checking on the nvlist data values
to avoid overflowing the buffer if they are corrupt in any way.
[kzak@redhat.com: - use %PRIu64 instead %llu]
Signed-off-by: Andreas Dilger <adilger@sun.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Miklos Szeredi [Mon, 8 Mar 2010 18:01:13 +0000 (19:01 +0100)]
umount: add --fake option to umount(8)
Add --fake option to umount(8), which omits calling the actual umount
syscall (and the loop device deletion) but modifies /etc/mtab. This
is similar to the -f or --fake option to mount(8).
This would allow some simplifications in fuse by allowing it to call
the umount syscall and letting umount(8) just update mtab.
[kzak@redhat.com: - initialize 'res' variable in umount_one() ]
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> 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, 3 Mar 2010 12:12:02 +0000 (13:12 +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...
TODO: maybe we can export an extra boolean value 'misaligned' rather
then complete hide this problem. We will see...
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>
Tilman Schmidt [Mon, 1 Mar 2010 09:45:47 +0000 (10:45 +0100)]
ldattach: add --iflag command line option
Add a command line option '-i' / '--iflag' for setting or clearing
input flags on the serial device before attaching the line discipline.
[kzak@redhat.com: - use generic functions for work with iflags table
- add list of iflags to usage/help output
- move iflags parsing to separate function]
Karel Zak [Fri, 19 Feb 2010 13:54:25 +0000 (14:54 +0100)]
libblkid: improve Sun VTOC
It seems that for example GNU Parted is able to generate Sun VTOC with
empty sanity, version and nparts fields. But there is still useful
info about partition flags in such VTOC.
This change makes libblkid Sun PT parser compatible with Sun PT
parser in Linux kernel.
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>