* [PATCH] jbd2: don't write superblock when unmounting an ro filesystem
@ 2012-07-24 22:05 Eric Sandeen
2012-07-24 22:18 ` Eric Sandeen
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Eric Sandeen @ 2012-07-24 22:05 UTC (permalink / raw)
To: ext4 development; +Cc: Jan Kara
This sequence:
# truncate --size=65536 fsfile
# losetup --offset 65536 /dev/loop0 fsfile
# mkfs.ext4 /dev/loop0
# losetup -d /dev/loop0
# mount -o loop,ro,offset=65536 fsfile mnt/
# umount mnt
# dmesg | tail
results in an IO error when unmounting the RO filesystem:
[ 312.386074] SELinux: initialized (dev loop1, type ext4), uses xattr
[ 318.020828] Buffer I/O error on device loop1, logical block 196608
[ 318.027024] lost page write due to I/O error on loop1
[ 318.032088] JBD2: Error -5 detected when updating journal superblock for loop1-8.
This behavior changed with:
commit 24bcc89c7e7c64982e6192b4952a0a92379fc341
Author: Jan Kara <jack@suse.cz>
Date: Tue Mar 13 15:41:04 2012 -0400
jbd2: split updating of journal superblock and marking journal empty
which lost some of the magic in jbd2_journal_update_superblock() which
used to test for a journal with no outstanding transactions.
I'm not sure if the following is quite the right approach, but it fixes
it for me.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
p.s. no idea why this only happens if I use a loop device with an offset!
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index e9a3c4c..987ec76 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1354,6 +1354,11 @@ static void jbd2_mark_journal_empty(journal_t *journal)
BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
read_lock(&journal->j_state_lock);
+ /* Is it already empty? */
+ if (sb->s_start == 0) {
+ read_unlock(&journal->j_state_lock);
+ return;
+ }
jbd_debug(1, "JBD2: Marking journal as empty (seq %d)\n",
journal->j_tail_sequence);
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] jbd2: don't write superblock when unmounting an ro filesystem
2012-07-24 22:05 [PATCH] jbd2: don't write superblock when unmounting an ro filesystem Eric Sandeen
@ 2012-07-24 22:18 ` Eric Sandeen
2012-07-26 9:24 ` Lukáš Czerner
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2012-07-24 22:18 UTC (permalink / raw)
To: ext4 development; +Cc: Jan Kara
On 7/24/12 5:05 PM, Eric Sandeen wrote:
> This sequence:
>
> # truncate --size=65536 fsfile
> # losetup --offset 65536 /dev/loop0 fsfile
> # mkfs.ext4 /dev/loop0
> # losetup -d /dev/loop0
> # mount -o loop,ro,offset=65536 fsfile mnt/
> # umount mnt
> # dmesg | tail
>
> results in an IO error when unmounting the RO filesystem:
>
> [ 312.386074] SELinux: initialized (dev loop1, type ext4), uses xattr
> [ 318.020828] Buffer I/O error on device loop1, logical block 196608
> [ 318.027024] lost page write due to I/O error on loop1
> [ 318.032088] JBD2: Error -5 detected when updating journal superblock for loop1-8.
>
> This behavior changed with:
>
> commit 24bcc89c7e7c64982e6192b4952a0a92379fc341
> Author: Jan Kara <jack@suse.cz>
> Date: Tue Mar 13 15:41:04 2012 -0400
>
> jbd2: split updating of journal superblock and marking journal empty
>
> which lost some of the magic in jbd2_journal_update_superblock() which
> used to test for a journal with no outstanding transactions.
>
> I'm not sure if the following is quite the right approach, but it fixes
> it for me.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> p.s. no idea why this only happens if I use a loop device with an offset!
PEBKAC. no-offset ro loop mount does the same.
-Eric
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] jbd2: don't write superblock when unmounting an ro filesystem
2012-07-24 22:05 [PATCH] jbd2: don't write superblock when unmounting an ro filesystem Eric Sandeen
2012-07-24 22:18 ` Eric Sandeen
@ 2012-07-26 9:24 ` Lukáš Czerner
2012-07-30 15:49 ` Eric Sandeen
2012-08-15 12:14 ` Jan Kara
2012-08-18 18:45 ` Theodore Ts'o
3 siblings, 1 reply; 8+ messages in thread
From: Lukáš Czerner @ 2012-07-26 9:24 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development, Jan Kara
On Tue, 24 Jul 2012, Eric Sandeen wrote:
> Date: Tue, 24 Jul 2012 17:05:28 -0500
> From: Eric Sandeen <sandeen@redhat.com>
> To: ext4 development <linux-ext4@vger.kernel.org>
> Cc: Jan Kara <jack@suse.cz>
> Subject: [PATCH] jbd2: don't write superblock when unmounting an ro filesystem
>
> This sequence:
>
> # truncate --size=65536 fsfile
> # losetup --offset 65536 /dev/loop0 fsfile
> # mkfs.ext4 /dev/loop0
> # losetup -d /dev/loop0
> # mount -o loop,ro,offset=65536 fsfile mnt/
> # umount mnt
> # dmesg | tail
Hi Eric,
I am having hard time understanding what the sequence should be
doing. I actually can not reproduce it, because I can not create the
file system on such loop device because it seems like the size of
/dev/loop0 is zero, which makes sense considering that you set
offset to 65536 in the 65536 sized file.
Also, is the use of lo device really needed ? We can create the file
system on the file itself right ? Moreover, when I do that I can see
that the journal is not created because the device (file) is too
small, maybe it have something to do with the problem ?
Anyway, maybe I am missing something, but I do not understand what
kind of problem are you reproducing there.
-Lukas
>
> results in an IO error when unmounting the RO filesystem:
>
> [ 312.386074] SELinux: initialized (dev loop1, type ext4), uses xattr
> [ 318.020828] Buffer I/O error on device loop1, logical block 196608
> [ 318.027024] lost page write due to I/O error on loop1
> [ 318.032088] JBD2: Error -5 detected when updating journal superblock for loop1-8.
>
> This behavior changed with:
>
> commit 24bcc89c7e7c64982e6192b4952a0a92379fc341
> Author: Jan Kara <jack@suse.cz>
> Date: Tue Mar 13 15:41:04 2012 -0400
>
> jbd2: split updating of journal superblock and marking journal empty
>
> which lost some of the magic in jbd2_journal_update_superblock() which
> used to test for a journal with no outstanding transactions.
>
> I'm not sure if the following is quite the right approach, but it fixes
> it for me.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> p.s. no idea why this only happens if I use a loop device with an offset!
>
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index e9a3c4c..987ec76 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -1354,6 +1354,11 @@ static void jbd2_mark_journal_empty(journal_t *journal)
>
> BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
> read_lock(&journal->j_state_lock);
> + /* Is it already empty? */
> + if (sb->s_start == 0) {
> + read_unlock(&journal->j_state_lock);
> + return;
> + }
> jbd_debug(1, "JBD2: Marking journal as empty (seq %d)\n",
> journal->j_tail_sequence);
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] jbd2: don't write superblock when unmounting an ro filesystem
2012-07-26 9:24 ` Lukáš Czerner
@ 2012-07-30 15:49 ` Eric Sandeen
0 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2012-07-30 15:49 UTC (permalink / raw)
To: Lukáš Czerner; +Cc: ext4 development, Jan Kara
On 7/26/12 4:24 AM, Lukáš Czerner wrote:
> On Tue, 24 Jul 2012, Eric Sandeen wrote:
>
>> Date: Tue, 24 Jul 2012 17:05:28 -0500
>> From: Eric Sandeen <sandeen@redhat.com>
>> To: ext4 development <linux-ext4@vger.kernel.org>
>> Cc: Jan Kara <jack@suse.cz>
>> Subject: [PATCH] jbd2: don't write superblock when unmounting an ro filesystem
>>
>> This sequence:
>>
>> # truncate --size=65536 fsfile
>> # losetup --offset 65536 /dev/loop0 fsfile
>> # mkfs.ext4 /dev/loop0
>> # losetup -d /dev/loop0
>> # mount -o loop,ro,offset=65536 fsfile mnt/
>> # umount mnt
>> # dmesg | tail
>
> Hi Eric,
>
> I am having hard time understanding what the sequence should be
> doing. I actually can not reproduce it, because I can not create the
> file system on such loop device because it seems like the size of
> /dev/loop0 is zero, which makes sense considering that you set
> offset to 65536 in the 65536 sized file.
sorry, that must have been a cut & paste error. :(
The offset was leftover from trying to match the original reporter's case. This simpler test shows the same problem:
1014 truncate --size=2g fsfile
1015 mkfs.ext4 fsfile
1016 mount -o loop,ro fsfile mnt
1017 umount mnt
1018 dmesg | tail
[ 417.631105] EXT4-fs (loop0): mounted filesystem with ordered data mode. Opts: (null)
[ 417.639183] SELinux: initialized (dev loop0, type ext4), uses xattr
[ 420.903970] Buffer I/O error on device loop0, logical block 262144
[ 420.910448] lost page write due to I/O error on loop0
[ 420.915662] JBD2: Error -5 detected when updating journal superblock for loop0-8.
> Also, is the use of lo device really needed ? We can create the file
> system on the file itself right ? Moreover, when I do that I can see
> that the journal is not created because the device (file) is too
> small, maybe it have something to do with the problem ?
>
> Anyway, maybe I am missing something, but I do not understand what
> kind of problem are you reproducing there.
>
> -Lukas
>
>>
>> results in an IO error when unmounting the RO filesystem:
>>
>> [ 312.386074] SELinux: initialized (dev loop1, type ext4), uses xattr
>> [ 318.020828] Buffer I/O error on device loop1, logical block 196608
>> [ 318.027024] lost page write due to I/O error on loop1
>> [ 318.032088] JBD2: Error -5 detected when updating journal superblock for loop1-8.
>>
>> This behavior changed with:
>>
>> commit 24bcc89c7e7c64982e6192b4952a0a92379fc341
>> Author: Jan Kara <jack@suse.cz>
>> Date: Tue Mar 13 15:41:04 2012 -0400
>>
>> jbd2: split updating of journal superblock and marking journal empty
>>
>> which lost some of the magic in jbd2_journal_update_superblock() which
>> used to test for a journal with no outstanding transactions.
>>
>> I'm not sure if the following is quite the right approach, but it fixes
>> it for me.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>> p.s. no idea why this only happens if I use a loop device with an offset!
>>
>> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
>> index e9a3c4c..987ec76 100644
>> --- a/fs/jbd2/journal.c
>> +++ b/fs/jbd2/journal.c
>> @@ -1354,6 +1354,11 @@ static void jbd2_mark_journal_empty(journal_t *journal)
>>
>> BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
>> read_lock(&journal->j_state_lock);
>> + /* Is it already empty? */
>> + if (sb->s_start == 0) {
>> + read_unlock(&journal->j_state_lock);
>> + return;
>> + }
>> jbd_debug(1, "JBD2: Marking journal as empty (seq %d)\n",
>> journal->j_tail_sequence);
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] jbd2: don't write superblock when unmounting an ro filesystem
2012-07-24 22:05 [PATCH] jbd2: don't write superblock when unmounting an ro filesystem Eric Sandeen
2012-07-24 22:18 ` Eric Sandeen
2012-07-26 9:24 ` Lukáš Czerner
@ 2012-08-15 12:14 ` Jan Kara
2012-08-15 17:25 ` Eric Sandeen
2012-08-18 18:45 ` Theodore Ts'o
3 siblings, 1 reply; 8+ messages in thread
From: Jan Kara @ 2012-08-15 12:14 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development, Jan Kara
On Tue 24-07-12 17:05:28, Eric Sandeen wrote:
> This sequence:
>
> # truncate --size=65536 fsfile
> # losetup --offset 65536 /dev/loop0 fsfile
> # mkfs.ext4 /dev/loop0
> # losetup -d /dev/loop0
> # mount -o loop,ro,offset=65536 fsfile mnt/
> # umount mnt
> # dmesg | tail
>
> results in an IO error when unmounting the RO filesystem:
>
> [ 312.386074] SELinux: initialized (dev loop1, type ext4), uses xattr
> [ 318.020828] Buffer I/O error on device loop1, logical block 196608
> [ 318.027024] lost page write due to I/O error on loop1
> [ 318.032088] JBD2: Error -5 detected when updating journal superblock for loop1-8.
Ted, did this patch fall through cracks? I've ported the fix to JBD and
added it to my tree. I plan to send it to Linus in a few days. Also I've
CC'd stable since this is a bit annoying regression.
Honza
> This behavior changed with:
>
> commit 24bcc89c7e7c64982e6192b4952a0a92379fc341
> Author: Jan Kara <jack@suse.cz>
> Date: Tue Mar 13 15:41:04 2012 -0400
>
> jbd2: split updating of journal superblock and marking journal empty
>
> which lost some of the magic in jbd2_journal_update_superblock() which
> used to test for a journal with no outstanding transactions.
>
> I'm not sure if the following is quite the right approach, but it fixes
> it for me.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> p.s. no idea why this only happens if I use a loop device with an offset!
>
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index e9a3c4c..987ec76 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -1354,6 +1354,11 @@ static void jbd2_mark_journal_empty(journal_t *journal)
>
> BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
> read_lock(&journal->j_state_lock);
> + /* Is it already empty? */
> + if (sb->s_start == 0) {
> + read_unlock(&journal->j_state_lock);
> + return;
> + }
> jbd_debug(1, "JBD2: Marking journal as empty (seq %d)\n",
> journal->j_tail_sequence);
>
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] jbd2: don't write superblock when unmounting an ro filesystem
2012-08-15 12:14 ` Jan Kara
@ 2012-08-15 17:25 ` Eric Sandeen
0 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2012-08-15 17:25 UTC (permalink / raw)
To: Jan Kara; +Cc: Eric Sandeen, ext4 development
On 8/15/12 7:14 AM, Jan Kara wrote:
> On Tue 24-07-12 17:05:28, Eric Sandeen wrote:
>> This sequence:
>>
>> # truncate --size=65536 fsfile
>> # losetup --offset 65536 /dev/loop0 fsfile
>> # mkfs.ext4 /dev/loop0
>> # losetup -d /dev/loop0
>> # mount -o loop,ro,offset=65536 fsfile mnt/
>> # umount mnt
>> # dmesg | tail
>>
>> results in an IO error when unmounting the RO filesystem:
>>
>> [ 312.386074] SELinux: initialized (dev loop1, type ext4), uses xattr
>> [ 318.020828] Buffer I/O error on device loop1, logical block 196608
>> [ 318.027024] lost page write due to I/O error on loop1
>> [ 318.032088] JBD2: Error -5 detected when updating journal superblock for loop1-8.
> Ted, did this patch fall through cracks? I've ported the fix to JBD and
> added it to my tree. I plan to send it to Linus in a few days. Also I've
> CC'd stable since this is a bit annoying regression.
>
> Honza
Thanks for doing both of those things, Jan.
BTW this happens on loop because mount -o,ro apparently sets up the loop
device itself as readonly.
-Eric
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] jbd2: don't write superblock when unmounting an ro filesystem
2012-07-24 22:05 [PATCH] jbd2: don't write superblock when unmounting an ro filesystem Eric Sandeen
` (2 preceding siblings ...)
2012-08-15 12:14 ` Jan Kara
@ 2012-08-18 18:45 ` Theodore Ts'o
2012-08-19 18:54 ` Eric Sandeen
3 siblings, 1 reply; 8+ messages in thread
From: Theodore Ts'o @ 2012-08-18 18:45 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development, Jan Kara
Applied, thanks. I updated the reproduction instructions so that they
wored correctly. (i.e., by removing the offset, and changing the size
to 1g).
- Ted
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] jbd2: don't write superblock when unmounting an ro filesystem
2012-08-18 18:45 ` Theodore Ts'o
@ 2012-08-19 18:54 ` Eric Sandeen
0 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2012-08-19 18:54 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Eric Sandeen, ext4 development, Jan Kara
On Aug 18, 2012, at 11:45 AM, "Theodore Ts'o" <tytso@mit.edu> wrote:
> Applied, thanks. I updated the reproduction instructions so that they
> wored correctly. (i.e., by removing the offset, and changing the size
> to 1g).
>
Thanks, sorry about that really messed up commit message. :(
-Eric
> - Ted
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-08-19 18:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-24 22:05 [PATCH] jbd2: don't write superblock when unmounting an ro filesystem Eric Sandeen
2012-07-24 22:18 ` Eric Sandeen
2012-07-26 9:24 ` Lukáš Czerner
2012-07-30 15:49 ` Eric Sandeen
2012-08-15 12:14 ` Jan Kara
2012-08-15 17:25 ` Eric Sandeen
2012-08-18 18:45 ` Theodore Ts'o
2012-08-19 18:54 ` Eric Sandeen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).