[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <9E765F01-4954-4182-91F5-8E1F476720CC@dilger.ca>
Date: Sun, 7 Apr 2013 15:29:03 -0600
From: Andreas Dilger <adilger@...ger.ca>
To: Theodore Ts'o <tytso@....edu>
Cc: "Dr. Tilmann Bubeck" <t.bubeck@...nform.de>,
"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH -v3] ext4: implementation of a new ioctl called EXT4_IOC_SWAP_BOOT
On 2013-04-07, at 13:48, Theodore Ts'o <tytso@....edu> wrote:
> On Sun, Apr 07, 2013 at 11:09:58AM -0600, Andreas Dilger wrote:
>>> + if (inode_bl->i_nlink == 0) {
>>> + /* this inode has never been used as a BOOT_LOADER */
>>> + set_nlink(inode_bl, 1);
>>> + i_uid_write(inode_bl, 0);
>>> + i_gid_write(inode_bl, 0);
>>> + inode_bl->i_flags = 0;
>>> + ei_bl->i_flags = 0;
>>> + inode_bl->i_version = 1;
>>> + i_size_write(inode_bl, 0);
>>> + inode_bl->i_mode = S_IFREG;
>>> + if (EXT4_HAS_INCOMPAT_FEATURE(sb,
>>> + EXT4_FEATURE_INCOMPAT_EXTENTS)) {
>>> + ext4_set_inode_flag(inode_bl, EXT4_INODE_EXTENTS);
>>> + ext4_ext_tree_init(handle, inode_bl);
>>> + } else
>>> + memset(ei_bl->i_data, 0, sizeof(ei_bl->i_data));
>>
>> I don't understand this. Wouldn't this clobber the block pointers if
>> an existing boot inode and cause them to leak? This seems broken to me.
>
> If i_nlink is zero, then there is no existing boot loader inode. In
> theory the rest of the inode is zero, but this is to make sure the
> inode is initialized to something sane before we swap it into the
> user-visible inode.
Oh, my bad. I thought the else was for the nlink != 0 case, not the !extent case (the danger of reading email on my phone, I guess). Looks fine.
>
Cheers, Andreas--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists