[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200307181113.GC99899@mit.edu>
Date: Sat, 7 Mar 2020 13:11:13 -0500
From: "Theodore Y. Ts'o" <tytso@....edu>
To: Lukas Czerner <lczerner@...hat.com>
Cc: linux-ext4@...r.kernel.org, Zdenek Kabelac <zkabelac@...hat.com>,
Karel Zak <kzak@...hat.com>,
Carlos Maiolino <cmaiolino@...hat.com>
Subject: Re: [PATCH v2] libext2fs/ismounted.c: check open(O_EXCL) before
mntent file
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@...hat.com>
> Reported-by: Zdenek Kabelac <zkabelac@...hat.com>
> Reported-by: Karel Zak <kzak@...hat.com>
> Reviewed-by: Carlos Maiolino <cmaiolino@...hat.com>
Applied, thanks.
- Ted
Powered by blists - more mailing lists