1. Sep 20, 2017
  2. Jul 20, 2017
  3. Jul 18, 2017
    • Ivan Delalande's avatar
      libmount: make mnt_context_is_fs_mounted work for /proc · 4e3afcac
      Ivan Delalande authored
      
      Assume that /proc is not mounted instead of returning an error when we
      are unable to open the mounts and mountinfo files in /proc. Also set
      cxt->mtab back to NULL so that it gets properly parsed when we check if
      the next filesystem is mounted.
      
      The goal is to have mount -a work when /proc is not mounted, typically
      with /proc on the first line of fstab.
      
      Signed-off-by: default avatarIvan Delalande <colona@arista.com>
      4e3afcac
  4. Jul 17, 2017
  5. Jul 14, 2017
  6. Jun 23, 2017
    • Ivan Delalande's avatar
      dmesg: print only 2 hex digits for each hex-escaped byte · 7dcd597f
      Ivan Delalande authored
      
      As buf is passed as a signed char buffer in fwrite_hex, fprintf will
      print every byte from 0x80 as a signed-extended int causing each of
      these bytes to be printed as "\xffffff80" and such, which can be pretty
      confusing. Force fprintf to use the argument as a char to make it print
      only 2 digits, e.g. "\x80".
      
      Signed-off-by: default avatarIvan Delalande <colona@arista.com>
      7dcd597f
    • Karel Zak's avatar
      wipefs: exit on failed erase · a51be745
      Karel Zak authored
      
      The current behavior is to report error and continue, it seems strange:
      
      	# blockdev --setro /dev/sdc
      
      	# wipefs -a /dev/sdc
      	wipefs: /dev/sdc: failed to erase xfs magic string at offset 0x00000000: Operation not permitted
      	/dev/sdc: 4 bytes were erased at offset 0x00000000 (xfs): 58 46 53 42
                                ^^^^^^^^^^^
                                 not true
      
      The patch calls err() to exit.
      
      Reported-by: default avatarVratislav Podzimek <vpodzime@redhat.com>
      Signed-off-by: default avatarKarel Zak <kzak@redhat.com>
      a51be745
    • Karel Zak's avatar
      84fdc19b
    • Karel Zak's avatar
    • Alex Ivanov's avatar
      fstrim: prefer earlier mounted filesystems · cf9a3db0
      Alex Ivanov authored
      fstrim --all is broken in a way that if there is a bind mount for some filesystem,
      that filesystem will not be trimmed. This is especially critical for e.g.
      NixOS distribution, which needs bind mount within root fs:
      https://github.com/NixOS/nixos/blob/master/modules/system/boot/stage-2-init.sh#L55
      
      Currently for a given filesystem during "de-duplication by source and root" phase,
      an early mounted fs path is filtered (e.g. "/"), while later mounted fs path is kept
      (e.g. "/nix/store") though anyway discarded later (since it's an overlaying mount).
      This leads to skipped trimming.
      
      So flip this behaviour. Should also help for other types of overlaying mounts.
      
      Reference:
      https://github.com/karelzak/util-linux/blob/stable/v2.29/libmount/src/tab.c#L715
      
      
      
      Signed-off-by: default avatarAlex Ivanov <yourbestfriend@openmailbox.org>
      cf9a3db0
    • Pali Rohár's avatar
      tests: Add UDF hdd images with blocksize 1024 and 4096 created by Linux mkudffs 1.3 · 122e060d
      Pali Rohár authored
      $ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-4.img bs=1M count=10
      $ mkudffs -l Label -b 1024 udf-hdd-mkudffs-1.3-4.img
      
      $ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-5.img bs=1M count=10
      $ mkudffs -l Label -b 4096 udf-hdd-mkudffs-1.3-5.img
      122e060d
    • Pali Rohár's avatar
      libblkid: udf: Fix detection of UDF images with block size 1024 and 4096 · 83b8df64
      Pali Rohár authored
      When detecting block size of UDF filesystem, try to use also block size
      512, 1024, 2048 and 4096. This would allow blkid to detect UDF filesystem
      in image file created from 4K hard disk (which should have UDF block size
      4096).
      
      Before this patch only UDF images with block size of 512 and 2048 were
      detected as only block size from blkid_probe_get_sectorsize() and 2048 were
      used (blkid_probe_get_sectorsize() returns for disk images 512).
      83b8df64
    • Ruediger Meier's avatar
      tests: fix fincore, don't use variable COLUMNS · 24fb943e
      Ruediger Meier authored
      
      COLUMNS is automatically set by bash and may result in stupid
      errors like
      
        fincore: unknown column: 160
      
      Signed-off-by: default avatarRuediger Meier <ruediger.meier@ga-group.nl>
      24fb943e
    • Karel Zak's avatar
      lscpu: cleanup DMI detection return codes · 38be54d2
      Karel Zak authored
      
      Michal wrote:
       There is weird mix of logic in lscpu-dmi.c which sometimes returns 0 and
       sometimes -1 on error. Since most checks are if (rc) goto done; this
       bails out early on error skipping some detection methods. Further, in
       lscpu.c all following detections are guarder by if(hyper) so returning
       -1 causes all following methods to be skipped.
      
      Reported-by: default avatarMichal Suchanek <msuchanek@suse.de>
      Signed-off-by: default avatarKarel Zak <kzak@redhat.com>
      38be54d2
    • Zac Medico's avatar
      pylibmount: NULL terminate kwlist in Context_init · b49c756b
      Zac Medico authored
      Fixes a segfault observed with python3.6.
      b49c756b
    • Karel Zak's avatar
      umount: add note about NFS and -c to umount.8 · 73123f62
      Karel Zak authored
      
      Signed-off-by: default avatarKarel Zak <kzak@redhat.com>
      73123f62
    • NeilBrown's avatar
      umount: never 'stat' the path when "-c" is given. · 67cd71ca
      NeilBrown authored
      
      It is currently not possible to reliably and automatically
      unmount an NFS filesystem. If the server is not available, the
      umount command will hang.
      
      The hang can be avoided by using "-l" or "-f", but neither
      of these are appropriate for automatic use such as by an
      automounter (e.g automountd or systemd).
      
      "-l" will unmount even if the filesystem is in use, which
      an automounter generally doesn't want.  If the filesystem
      is in use, then the umount should fail.
      
      "-f" can cause the filesystem to abort pending transactions
      which might break filesystem semantics.  This can be useful
      in the hands of a sysadmin, but not when used by an
      automatic tool.
      
      umount has another option, "-c" aka "--no-canonicalize"
      which avoids some "stat" calls.
      Currently this doesn't avoid all calls to
      canonicalize_path()
      as
        mnt_context_prepare_umount() ->
          lookup_umount_fs() ->
            mnt_context_find_umount_fs() ->
              mnt_context_get_mtab_for_target() ->
      	  mnt_resolve_path() ->
      	    canonicalize_path_and_cache() ->
      	      canonicalize_path()
      
      leads to that function being called.
      
      The "-c" option could be taken to mean "I know what I'm
      doing, this really is the path to a mount point, I just want
      you to unmount it".  Given that, it seems suitable to
      extend this to avoid all 'stat' calls on the mountpoint.
      
      It is already appropriate for any automount program to pass
      "-c" to "umount", so they can be changed to do so at any
      time.
      With the patch below, "-c" will result in the mountpoint
      never being "stat"ed, so umount won't hang on an
      inaccessible server.
      
      This isn't quite sufficient, for NFS at least, as the usage
      of libmount in umount.nfs still calls 'stat' on the mount
      point.
      "-c" isn't passed to the umount helper, but it is reasonable
      for such helpers to assume "-c" because "umount" will have
      canonicalized the path when that is appropriate.
      
      So, this patch treats "-c" much like "-l" and "-f" when
      deciding whether it is safe to 'stat' the path.
      
      Signed-off-by: default avatarNeilBrown <neilb@suse.com>
      67cd71ca
    • Jakub Wilk's avatar
      fdformat: clear progress message before printing "done" · 87641d4c
      Jakub Wilk authored
      
      Before:
      
          Formatting ... done1
      
      After:
      
          Formatting ... done
      
      Signed-off-by: default avatarJakub Wilk <jwilk@jwilk.net>
      87641d4c
    • Karel Zak's avatar
      agetty: fix login name DEL/CTRL^U issue · c32cd3f1
      Karel Zak authored
      agetty refresh prompt (/etc/issue file etc.) when requested by inotify
      or netlink. For this purpose we monitor some file descriptors by
      select().
      
      The terminal input file descriptor is switched to non-canonical mode before
      select(). The goal is to be informed about user activity before
      new-line. The FD is immediately switched back to canonical mode when
      activity is detected. The side effect is that all not-read-yet chars in
      the input buffer are lost ... so we need to call read() before switch
      to canonical mode to save the chars.
      
      The original implementation has been based on TIOCSTI ioctl. It
      returns already read chars back to the terminal input buffer to make
      them useful for canonical mode. The problem was race (agetty writes to
      input buffer in the same time as user) and result was reordered chars
      in login name... so useless.
      
      This issue has been later fixed by extra buffer (commit
      790119b8) for already read data.  And
      TIOCSTI ioctl has been removed. Unfortunately this solution is also
      wrong, because the buffer is maintained only by agetty and
      inaccessible for terminal when user edit (by DEL/CTRL^U) login name in
      canonical mode.
      
      The solution is simple -- just don't try to be smart and keep terminal
      in canonical mode all time (so terminal controls DEL, CTRL^U, etc) and
      flush input buffer (=discard unread data) and ask user for login name
      again after prompt reload.
      
      The agetty reload is very rarely situation and for user it's pretty
      obvious that he has to type login name again (as all terminal has been
      clear+redraw).
      
      Addresses: https://github.com/karelzak/util-linux/issues/454
      Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1464148
      
      
      Signed-off-by: default avatarKarel Zak <kzak@redhat.com>
      c32cd3f1
  7. Jun 22, 2017
  8. Jun 02, 2017