The current code does not work as expected if there is an option
behind the discard=<arg>, for example:
swapon /dev/sdc -o discard=once,pri=10
ignores "once" the result is SWAP_FLAG_DISCARD; strace:
Old version:
swapon("/dev/sdc", SWAP_FLAG_PREFER|SWAP_FLAG_DISCARD|10) = 0
Fixed version:
swapon("/dev/sdc", SWAP_FLAG_PREFER|SWAP_FLAG_DISCARD|SWAP_FLAG_DISCARD_ONCE|10) = 0
Signed-off-by: Karel Zak <kzak@redhat.com>
The man page is talking about read-only bind mounts (-o
remount,bind,ro), but this feature also works for another VFS flags
like nodev, suid, etc. For example:
mount -o remount,bind,noatime /mountpoint
is a valid command.
Addresses: https://github.com/karelzak/util-linux/issues/342
Signed-off-by: Karel Zak <kzak@redhat.com>
* clean up function names
* add functions to temporary redirect to the pager and then restore
original terminal output
Signed-off-by: Karel Zak <kzak@redhat.com>
.. and add notes about differences between the utuils.
Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
Kernel needs some time to delete a device after losetup --detach. If
the losetup --find --nooverlay is called just after losetup --delete,
it can sometimes attempt to recycle the device that is just being
released. To prevent this race, clear the AUTOCLEAR flag of the
device.
[kzak@redhat.com: - rebase to the new version of the code]
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch introduces overlap detections and loop devices
re-use for losetup(8). We already support this feature for mount(8)
where it's enabled by default (because we mount filesystems and it's
always mistake to share the same filesystem between more loop
devices).
Stanislav has suggested to enable this feature also for losetup by
default. I'm not sure about it, IMHO it's better to keep losetup(8)
simple and stupid by default, and inform users about possible problems
and solutions in the man page.
The feature forces losetup to scan all loop devices always when new
one is requested. This maybe disadvantage (especially when we use
control-loop to avoid /sys or /dev scans) on system with huge number
of loop devices.
Co-Author: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'misc' of https://github.com/kerolasa/lelux-utiliteetit:
pg: stop building the command by default
kill: remove pid command-name to option alias
misc: always check setenv(3) return value
For example user namespace is optional it does not make sense to
ignore process completely if the ns/user file is missing.
Reported-by: Michał Bartoszkiewicz <mbartoszkiewicz@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
lscpu calculates the number of threads per core by dividing the number
of online cpus with the number of cores. This may or may not give the
correct number of threads per core depending on the number of online
CPUs (and which CPUs are online).
At least on s390 there is a new "max thread id" field within
/proc/cpuinfo present which reliably allows us to tell the number of
threads per core. Let's use this instead, like we already have also
special treatment to figure out the number core per socket etc. on
s390.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Always use the word "can" instead of "may" to be consistent with the
descriptions of the other columns.
Also print "lspcu" always with bold characters like everywhere else in
the man page.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
lscpu can skip all CPUs which are possible but not present. For
configurations where a lot of CPUs are possible but only few CPUs are
present this saves a lot of pointless glibc/system calls.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
With the --physical option lscpu will use the IDs that are reported by
the kernel (e.g. core id for the CORE column) instead of calculating
them on it's own.
This has the advantage that it is possible to tell on which physical
hardware CPUs a Linux instance runs. The logical IDs that lscpu
generates on it own are based on comparing of CPU masks and may or may
not be identical with the physical IDs.
If the kernel was unable to retrieve an ID for a topology element then
the corresponding sysfs file will normally contain "-1". In the
extended and parsable output a dash "-" will be displayed for such
cases.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Fully safe checks of loop device need to check sizelimit. To prevent need of two
nearly equal functions, introduce sizelimit parameter to several internal
functions:
loopdev_is_used()
loopdev_find_by_backing_file()
loopcxt_is_used()
loopcxt_find_by_backing_file()
If sizelimit is zero, fall back to the old behavior (ignoring of sizelimit).
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Use warnx(), as there is no strerror() text associated with it.
There is currently no easy way to report name and type of conflict.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
The if statement in line 162 already ensures value of cfd to be 0 or
greater, so the later if is not needed.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Improve the grammar and phrasing of the --verbose option and how it
interacts with the --step option.
Signed-off-by: Allon Mureinik <amureini@redhat.com>
The indentation for the MMHZ column within the man page is wrong. Also
there doesn't exist any column with the name MMHZ. The correct names
would be MAXMHZ and MINMHZ.
Therefore rename MMHZ to MAXMHZ and add the missong MINMHZ entry.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
The Linux kernel exposes the cache topology via sysfs. However on
virtualized machines like s390 the cache topology contains only cpu
private caches.
For shared caches it is not known which cpus share them. The
hypervisor would have to update this information whenever a virtual
cpu would be scheduled on a different physical cpu and make the guest
aware of that change. Given that there is hardly any benefit, if it
all, this isn't done.
However it is still of interest to know about the non-private
caches. Therefore this information is available via /proc/cpuinfo at
least on s390.
This patch adds additional lines to the summary output for all shared
caches for which information can be found in /proc/cpuinfo, since we
know these aren't exposed via sysfs.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Show also the machine type within the lscpu output. With the machine
type it is possible to identify the cpu generation and the supported
features.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
s390 machines provide static and dynamic cpu mhz information via
/proc/cpuinfo. The static cpu mhz is the normal cpu frequency a cpu is
supposed to run with.
The dynamic cpu mhz is the actual frequency a cpu is running
with. This is usually the same as the static cpu mhz. Note that this
values are different to the min/max mhz values available on other
architecutes. The min/max values are unknown.
This patch adds two new fields to the summary output which display
these two values.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
The new drawer support did have a type in the summary output:
it reported Drawers(s) instead of Drawer(s). Fix this.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
The s390 architecture gained another cpu topology level called
"drawer" which is above the book level.
Add support for this to lscpu.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>