The vfs_options handling isn't mapping the options properly for
libmount and the previous change I did for MS_RELATIME simply
doesn't work either.
So add an options mapping table to deal withi this.
Signed-off-by: Ian Kent <raven@themaw.net>
When USE_LIBMOUNT_SUPPORT_FSINFO is set function mnt_has_fsinfo() doesn't
set have_fsinfo to other than -1 so the fsinfo() system call is made
on every invocation and -1 is always returned.
Signed-off-by: Ian Kent <raven@themaw.net>
We need to differentiate between ID (of the node) which triggered
the event and child which is affected by the change.
Signed-off-by: Karel Zak <kzak@redhat.com>
This is very simple interface to hide linux/watch_queue.h details when
we use data from notification read(). The interface is independent on
libmnt_monitor.
Signed-off-by: Karel Zak <kzak@redhat.com>
This monitor uses watch_mount() kernel API to get details about
modified VFS nodes. The patch implements only very basic
functionality. In the next commits we need to support watch_sb() and
connect all with libmount fsinfo stuff to hid all details.
Signed-off-by: Karel Zak <kzak@redhat.com>
The directory /run/mount watch generates more vents, call
inotify_rm_watch() only first time for the directory watch.
Signed-off-by: Karel Zak <kzak@redhat.com>
Don't keep the buffer as local variable for read() operation, but keep
it in memory for later use. We will use it for mount-watch-queue
later.
Signed-off-by: Karel Zak <kzak@redhat.com>
- don't use mnt_fs_get_root() (mnt_fs_get_id() is cheaper)
- don't use in DBG() stuff which triggers fsinfo()
Signed-off-by: Karel Zak <kzak@redhat.com>
The new public API function to read complete mount table by fsinfo().
For tests use:
$ make test_mount_tab
$ ./test_mount_tab --fsinfo
[kzak@redhat.com: - add commit message, cleanup function names, etc.]
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
* add mnt_has_fsinfo()
* cleanup stuff around fs->fsinfo_enabled
* probe for fsinfo() in umount in effective way
Signed-off-by: Karel Zak <kzak@redhat.com>
* add USE_LIBMOUNT_SUPPORT_FSINFO to build-system with dependence on linux/fsinfo.h
* use #ifdefs to enable fsinfo code only if possible
* add "fsinfo" to mount --version output
* for non-distro kernel headers use:
CFLAGS="-I /usr/src/$(uname -r)/usr/include" ./configure
and see ./configure script output and config.h for more details.
Signed-off-by: Karel Zak <kzak@redhat.com>
Using open(2) will trigger autofs direct and offset mounts so it
shouldn't be used in mnt_fs_fetch_fsinfo().
The mount id is a better choice here.
Signed-off-by: Ian Kent <raven@themaw.net>
The fsinfo_buf2fs() bufsz parameter isn't used and generates a compile
warning.
But the following len parameter has already been checked to enusre it's
smaller that the buf size so remove the unused parameter.
Signed-off-by: Ian Kent <raven@themaw.net>
The mount attribute MOUNT_ATTR_RELATIME is defined as 0 in the fsinfo()
header files.
The vfs option relatime is included in the vfs options proc string only
if noatime and strictatime are not set so this option gets ommitted when
using fsinfo().
This maybe should be fixed in mnt_optstr_apply_flags() but it's a special
case that may cause side effects for non fsinfo() use. Or perhaps fsinfo()
should set the flag to its MS_* counterpart similar to the other MOUNT_ATTR_*
flags, not sure?
In any case I needed this set so added this hack.
Signed-off-by: Ian Kent <raven@themaw.net>
After a make in the kernel source tree all that's needed to build against
a kernel with fsinfo() is:
CFLAGS="-I <kernel source base>/usr/include"
Also, using the above include path will define __NR_fsinfo so checking
if it's defined and seting it to -1 is enough to handle kernels without
fsinfo().
And move the include directives to the top of fs.c.
Signed-off-by: Ian Kent <raven@themaw.net>
This patch allows to replace mountinfo parsing by fsinfo() call, it
means we do not have to parse all irrelevant content in mountinfo, but
get information about desired mountpoint.
Use (for example):
CFLAGS=-I/usr/src/kernels/5.6.0-0.rc6.git0.1.fsinfo.fc33.x86_64/include/uapi/ \
-I/usr/src/kernels/5.6.0-0.rc6.git0.1.fsinfo.fc33.x86_64/include \
./configure
to point to your experimental kernel headers.
Signed-off-by: Karel Zak <kzak@redhat.com>
The function mnt_context_utab_writable() initializes paths in the
context and then we can use it on many places.
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's generate the flag when parse mountinfo rather than later in
mnt_fs_get_propagation(). It's more efficient (we parse the optimal
mountinfo field only once) and it allows to set propagation from
another source in future.
Signed-off-by: Karel Zak <kzak@redhat.com>
[kzak@redhat.com: - generate patch from Damien's v3
- make commands[] initialization more robust]
Signed-off-by: Aravind Ramesh <Aravind.Ramesh@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Introduce blkzone open, close and finish commands, issuing BLKOPENZONE,
BLKCLOSEZONE and BLKFINISHZONE ioctl commands to open, close or finish
a range of zones of a zoned block device.
Since these three commands are similar to the existing zone reset
command, the existing zone reset command implementation is changed into
the generic blkzone_action() internal handler function for processing
all zone actions.
The BLKOPENZONE, BLKCLOSEZONE and BLKFINISHZONE ioctl commands codes are
defined in linux/blkzoned.h starting with kernel version 5.5. To ensure
that the blkzone utility compiles even with older blkzoned.h kernel
header versions, these ioctl commands are internally defined if the
blkzoned.h header definition is not present. Execution of these commands
on kernels older than 5.5 will result in a -ENOTTY error (missing
ioctl).
Signed-off-by: Aravind Ramesh <Aravind.Ramesh@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Hans Holmberg <Hans.Holmberg@wdc.com>
Reviewed-by: Hans Holmberg <Hans.Holmberg@wdc.com>
* use fdisk --noauto-pt to avoid re-creation of the default architecture specific PT
* use more verbose "Created a new" messages in the output
Signed-off-by: Karel Zak <kzak@redhat.com>