zhenwei pi [Thu, 16 Sep 2021 03:29:01 +0000 (11:29 +0800)]
blkpr: add block persistent reservations command
Linux kernel block layer supports PR (persistent reservations) ioctl
on a block device. Typically SCSI and NVMe disk support PR feature,
and blkpr could operation on them.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
lsns unconditionally uses NS_GET_NSTYPE since version 2.38 and
https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=de72df79d72fa906e71e2ac922d8745ff22deee5
which is only available since kernel 4.11 and
https://github.com/torvalds/linux/commit/e5ff5ce6e20ee22511398bb31fb912466cf82a36
resulting in the following build failure:
sys-utils/lsns.c: In function 'add_namespace_for_nsfd':
sys-utils/lsns.c:719:25: error: 'NS_GET_NSTYPE' undeclared (first use in this function)
719 | clone_type = ioctl(fd, NS_GET_NSTYPE);
| ^~~~~~~~~~~~~
So add an option to allow the user to disable lsns
Karel Zak [Mon, 4 Apr 2022 13:59:36 +0000 (15:59 +0200)]
tests: make libmount tests more portable
git tree on macbook:
...
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:
It seems better to use original solution and depend on HAVE_DIRFD
and HAVE_OPENAT, because libblkid and another tools are compiled
on non-Linux targets too.
The test cases assumed the file descriptor #3 was not occupied. As
reported in #1637, the assumption was wrong. This new code assigns
the file descriptor #3 explicitly with dup2 as the other test cases
did.
zhenwei pi [Tue, 29 Mar 2022 08:59:51 +0000 (16:59 +0800)]
irqtop: support -C/--cpu-list
Specify cpus list format to show by -C/--cpu-list parameters, for
example, on an AMD server with 192 CPUs, to show statistics on NUMA
node 1:
~# ./irqtop -d 1 -C 48-95,144-191
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Earl Chew [Tue, 8 Mar 2022 04:41:24 +0000 (20:41 -0800)]
unshare: Fix PDEATHSIG race for --kill-child with --pid
Exit the child explicitly should the parent terminate
just before the child invokes prctl(PR_SET_PDEATHSIG).
Note that if the child is created as pid 1 in a
new pid namespace, getppid(2) will return 0 because
the parent resides in a different namespace, and
SIGKILL will only be delivered if sent from the
ancestor namespace.
Instead of checking the pid of the parent, use a pidfd
instance to detect the termination of the parent.
The issue can be reproduced using the following script
which must be run as root to permite the --pid option.
The script will sometimes print 0..9 despite the parent
being killed:
while : ; do
cat /proc/uptime
sh -c '
unshare --kill-child --pid --fork bash -c "
for X in {0..9} ; do echo \$X || break ; sleep 1 ; done" &
sleep 0 # sleep 0.00$RANDOM
kill -9 $! 2>/dev/null' |
cat
done
Karel Zak [Mon, 21 Mar 2022 12:19:38 +0000 (13:19 +0100)]
agetty: add support for LOGIN_PLAIN_PROMPT
login(1) and agetty(8) are usually used together to log-in user. The
initial login prompt is printed by agetty. login(1) can suppress
hostname in the prompt by LOGIN_PLAIN_PROMPT=no (/etc/login.defs), but
for agetty it's necessary to use --nohostname. It's pretty unfriendly
for system admins. Let's share the same setting between all tools.
Stanislav Brabec [Fri, 25 Mar 2022 08:26:48 +0000 (09:26 +0100)]
flock: Decribe limitations of flock: deadlock, NFS, CIFS
The flock(1) does not refer to limitations of flock(2). Provide an
documentation entry point for solving of problems with flock on NFS
and CIFS and mention risk of deadlock.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
Andreas Hindborg [Wed, 16 Mar 2022 08:39:05 +0000 (09:39 +0100)]
blkzone: Do not print zone capacity if not supported
If `blkzone` is built against kernel headers that do not define
`BLK_ZONE_REP_CAPACITY`, `blkzone report` will use zone size when printing zone
capacity. This patch changes the behavior of `blockzone report` in this case to
omit the capacity field instead of using the potentially wrong value.
Signed-off-by: Andreas Hindborg <andreas.hindborg@wdc.com>
Michael Trapp [Thu, 10 Mar 2022 12:18:52 +0000 (13:18 +0100)]
libuuid: extend cache in uuid_generate_time_generic()
Improve throughput and reduce clock sequence increments
for high load situation with time based version 1 uuids.
In a high load scenario, where an application continiously reads time
based version 1 uuids from uuidd, we have noticed the following
behaviour.
The application reads more uuids as there are available in the
corresponding timeframe and each bulk request results in an increment of
the clock sequence because of the 'step back' in time. Due to the
14bit size of the clock sequence this also results in overflows of
the clock sequence.
As uuidd calls
uuid_generate_time_safe()
uuid_generate_time_generic()
the default value for the bulk request in the '#ifdef HAVE_TLS' section
of uuid_generate_time_generic() is set to 1000.
Extending the 'cache' of uuid_generate_time_generic() by increasing
the default of num to 1000000 doesn't solve the issue, but reduces
the clock sequence increments by factor 1000 and it also improves
the uuid throughput in our setup by factor 3-4.
It might be possible to implement a cache for
UUIDD_OP_BULK_TIME_UUID
UUIDD_OP_TIME_UUID
in the uuidd request handling, but it would not be as simple as this fix
in uuid_generate_time_generic().