[linux-lvm] [PATCH] Fix for hanging resize on root filesystem

Jeff Mahoney jeffm at suse.com
Fri Sep 10 12:47:24 UTC 2004

Hash: SHA1

Hello all -

I recently ran across a bug that was initially suspected to be a
reiserfs bug, but turned out to be (I feel) a problem with the LVM
userspace utilities.

When a user has their root filesystem on an LV and attempts to resize
the LV, the kernel will deadlock while trying to update the atime on the
device node.

The following sequence causes the lockup:
open /dev/somedisk
suspend the dm instance
~   -> *_write_super_lockfs flushes and disallows new transactions
read from /dev/somedisk
~   -> if needed, update atime
~     -> dirty inode
~      -> tries to start transaction and waits for transactions to be
~         allowed again (waits forever, unless the LV is unlocked by
~         another process, which will cease the deadlock but cause the
~         lvresize operation to occur with the dm device active)

The attach patch causes dev_open_flags to add the O_NOATIME to the
open flags, which will avoid the deadlock by not updating the atime.

Note that the resize on the root LV, when using ext3, will succeed most
of the time. This _isn't_ because of correctness, but because it manages
to perform the operations without crossing a 1-second interval. If a
delay is introduced between one of the reads, for example, it will also

The reason I feel this isn't a kernel bug, but rather a userspace bug,
is that the LVM code explicitly suspends the device, and then performs
operations with implicit writes associated with them. The reads/writes
from the device are totally valid, but the inode atime update isn't. The
kernel behavior is as expected.

- -Jeff

- --
Jeff Mahoney
SuSE Labs
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-noatime.patch
Type: text/x-patch
Size: 515 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20040910/cc3aeebd/attachment.bin>

More information about the linux-lvm mailing list