Petr Uzel [Fri, 21 May 2010 12:18:31 +0000 (14:18 +0200)]
umount: do not sync() as the kernel does it by itself
On Fri, May 21, 2010 at 08:00:09AM -0400, Christoph Hellwig wrote:
> On Fri, May 21, 2010 at 01:55:17PM +0200, Petr Uzel wrote:
> > SUSE-based distributions have the following patch for some time. More
> > info here: https://bugzilla.novell.com/show_bug.cgi?id=447036
> >
> > From the Novell bugzilla:
> > <quote>
> > > I cannot see any justification for that sync call at all so I'd
> > > probably just remove it. Your
> > > patch is possibly safer so maybe it should be used as is.
> > </quote>
> >
> > So, does anybody know why/if the sync() is actually needed?
>
> It's not needed. The kernel performs a sync by itself.
Karel Zak [Tue, 18 May 2010 10:13:48 +0000 (12:13 +0200)]
libblkid: improve MD 0.90 detection
We don't have to check for collision between partition table and RAID
on all RAIDs. This problem is specific to MD, where underlying device
could be a partition. The RAIDs like via, intel, ... always use
whole-disks only.
Karel Zak [Fri, 14 May 2010 10:02:57 +0000 (12:02 +0200)]
blkid: add 'export' output format
This output format is similar to 'udev' but without udev specific
prefixed (e.g. ID_FS_*). The 'export' format is automatically enabled
for I/O Limits (-i).
Karel Zak [Fri, 7 May 2010 12:12:26 +0000 (14:12 +0200)]
cfdisk: support non-ascii characters in input
On Sat, Apr 03, 2010 at 12:58:48PM +0000, Jorge wrote:
> When you want to write changes to disk you're asked for a
> confirmation, like this one:
>
> Are you sure you want to write the partition table to disk? (yes
> or no)
>
> There is no problem on the English version, but when you launch the
> program in Spanish you get this:
>
> ¿Está seguro de que desea escribir la tabla de particiones en el
> disco?
> (sí o no):
>
> You can't type the "í" character. Trying to do so will end in no
> input at all. That is, typing in my keyboard "´" then "i" leads to
> nothing. So you can't write changes to disk, and you must launch the
> program in English for it to operate.
Reported-by: Jorge <yo@jorgesuarezdelis.name>
Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/205327 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 28 Apr 2010 12:40:46 +0000 (14:40 +0200)]
fdisk: improve 'move begin of partition' command
The 'b' command ("move beginning of data in a partition")
implementation is too restricted. For example:
Device Boot Start End Blocks Id System
/dev/sdb1 2048 22527 10240 83 Linux
....
Partition number (1-4): 1
New beginning of data (2048-22527, default 2048):
^^^^^^^^^^
the range is defined by the current partition size. New version:
Partition number (1-4): 1
New beginning of data (1-22527, default 2048):
^^^^^^^
allows to move the begin to arbitrary place if the place is not
allocated by any other partition. This is useful for people who don't
want to use the default partitioning (1MiB offset, 1MiB grain).
The 'b' command is expert command and does not force users to use an
aligned LBA (fdisk(8) still prints warning (in 'p' command) if any
partition is not aligned to the physical sector boundary).
Karel Zak [Tue, 27 Apr 2010 15:12:50 +0000 (17:12 +0200)]
tests: explicitly use --chunk and --metadata in MD test
The newer mdadm version uses a different chunk size and superblock
format, so the final MD device has a different I/O limits (optimal I/O
size is 1MiB for 1.20 metadata).
We have to explicitly use the same format which is expected in our tests.
Reported-by: Yulia Kopkova <ykopkova@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
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>