All of lore.kernel.org
 help / color / mirror / Atom feed
* mount stuck in infinite loop
@ 2018-01-31 17:16 Francesco Ruggeri
  2018-02-14 16:43 ` Francesco Ruggeri
  0 siblings, 1 reply; 2+ messages in thread
From: Francesco Ruggeri @ 2018-01-31 17:16 UTC (permalink / raw)
  To: linux-ext4, linux-kernel, linux-fsdevel; +Cc: fruggeri

I had a few cases of mount getting stuck in an infinite loop.
This happens when bdev->bd_inode->i_blkbits gets modified (for
example by bd_set_size()) while *_fill_super() is between
sb_min_blocksize() and sb_bread(), and the new value is inconsistent
with the block size used in fill_super().
When this happens one can get into an infinite loop in
__getblk_slow(), if grow_buffers() allocates/finds a page with a
given index, but __find_get_block{_slow}() looks for (and does not
find) a page with a different index.

I can reproduce it in 4.14.15 with the following script.
I can also reproduce it in 4.9 and 3.18.

FILE=/tmp/fsfile
MNT=/tmp/fsmnt
LOOP=`losetup -f`

rm -rf $FILE $MNT

mkdir $MNT
dd if=/dev/zero of=$FILE count=32 bs=1MiB
losetup $LOOP $FILE
mkfs -t ext4 $LOOP
while true; do losetup -D $LOOP; losetup $LOOP $FILE; done \
	2>/dev/null >/dev/null &
for ((i=0; i<100; i++)); do echo ================== $i; \
	mount $LOOP $MNT; umount $MNT; done

The issue is that __find_get_block_slow() and grow_buffers() compute
the page index in different ways.
I am not sure what the correct solution should be here.

Thanks,
Francesco Ruggeri

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mount stuck in infinite loop
  2018-01-31 17:16 mount stuck in infinite loop Francesco Ruggeri
@ 2018-02-14 16:43 ` Francesco Ruggeri
  0 siblings, 0 replies; 2+ messages in thread
From: Francesco Ruggeri @ 2018-02-14 16:43 UTC (permalink / raw)
  To: linux-ext4, linux-kernel, linux-fsdevel; +Cc: Francesco Ruggeri

Does anybody have any opinions about this?

Thanks,
Francesco Ruggeri

On Wed, Jan 31, 2018 at 9:16 AM, Francesco Ruggeri <fruggeri@arista.com> wrote:
> I had a few cases of mount getting stuck in an infinite loop.
> This happens when bdev->bd_inode->i_blkbits gets modified (for
> example by bd_set_size()) while *_fill_super() is between
> sb_min_blocksize() and sb_bread(), and the new value is inconsistent
> with the block size used in fill_super().
> When this happens one can get into an infinite loop in
> __getblk_slow(), if grow_buffers() allocates/finds a page with a
> given index, but __find_get_block{_slow}() looks for (and does not
> find) a page with a different index.
>
> I can reproduce it in 4.14.15 with the following script.
> I can also reproduce it in 4.9 and 3.18.
>
> FILE=/tmp/fsfile
> MNT=/tmp/fsmnt
> LOOP=`losetup -f`
>
> rm -rf $FILE $MNT
>
> mkdir $MNT
> dd if=/dev/zero of=$FILE count=32 bs=1MiB
> losetup $LOOP $FILE
> mkfs -t ext4 $LOOP
> while true; do losetup -D $LOOP; losetup $LOOP $FILE; done \
>         2>/dev/null >/dev/null &
> for ((i=0; i<100; i++)); do echo ================== $i; \
>         mount $LOOP $MNT; umount $MNT; done
>
> The issue is that __find_get_block_slow() and grow_buffers() compute
> the page index in different ways.
> I am not sure what the correct solution should be here.
>
> Thanks,
> Francesco Ruggeri
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-14 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-31 17:16 mount stuck in infinite loop Francesco Ruggeri
2018-02-14 16:43 ` Francesco Ruggeri

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.