2015-07-05 21:53:12

by Theodore Ts'o

[permalink] [raw]
Subject: [GIT PULL] ext4 bug fixes for 4.2-rc2

The following changes since commit a2fd66d069d86d793e9d39d4079b96f46d13f237:

ext4: set lazytime on remount if MS_LAZYTIME is set by mount (2015-06-23 11:03:54 -0400)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git tags/ext4_for_linus_stable

for you to fetch changes up to 7444a072c387a93ebee7066e8aee776954ab0e41:

ext4: replace open coded nofail allocation in ext4_free_blocks() (2015-07-05 12:33:44 -0400)

----------------------------------------------------------------
Bug fixes (all for stable kernels) for ext4:
* address corner cases for indirect blocks->extent migration
* fix reserved block accounting invalidate_page when
page_size != block_size (i.e., ppc or 1k block size file systems)
* fix deadlocks when a memcg is under heavy memory pressure
* fix fencepost error in lazytime optimization

----------------------------------------------------------------
Eryu Guan (2):
ext4: be more strict when migrating to non-extent based file
ext4: correctly migrate a file with a hole at the beginning

Lukas Czerner (1):
ext4: fix reservation release on invalidatepage for delalloc fs

Michal Hocko (1):
ext4: replace open coded nofail allocation in ext4_free_blocks()

Nikolay Borisov (2):
bufferhead: Add _gfp version for sb_getblk()
ext4: avoid deadlocks in the writeback path by using sb_getblk_gfp

Theodore Ts'o (1):
ext4: fix fencepost error in lazytime optimization

fs/ext4/extents.c | 6 +++---
fs/ext4/inode.c | 22 ++++++++++++++++++----
fs/ext4/mballoc.c | 16 +++++-----------
fs/ext4/migrate.c | 17 ++++++++++++++---
include/linux/buffer_head.h | 7 +++++++
5 files changed, 47 insertions(+), 21 deletions(-)


2015-07-11 12:07:18

by Jörg-Volker Peetz

[permalink] [raw]
Subject: Re: [GIT PULL] ext4 bug fixes for 4.2-rc2

Theodore Ts'o wrote on 07/05/2015 23:53:
> The following changes since commit a2fd66d069d86d793e9d39d4079b96f46d13f237:
>
> ext4: set lazytime on remount if MS_LAZYTIME is set by mount (2015-06-23 11:03:54 -0400)
>
<snip>

Hi Ted,

I'm testing this patch and "ext4: set lazytime on remount if MS_LAZYTIME is set
by mount" on top of stable kernel 4.1.2.

So far no problems with lazytime enabled. Thanks for that :-)

But remounting with mount version 2.26.2 sucks. As promised, lazytime can be
enabled. But disabling it or trying to switch between atime, relatime, and
noatime doesn't work.

Starting from

# grep sda /proc/mounts
/dev/sda2 /home ext4 rw,lazytime,noatime,nobarrier,errors=remount-ro 0 0

some strace output:

# strace -o /tmp/st mount -o remount,nolazytime /home
# grep ^mount /tmp/st
mount("/dev/sda2", "/home", 0x2152780, MS_MGC_VAL|MS_REMOUNT|MS_NOATIME,
"nobarrier,errors=remount-ro") = 0

# strace -o /tmp/st mount -o remount,relatime /home
# grep ^mount /tmp/st
mount("/dev/sda2", "/home", 0x1543780, MS_REMOUNT|MS_RELATIME|MS_NOATIME,
"nobarrier,errors=remount-ro") = 0

# strace -o /tmp/st mount -o remount,atime /home
# grep ^mount /tmp/st
mount("/dev/sda2", "/home", 0x1534780, MS_MGC_VAL|MS_REMOUNT,
"nobarrier,errors=remount-ro") = 0

The contents of /proc/mounts isn't changed by all this :-(

Or should I contact the util-linux developers?

--
Regards,
J?rg.

2015-07-11 21:07:31

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [GIT PULL] ext4 bug fixes for 4.2-rc2

On Sat, Jul 11, 2015 at 02:07:10PM +0200, J?rg-Volker Peetz wrote:
>
> Hi Ted,
>
> I'm testing this patch and "ext4: set lazytime on remount if MS_LAZYTIME is set
> by mount" on top of stable kernel 4.1.2.
>
> So far no problems with lazytime enabled. Thanks for that :-)
>
> But remounting with mount version 2.26.2 sucks. As promised, lazytime can be
> enabled. But disabling it or trying to switch between atime, relatime, and
> noatime doesn't work.

I knew about the fact that you couldn't disable lazytime. The issue
is that nolazytime is getting intercepted by the 2.26.2 version of
mount, so ext4 never sees it. But if we interpret the lack of the
lazytime flag in the mount flags passed in from the system call, then
we would *always* disable the lazytime flag if the file system is
remounted using a pre-2.26.2 version of mount. Since a huge number of
Ubuntu LTS and Debian stable users (and probably a bunch of older
Fedora users as well) will be using an older version of mount, I
decided that best compromise is was to allow lazytime to be enabled
using a 2.26.2+ version of mount via remount, but not to allow
lazytime to be disabled. With a pre-2.26.2 version of mount, you'll
be able to enable or disable lazytime.

As far as switching atime modes using remount, this is working for me.
I'm testing with both a 2.25.2 version of mount as found in Debian
Jessie, as well as 2.26.2 version of mount using Debian Stretch.


The issue not being able to change the atime, relatime, and noatime
flags is a similar issue. In pre-2.26.2 versions of mount, the atime,
relatime, and noatime strings were passed to the kernel, which would
then interpret the strings and the manipulate the


