From 9c92d848a8125c554b469440fbe72bb0ad740456 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 19 Nov 2004 14:39:14 -0500 Subject: [PATCH] debugfs.c (kill_file_by_inode): Only iterate over the inode to release blocks if the inode has them; otherwise attempting to rm devices and fast symlinks will lead to errors. (Addresses Sourceforge Bug #954741 and #957244) --- debugfs/ChangeLog | 7 +++++++ debugfs/debugfs.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog index 34e16c1..315a4f0 100644 --- a/debugfs/ChangeLog +++ b/debugfs/ChangeLog @@ -1,3 +1,10 @@ +2004-11-19 Theodore Ts'o + + * debugfs.c (kill_file_by_inode): Only iterate over the inode to + release blocks if the inode has them; otherwise attempting + to rm devices and fast symlinks will lead to errors. + (Addresses Sourceforge Bug #954741 and #957244) + 2004-07-28 Theodore Ts'o * debugfs.c, debugfs.8.in: Add new option -d which allows the diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 89b9d6c..dab49d4 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -1372,6 +1372,8 @@ static void kill_file_by_inode(ext2_ino_t inode) inode_buf.i_dtime = time(NULL); if (debugfs_write_inode(inode, &inode_buf, 0)) return; + if (!ext2fs_inode_has_valid_blocks(&inode_buf)) + return; ext2fs_block_iterate(current_fs, inode, 0, NULL, release_blocks_proc, NULL); -- 1.8.3.1