]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
tune2fs: don't recover journal if device is busy.
authorNeilBrown <neilb@suse.com>
Sat, 24 Feb 2018 19:56:06 +0000 (14:56 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 24 Feb 2018 20:01:59 +0000 (15:01 -0500)
commitee8b61e9b0acf23759f83fb255f720cdfbd8f233
tree9d3fd5e0fe138339f25e24a6ac1749b8f61def57
parentcb6d45fb1cd00199d0c7ca6ffe3eee8f7f74fa20
tune2fs: don't recover journal if device is busy.

tune2fs currently replays the journal if it needs
recovery and the filesystem isn't mounted.

The test for "is the filesystem mounted" isn't completely robust.
Lustre makes use of ext4 filesystems in a way that they are mounted
without being visible in /proc/mounts or similar.
This usage can easily be detected by attempting to open the device
with O_EXCL.  tune2fs already does this and the EXT2_MF_BUSY flag
is set if open(O_EXCL) fails.
Several uses other than lustre mounts could cause O_EXCL to fail,
but in any case it seems unwise to recover the journal when something
else is keeping the device busy.

So add an extra test to avoid journal recovery when the device
is busy.  This fixes some problems with lustre usage.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
misc/tune2fs.c