diff options
author | Roland McGrath <roland@gnu.org> | 2001-08-17 00:30:08 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2001-08-17 00:30:08 +0000 |
commit | fbac85b9cea3b657dd41973ad8100e22ec8293aa (patch) | |
tree | 251465136e0b639fd3e7dd2548afa92f3401ad43 | |
parent | 123f386fb9736cd6e57fade279e4990cb9d4a499 (diff) |
2001-08-16 Roland McGrath <roland@frob.com>
* inode.c (write_node): Leave i_size, i_blocks, i_translator unchanged
when the inode has been deleted. Suggested by Marcus Brinkmann.
-rw-r--r-- | ext2fs/inode.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/ext2fs/inode.c b/ext2fs/inode.c index 12e249e4..cc252cd7 100644 --- a/ext2fs/inode.c +++ b/ext2fs/inode.c @@ -451,7 +451,6 @@ write_node (struct node *np) } di->i_links_count = st->st_nlink; - di->i_size = st->st_size; di->i_atime = st->st_atime; di->i_mtime = st->st_mtime; @@ -462,8 +461,6 @@ write_node (struct node *np) di->i_ctime.ts_nsec = st->st_ctime_usec * 1000; #endif - di->i_blocks = st->st_blocks; - /* Convert generic flags in ST->st_flags to ext2-specific flags in DI (but don't mess with ext2 flags we don't know about). The original set was copied from DI into INFO by read_node, but might have been @@ -478,11 +475,20 @@ write_node (struct node *np) info->i_flags |= EXT2_IMMUTABLE_FL; di->i_flags = info->i_flags; - if (!(st->st_mode & S_IPTRANS) && sblock->s_creator_os == EXT2_OS_HURD) - di->i_translator = 0; - - /* Set dtime non-zero to indicate a deleted file. */ - di->i_dtime = (st->st_mode ? 0 : di->i_mtime); + if (st->st_mode == 0) + /* Set dtime non-zero to indicate a deleted file. + We don't clear i_size, i_blocks, and i_translator in this case, + to give "undeletion" utilities a chance. */ + di->i_dtime = di->i_mtime; + else + { + di->i_dtime = 0; + di->i_size = st->st_size; + di->i_blocks = st->st_blocks; + if (!(st->st_mode & S_IPTRANS) + && sblock->s_creator_os == EXT2_OS_HURD) + di->i_translator = 0; + } if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) di->i_block[0] = st->st_rdev; |