From: Allison Henderson <achender@linux.vnet.ibm.com>
To: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: Allison Henderson <achender@linux.vnet.ibm.com>
Subject: [Ext4 Secure Delete 4/7v4] ext4: Secure Delete: Secure delete file data
Date: Fri, 7 Oct 2011 00:11:02 -0700 [thread overview]
Message-ID: <1317971465-8517-5-git-send-email-achender@linux.vnet.ibm.com> (raw)
In-Reply-To: <1317971465-8517-1-git-send-email-achender@linux.vnet.ibm.com>
This patch modifies punch hole and truncate to securely
delete the data blocks of a file.
During a truncate or punch hole, files that have the EXT4_SECRM_FL
attribute flag on will have their blocks secure deleted before
they are released.
Signed-off-by: Allison Henderson <achender@linux.vnet.ibm.com>
---
:100644 100644 40d4e50... 984fac2... M fs/ext4/extents.c
:100644 100644 0a526c4... bd1facd... M fs/ext4/inode.c
fs/ext4/extents.c | 7 +++++++
fs/ext4/inode.c | 12 ++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 40d4e50..984fac2 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4201,6 +4201,13 @@ int ext4_ext_punch_hole(struct file *file, loff_t offset, loff_t length)
/* finish any pending end_io work */
ext4_flush_completed_IO(inode);
+ if (EXT4_I(inode)->i_flags & EXT4_SECRM_FL) {
+ err = ext4_secure_delete_lblks(inode, first_block,
+ last_block - first_block);
+ if (err)
+ return err;
+ }
+
credits = ext4_writepage_trans_blocks(inode);
handle = ext4_journal_start(inode, credits);
if (IS_ERR(handle))
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 0a526c4..bd1facd 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3420,6 +3420,8 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
*/
void ext4_truncate(struct inode *inode)
{
+ int err = 0;
+ ext4_lblk_t last_block;
trace_ext4_truncate_enter(inode);
if (!ext4_can_truncate(inode))
@@ -3430,6 +3432,16 @@ void ext4_truncate(struct inode *inode)
if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC))
ext4_set_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE);
+ last_block = (inode->i_size + EXT4_BLOCK_SIZE(inode->i_sb)-1)
+ >> EXT4_BLOCK_SIZE_BITS(inode->i_sb);
+
+ if (EXT4_I(inode)->i_flags & EXT4_SECRM_FL) {
+ err = ext4_secure_delete_lblks(inode,
+ last_block, EXT_MAX_BLOCKS);
+ if (err)
+ return;
+ }
+
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
ext4_ext_truncate(inode);
else
--
1.7.1
next prev parent reply other threads:[~2011-10-07 7:11 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-07 7:10 [Ext4 Secure Delete 0/7 v4] Ext4 secure delete Allison Henderson
2011-10-07 7:10 ` [Ext4 Secure Delete 1/7v4] ext4: Secure Delete: Add new EXT4_SECRM_RANDOM_FL flag Allison Henderson
2011-10-07 17:02 ` Darrick J. Wong
2011-10-07 17:14 ` Allison Henderson
2011-10-07 7:11 ` [Ext4 Secure Delete 2/7v4] ext4: Secure Delete: Add ext4_ind_hole_lookup function Allison Henderson
2011-10-07 17:47 ` Darrick J. Wong
2011-10-07 23:10 ` Allison Henderson
2011-10-07 7:11 ` [Ext4 Secure Delete 3/7v4] ext4: Secure Delete: Add secure delete functions Allison Henderson
2011-10-07 17:19 ` Allison Henderson
2011-10-07 18:07 ` Darrick J. Wong
2011-10-07 23:08 ` Allison Henderson
2011-10-07 7:11 ` Allison Henderson [this message]
2011-10-07 7:11 ` [Ext4 Secure Delete 5/7v4] ext4: Secure Delete: Secure delete directory entry Allison Henderson
2011-10-07 17:22 ` Darrick J. Wong
2011-10-07 17:59 ` Allison Henderson
2011-10-07 7:11 ` [Ext4 Secure Delete 6/7v4] ext4: Secure Delete: Secure delete meta data blocks Allison Henderson
2011-10-07 7:11 ` [Ext4 Secure Delete 7/7v4] ext4/jbd2: Secure Delete: Secure delete journal blocks Allison Henderson
2011-10-07 18:35 ` Darrick J. Wong
2011-10-07 19:31 ` Sunil Mushran
2011-10-07 19:54 ` Eric Sandeen
2011-10-07 20:14 ` Allison Henderson
2011-10-07 19:55 ` Allison Henderson
2011-10-07 20:58 ` Darrick J. Wong
2011-10-08 0:06 ` Allison Henderson
2011-10-10 19:47 ` Jonathan Corbet
2011-10-10 23:35 ` Allison Henderson
2011-10-10 23:41 ` Jonathan Corbet
2011-10-11 0:54 ` Allison Henderson
2011-10-10 20:00 ` Jonathan Corbet
2011-10-10 23:36 ` Allison Henderson
2011-10-07 15:21 ` [Ext4 Secure Delete 0/7 v4] Ext4 secure delete Andreas Dilger
2011-10-07 17:07 ` Allison Henderson
2011-10-10 17:20 ` Allison Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1317971465-8517-5-git-send-email-achender@linux.vnet.ibm.com \
--to=achender@linux.vnet.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).