All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: Lukas Czerner <lczerner@redhat.com>
Cc: linux-ext4@vger.kernel.org, Zdenek Kabelac <zkabelac@redhat.com>,
	Karel Zak <kzak@redhat.com>,
	Carlos Maiolino <cmaiolino@redhat.com>
Subject: Re: [PATCH v2] libext2fs/ismounted.c: check open(O_EXCL) before mntent file
Date: Sat, 7 Mar 2020 13:11:13 -0500	[thread overview]
Message-ID: <20200307181113.GC99899@mit.edu> (raw)
In-Reply-To: <20200303135348.20827-1-lczerner@redhat.com>

On Tue, Mar 03, 2020 at 02:53:48PM +0100, Lukas Czerner wrote:
> Currently the ext2fs_check_mount_point() will use the open(O_EXCL) check
> on linux after all the other checks are done. However it is not
> necessary to check mntent if open(O_EXCL) succeeds because it means that
> the device is not mounted.
> 
> Moreover the commit ea4d53b7 introduced a regression where a following
> set of commands fails:
> 
> vgcreate mygroup /dev/sda
> lvcreate -L 1G -n lvol0 mygroup
> mkfs.ext4 /dev/mygroup/lvol0
> mount /dev/mygroup/lvol0 /mnt
> lvrename /dev/mygroup/lvol0 /dev/mygroup/lvol1
> lvcreate -L 1G -n lvol0 mygroup
> mkfs.ext4 /dev/mygroup/lvol0   <<<--- This fails
> 
> It fails because it thinks that /dev/mygroup/lvol0 is mounted because
> the device name in /proc/mounts is not updated following the lvrename.
> 
> Move the open(O_EXCL) check before the mntent check and return
> immediatelly if the device is not busy.
> 
> Fixes: ea4d53b7 ("libext2fs/ismounted.c: check device id in advance to skip false device names")
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
> Reported-by: Karel Zak <kzak@redhat.com>
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

Applied, thanks.

						- Ted

      reply	other threads:[~2020-03-07 18:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 14:34 [PATCH] libext2fs/ismounted.c: check open(O_EXCL) before mntent file Lukas Czerner
2020-03-02 14:30 ` Carlos Maiolino
2020-03-03 13:53 ` [PATCH v2] " Lukas Czerner
2020-03-07 18:11   ` Theodore Y. Ts'o [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200307181113.GC99899@mit.edu \
    --to=tytso@mit.edu \
    --cc=cmaiolino@redhat.com \
    --cc=kzak@redhat.com \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=zkabelac@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.