> # strace -o /tmp/st mount -o remount,relatime /home
> # grep ^mount /tmp/st
> mount("/dev/sda2", "/home", 0x1543780, MS_REMOUNT|MS_RELATIME|MS_NOATIME,
> "nobarrier,errors=remount-ro") = 0

"MS_REMOUNT|MS_RELATIME|MS_NOATIME" looks wrong. Here's what I'm
seeing on my system:

# strace -o /tmp/st mount -o remount,relatime /dev/sda3
# grep sda3 /proc/mounts
/dev/sda3 / ext4 rw,lazytime,relatime,errors=remount-ro,data=ordered 0 0
# grep MS_REMOUNT /tmp/st
mount("/dev/sda3", "/", 0x1148230, MS_REMOUNT|MS_RELATIME|0x2000000, "errors=remount-ro") = 0
# strace -o /tmp/st mount -o remount,noatime /dev/sda3
# grep sda3 /proc/mounts
/dev/sda3 / ext4 rw,lazytime,noatime,errors=remount-ro,data=ordered 0 0
# grep MS_REMOUNT /tmp/st
mount("/dev/sda3", "/", 0x1458230, MS_REMOUNT|MS_NOATIME|0x2000000, "errors=remount-ro") = 0
# mount --version
mount from util-linux 2.26.2 (libmount 2.26.0: selinux, assert, debug)
# dpkg -l mount
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===================-==============-==============-===========================================
ii mount 2.26.2-6 amd64 Tools for mounting and manipulating filesys

- Ted

2015-07-12 08:21:00

by Jörg-Volker Peetz

[permalink] [raw]
Subject: Re: [GIT PULL] ext4 bug fixes for 4.2-rc2

Theodore Ts'o wrote on 07/11/2015 23:06:
> On Sat, Jul 11, 2015 at 02:07:10PM +0200, J?rg-Volker Peetz wrote:
<snip>
> I knew about the fact that you couldn't disable lazytime. The issue
> is that nolazytime is getting intercepted by the 2.26.2 version of
> mount, so ext4 never sees it. But if we interpret the lack of the
> lazytime flag in the mount flags passed in from the system call, then
> we would *always* disable the lazytime flag if the file system is
> remounted using a pre-2.26.2 version of mount. Since a huge number of
> Ubuntu LTS and Debian stable users (and probably a bunch of older
> Fedora users as well) will be using an older version of mount, I
> decided that best compromise is was to allow lazytime to be enabled
> using a 2.26.2+ version of mount via remount, but not to allow
> lazytime to be disabled. With a pre-2.26.2 version of mount, you'll
> be able to enable or disable lazytime.
>
O.k. Thanks for the explanation.

> As far as switching atime modes using remount, this is working for me.
> I'm testing with both a 2.25.2 version of mount as found in Debian
> Jessie, as well as 2.26.2 version of mount using Debian Stretch.
>
>
> The issue not being able to change the atime, relatime, and noatime
> flags is a similar issue. In pre-2.26.2 versions of mount, the atime,
> relatime, and noatime strings were passed to the kernel, which would
> then interpret the strings and the manipulate the
>
>
>> # strace -o /tmp/st mount -o remount,relatime /home
>> # grep ^mount /tmp/st
>> mount("/dev/sda2", "/home", 0x1543780, MS_REMOUNT|MS_RELATIME|MS_NOATIME,
>> "nobarrier,errors=remount-ro") = 0
>
> "MS_REMOUNT|MS_RELATIME|MS_NOATIME" looks wrong. Here's what I'm
> seeing on my system:
>
> # strace -o /tmp/st mount -o remount,relatime /dev/sda3
> # grep sda3 /proc/mounts
> /dev/sda3 / ext4 rw,lazytime,relatime,errors=remount-ro,data=ordered 0 0
> # grep MS_REMOUNT /tmp/st
> mount("/dev/sda3", "/", 0x1148230, MS_REMOUNT|MS_RELATIME|0x2000000, "errors=remount-ro") = 0
> # strace -o /tmp/st mount -o remount,noatime /dev/sda3
> # grep sda3 /proc/mounts
> /dev/sda3 / ext4 rw,lazytime,noatime,errors=remount-ro,data=ordered 0 0
> # grep MS_REMOUNT /tmp/st
> mount("/dev/sda3", "/", 0x1458230, MS_REMOUNT|MS_NOATIME|0x2000000, "errors=remount-ro") = 0
> # mount --version
> mount from util-linux 2.26.2 (libmount 2.26.0: selinux, assert, debug)
> # dpkg -l mount
> Desired=Unknown/Install/Remove/Purge/Hold
> | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
> ||/ Name Version Architecture Description
> +++-===================-==============-==============-===========================================
> ii mount 2.26.2-6 amd64 Tools for mounting and manipulating filesys
>
> - Ted
On my Debian stretch/sid systems there is:

# mount --version
mount from util-linux 2.26.2 (libmount 2.26.0: selinux, assert, debug)

# dpkg -l mount libmount1 libblkid1 libc6 libselinux1
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii libblkid1:amd6 2.26.2-6 amd64 block device id library
ii libc6:amd64 2.19-18 amd64 GNU C Library: Shared libraries
ii libmount1:amd6 2.26.2-6 amd64 device mounting library
ii libselinux1:am 2.3-2+b1 amd64 SELinux runtime shared libraries
ii mount 2.26.2-6 amd64 Tools for mounting and manipulati

I'm using kernel 4.1.2 plus two of your patches, but get the same output on a
system with a standard Debian kernel linux-image-4.0.0-2-amd64.
--
Regards,
J?rg.