* [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal
2014-09-08 23:11 [PATCH 00/25] e2fsprogs Summer 2014 patchbomb, part 5.2 Darrick J. Wong
@ 2014-09-08 23:12 ` Darrick J. Wong
2014-09-11 16:44 ` Theodore Ts'o
0 siblings, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2014-09-08 23:12 UTC (permalink / raw)
To: tytso, darrick.wong; +Cc: linux-ext4, TR Reardon
When we're removing the internal journal (broken journal, turning it
off, or adding an external journal), zero s_jnl_blocks so that they
can't be picked up by accident later.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Cc: TR Reardon <thomas_reardon@hotmail.com>
---
e2fsck/journal.c | 1 +
lib/ext2fs/mkjournal.c | 1 +
misc/tune2fs.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 16bd757..d12e317 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -549,6 +549,7 @@ static errcode_t e2fsck_journal_fix_bad_inode(e2fsck_t ctx,
"filesystem is now ext2 only ***\n\n");
sb->s_feature_compat &= ~EXT3_FEATURE_COMPAT_HAS_JOURNAL;
sb->s_journal_inum = 0;
+ memset(sb->s_jnl_blocks, 0, sizeof(sb->s_jnl_blocks));
ctx->flags |= E2F_FLAG_JOURNAL_INODE;
ctx->fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
e2fsck_clear_recover(ctx, 1);
diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c
index 85f86bf..0a7cd18 100644
--- a/lib/ext2fs/mkjournal.c
+++ b/lib/ext2fs/mkjournal.c
@@ -490,6 +490,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev)
fs->super->s_journal_dev = st.st_rdev;
memcpy(fs->super->s_journal_uuid, jsb->s_uuid,
sizeof(fs->super->s_journal_uuid));
+ memset(fs->super->s_jnl_blocks, 0, sizeof(fs->super->s_jnl_blocks));
fs->super->s_feature_compat |= EXT3_FEATURE_COMPAT_HAS_JOURNAL;
ext2fs_mark_super_dirty(fs);
return 0;
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index c22c8fd..7292ab1 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -377,6 +377,7 @@ static errcode_t remove_journal_inode(ext2_filsys fs)
return retval;
}
fs->super->s_journal_inum = 0;
+ memset(fs->super->s_jnl_blocks, 0, sizeof(fs->super->s_jnl_blocks));
ext2fs_mark_super_dirty(fs);
return 0;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal
2014-09-08 23:12 ` [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal Darrick J. Wong
@ 2014-09-11 16:44 ` Theodore Ts'o
0 siblings, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2014-09-11 16:44 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-ext4, TR Reardon
On Mon, Sep 08, 2014 at 04:12:35PM -0700, Darrick J. Wong wrote:
> When we're removing the internal journal (broken journal, turning it
> off, or adding an external journal), zero s_jnl_blocks so that they
> can't be picked up by accident later.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> Cc: TR Reardon <thomas_reardon@hotmail.com>
Applied, thanks.
- Ted
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal
[not found] <BAY406-EAS308E30D9E82235BD5A84A0EFDCD0@phx.gbl>
@ 2014-09-12 16:43 ` Darrick J. Wong
2014-09-12 19:06 ` TR Reardon
0 siblings, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2014-09-12 16:43 UTC (permalink / raw)
To: TR Reardon; +Cc: linux-ext4
[cc linux-ext4]
On Fri, Sep 12, 2014 at 10:09:55AM -0400, TR Reardon wrote:
> Note that this only works (zeroes out) when removing inode journal. Removing
> an existing journal_dev leaves s_jnl_blocks untouched. To be absolutely
> clean, perhaps it should be wiped in all removal cases?
s_jnl_blocks shouldn't be set if an external journal is in use.
(Unless it is somehow?)
--D
>
> --- Original Message ---
>
> From: "Theodore Ts'o" <tytso@mit.edu>
> Sent: September 11, 2014 12:44 PM
> To: "Darrick J. Wong" <darrick.wong@oracle.com>
> Cc: linux-ext4@vger.kernel.org, "TR Reardon" <thomas_reardon@hotmail.com>
> Subject: Re: [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal
>
> On Mon, Sep 08, 2014 at 04:12:35PM -0700, Darrick J. Wong wrote:
> > When we're removing the internal journal (broken journal, turning it
> > off, or adding an external journal), zero s_jnl_blocks so that they
> > can't be picked up by accident later.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > Cc: TR Reardon <thomas_reardon@hotmail.com>
>
> Applied, thanks.
>
> - 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] 5+ messages in thread
* RE: [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal
2014-09-12 16:43 ` [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal Darrick J. Wong
@ 2014-09-12 19:06 ` TR Reardon
2014-09-12 19:43 ` Darrick J. Wong
0 siblings, 1 reply; 5+ messages in thread
From: TR Reardon @ 2014-09-12 19:06 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-ext4@vger.kernel.org
If the change from journal_inode to journal_dev is/was made prior to the recent change, the s_jnl_blocks will have whatever it last had. So if it started with journal_inode and then switched to journal_dev (again, prior to your fix) or no journal, the s_jnl_blocks will have the old journal_inode info, and adding/removing journal_dev does no clear it out. For a new fs with created only with journal_dev, there is no issue. I'm just arguing that *adding* journal_dev should also zero this out.
+Reardon
----------------------------------------
> Date: Fri, 12 Sep 2014 09:43:42 -0700
> From: darrick.wong@oracle.com
> To: thomas_reardon@hotmail.com
> CC: linux-ext4@vger.kernel.org
> Subject: Re: [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal
>
> [cc linux-ext4]
>
> On Fri, Sep 12, 2014 at 10:09:55AM -0400, TR Reardon wrote:
>> Note that this only works (zeroes out) when removing inode journal. Removing
>> an existing journal_dev leaves s_jnl_blocks untouched. To be absolutely
>> clean, perhaps it should be wiped in all removal cases?
>
> s_jnl_blocks shouldn't be set if an external journal is in use.
>
> (Unless it is somehow?)
>
> --D
--
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] 5+ messages in thread
* Re: [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal
2014-09-12 19:06 ` TR Reardon
@ 2014-09-12 19:43 ` Darrick J. Wong
0 siblings, 0 replies; 5+ messages in thread
From: Darrick J. Wong @ 2014-09-12 19:43 UTC (permalink / raw)
To: TR Reardon; +Cc: linux-ext4@vger.kernel.org
On Fri, Sep 12, 2014 at 03:06:23PM -0400, TR Reardon wrote:
> If the change from journal_inode to journal_dev is/was made prior to the
> recent change, the s_jnl_blocks will have whatever it last had. So if it
> started with journal_inode and then switched to journal_dev (again, prior to
> your fix) or no journal, the s_jnl_blocks will have the old journal_inode
> info, and adding/removing journal_dev does no clear it out. For a new fs
> with created only with journal_dev, there is no issue. I'm just arguing that
> *adding* journal_dev should also zero this out.
You would also want to zero out s_jnl_blocks if creating a journal on a mounted
FS, since there's no way to find the block map/ETB blocks; the best we can do
is hope the user runs e2fsck, which will fix it.
--D
>
> +Reardon
>
>
> ----------------------------------------
> > Date: Fri, 12 Sep 2014 09:43:42 -0700
> > From: darrick.wong@oracle.com
> > To: thomas_reardon@hotmail.com
> > CC: linux-ext4@vger.kernel.org
> > Subject: Re: [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal
> >
> > [cc linux-ext4]
> >
> > On Fri, Sep 12, 2014 at 10:09:55AM -0400, TR Reardon wrote:
> >> Note that this only works (zeroes out) when removing inode journal. Removing
> >> an existing journal_dev leaves s_jnl_blocks untouched. To be absolutely
> >> clean, perhaps it should be wiped in all removal cases?
> >
> > s_jnl_blocks shouldn't be set if an external journal is in use.
> >
> > (Unless it is somehow?)
> >
> > --D
>
> --
> 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] 5+ messages in thread
end of thread, other threads:[~2014-09-12 19:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <BAY406-EAS308E30D9E82235BD5A84A0EFDCD0@phx.gbl>
2014-09-12 16:43 ` [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal Darrick J. Wong
2014-09-12 19:06 ` TR Reardon
2014-09-12 19:43 ` Darrick J. Wong
2014-09-08 23:11 [PATCH 00/25] e2fsprogs Summer 2014 patchbomb, part 5.2 Darrick J. Wong
2014-09-08 23:12 ` [PATCH 09/25] misc: zero s_jnl_blocks when removing internal journal Darrick J. Wong
2014-09-11 16:44 ` Theodore Ts'o
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).