Matthias Koenig [Mon, 9 Jun 2008 14:38:25 +0000 (16:38 +0200)]
mount: retry on ENOMEDIUM
Due to a change in kernel behaviour when opening CDROM devices,
we need to retry the open/mount call when ENOMEDIUM is returned.
Explanation from Tejun Heo:
Okay, the difference is from the addition of cdrom_get_media_event()
call to both sr_drive_status() and ide_cdrom_drive_status().
Previously, the cdrom driver can't differentiate between tray closed
w/ no media and tray open and always returned tray open, which
triggers close and retry in the open logic which probably have delayed
things enough to get the media recognized.
Now the cdrom driver can discern between tray closed w/o media and
device not ready for other reasons and returns -ENOMEDIUM on the
former. This is all good and dandy but the problem seems that some
drives report no media right after the tray is closed but it hasn't
properly detected the media yet.
It seems the only way to work around the problem is via sensible
retries (e.g. try three times 5 secs apart) and I don't think we can
add that type of retry logic into cdrom open path. Please note that
the previous logic wasn't water proof. Some drives can take longer to
recognize the media is there and could have failed the in-kernel retry
too. Also, reading the media can take quite some time and during that
period the drive reports media present but device not ready. The
driver will retry the command (e.g. READ TOC for open) five times but
all of them can fail w/ EMEDIUMTYPE.
[kzak@redhat.com: - add CRDOM_NOMEDIUM_RETRIES to blkdev.h
- add verbose message to mount.c]
Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘klogctl’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘type’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘b’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘len’
without belows compat section dmesg just compiles fine against klibc.
as bonus reorder the includes.
Samuel Thibault [Thu, 24 Jul 2008 00:27:14 +0000 (01:27 +0100)]
ldattach: don't compile for non-linux systems
There is just ldattach which doesn't compile because line disciplines are not
implemented that way on the Hurd. Is TIOCSETD any kind of standard? Else I
guess the patch below would be fine.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
no longer use deprecated alias.
clears a useless compile error when compiling against klibc:
mount.c:995: error: `MOUNTED' undeclared (first use in this function)
Karel Zak [Wed, 2 Jul 2008 12:26:51 +0000 (14:26 +0200)]
umount: improve "-d" option for autoclear loops
The new loop auto-destruct feature detaches automatically loop devices
when no longer used. This means they are detached with the umount()
call. But when we call umount with -d, del_loop() is called and fails
because the ioctl() returns ENXIO. We have to check for autoclear
loop devices rather than blindly call del_loop().
Reported-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 23 Jun 2008 11:00:00 +0000 (13:00 +0200)]
mount: warn on "file_t" selinux context
Currently if I mount a file system without labels, it works fine, but
later or SELinux will start printing denials and stopping certain
applications from working. It would be nice if the mount command
checked it in selinux mode.
Addresses-Red-Hat-Bugzilla: #390691 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 17 Jun 2008 11:12:12 +0000 (13:12 +0200)]
hwclock: always reads hardware clock
It's a pity that hwclock first tries to read the clock when running
hwclock --systohc --noadjfile --utc
and exits as this fails. I cannot see a reason to read first in that
case.
Old version:
# hwclock --systohc --noadjfile --utc --debug
hwclock from util-linux-ng 2.14
Using /dev interface to clock.
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
/dev/rtc does not have interrupt functions. Waiting in loop for time
from /dev/rtc to change
...got clock tick
Time read from Hardware Clock: 2008/06/17 11:18:24
Hw clock time : 2008/06/17 11:18:24 = 1213701504 seconds since 1969
Time elapsed since reference time has been 0.904855 seconds.
Delaying further to reach the next full second.
Setting Hardware Clock to 11:18:24 = 1213701504 seconds since 1969
ioctl(RTC_SET_TIME) was successful.
New version:
# hwclock --systohc --noadjfile --utc --debug
hwclock from util-linux-ng 2.14
Using /dev interface to clock.
Assuming hardware clock is kept in UTC time.
Time elapsed since reference time has been 0.572151 seconds.
Delaying further to reach the next full second.
Setting Hardware Clock to 11:18:52 = 1213701532 seconds since 1969
ioctl(RTC_SET_TIME) was successful.
Addresses-Debian-Bug: #478663 Signed-off-by: Karel Zak <kzak@redhat.com>
This patch allows "tolerant" behavior, i.e. proceeding even if
priority could not be set. This might be of use in case something
(selinux, old kernel, etc.) does not allow the requested scheduling
priority to be set.
This could be to some extend done as follows:
ionice -c3 command || command
but the downside is that one could not really tell if what failed was
setting priority or command itself, which could result in duplicate
command run.
This patch solves the situation, so that user can do
ionice -t -c3 command
Addresses-Red-Hat-Bugzilla: #443842 Signed-off-by: Lubomir Kundrak <lkundrak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Matthias Koenig [Mon, 2 Jun 2008 14:51:57 +0000 (16:51 +0200)]
hwclock: omit warning about drift if --noadjfile given
Currently, if hwclock is given the --noadjfile option it will
nevertheless display information about the drift rate when invoked with
the --debug option.
Mike Frysinger [Sat, 7 Jun 2008 17:22:45 +0000 (13:22 -0400)]
more: dont use a.out.h
The a.out.h header is not friendly to portable systems (iow, those that
lack a.out support), and since the defines are only used in a cheesy magic,
just use the magic constants. It's not like they're ever going to change.
James Youngman [Wed, 14 May 2008 08:51:40 +0000 (09:51 +0100)]
more: minor fixes to magic()
Read the magic bytes into signed chars instead of vanilla chars in
order to ensure consistent results even on systems whose char type has
no sign. Eliminate spurious parentheses in return statements.
Correct grammatical errors in comments.
Volker Schatz [Tue, 3 Jun 2008 21:52:04 +0000 (23:52 +0200)]
ddate: 11th, 12th and 13th of month
the Discordian date utility ddate gives the 11th, 12th and 13th of the month as
the "11st", "12nd" and "13rd". Unless this is a religious thing, please apply
the patch below.
Karel Zak [Wed, 14 May 2008 14:38:47 +0000 (16:38 +0200)]
mount: remount doesn't care about loop=
The command
# mount -oremount <spec> <dir>
doesn't read fstab or mtab. This is expected behaviour. Unfortunately,
we have to care about the internal loop= option which is generated and
maintained by mount(8)/umount(8). The loop= option has to be persistent.
How to reproduce this bug:
# mount -o loop /home/images/vfat.img /mnt/img; grep vfat /etc/mtab; \
mount -o remount,ro /home/images/vfat.img /mnt/img; grep vfat /etc/mtab;
Karel Zak [Tue, 13 May 2008 12:00:39 +0000 (14:00 +0200)]
setarch: add fallback for linux/personality
setarch.c:248: error: 'ADDR_NO_RANDOMIZE' undeclared (first use in this function)
setarch.c:248: error: (Each undeclared identifier is reported only once
setarch.c:248: error: for each function it appears in.)
setarch.c:251: error: 'FDPIC_FUNCPTRS' undeclared (first use in this function)
setarch.c:257: error: 'ADDR_COMPAT_LAYOUT' undeclared (first use in this function)
setarch.c:260: error: 'READ_IMPLIES_EXEC' undeclared (first use in this function)
Linux gzp1 2.4.36.1-gzp1 #1 SMP Tue Feb 19 10:23:48 CET 2008 i686 GNU/Linux
Reported-By: Gabor Z. Papp <gzp@papp.hu> Signed-off-by: Karel Zak <kzak@redhat.com>
Steve Grubb [Sat, 19 Apr 2008 15:49:02 +0000 (11:49 -0400)]
login: audit log injection attack via login
A while back I found a couple audit log injection attacks which became
CVE-2007-3102. I forgot to look at login to see if its vulnerable and Mirek
found that it is. To verify the problem, type:
root addr=xyz.com
for the account name while logging in. It will look like root logged in with
an address of xyz.com.
mount: add support for sizelimit= mount option (for loop mounts)
[kzak@redhat.com: split the original patch to small patches] Signed-off-by: Shachar Shemesh <shachar@lingnu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
[kzak@redhat.com: split the original patch to small patches] Signed-off-by: Shachar Shemesh <shachar@debian.org> Signed-off-by: Karel Zak <kzak@redhat.com>
James Youngman [Sun, 6 Apr 2008 10:45:57 +0000 (11:45 +0100)]
fsck.minix: correct the error message given when we can't open the device
Don't actually print %s in the error message, print the device name,
as was obviously intended. Also, print the error message
corresponding to the errno value.
[kzak@redhat.com: add __attribute__, coding style cleanups] Signed-off-by: James Youngman <jay@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 2 Apr 2008 11:46:26 +0000 (13:46 +0200)]
mount: remove built-in support for background mounts
EX_BG is archaism from old integrated NFS code. The built-in NFS code
has been removed in the previous version and all "bg" stuff is handled
by /sbin/mount.nfs. It seems we can remove all "bg" stuff from
mount(8).