mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Adriaanse <alex_a@caltech.edu>
To: Vladimir Saveliev <vs@namesys.com>
Cc: Hans Reiser <reiser@namesys.com>,
	reiserfs-dev@namesys.com, linux-kernel@vger.kernel.org
Subject: Re: ReiserFS patch for updating ctimes of renamed files
Date: Sat, 22 Nov 2003 22:22:16 -0600	[thread overview]
Message-ID: <20031123042216.GA32152@homer.d-oh.org> (raw)
In-Reply-To: <200311201746.15843.vs@namesys.com>

Hi Vladimir,

I must've messed something up when testing the updates of ctime during a
rename on ext2, because when looking at the ext2 code the ctime of a
renamed file doesn't normally get updated.  Maybe I simply forgot to
test it on ext2 and only tested out tmpfs.  Oops. :)  Sorry for the
confusion.  Based on my findings below, ext2's (or minix or ufs for that
matter) behavior seems also inconsistent with some of the other FSes I
mentioned below (ext2/minix/ufs also seem to share a lot of code in
their rename functions).

When glancing through the 2.6.0-test9 source code, I verified that ext3
updates the ctime (fs/ext3/namei.c:2244, with the comment, "Like most
other Unix systems, set the ctime for inodes on a rename."), JFS updates
ctime (fs/jfs/namei.c:1231), xfs updates it (xfs/xfs_rename.c:480), etc.
I believe all these updates are made for both directories and
non-directories, so it appears that your patch which updates only a
directory's ctime needs to cover non-directories as well (at least if
you're trying to be consistent across other Linux filesystems like
ext3/jfs/xfs).

Alex

On Thu, Nov 20, 2003 at 05:46:15PM +0300, Vladimir Saveliev wrote:
> Hi
> 
> Sorry for delay with this.
> I looked over linux's renames and they seem to be doing exactly what reiserfs does: 
> do not change anything (neither ctime nor mtime) renaming not-directory. Quick test confirms that.
> Please, look at its log:
> <LOG>
> tribesman:/rescue # mount
> /dev/hda2 on / type reiserfs (rw)
> proc on /proc type proc (rw)
> devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
> /dev/hda1 on /rescue type ext2 (rw)
> shmfs on /dev/shm type shm (rw)
> tribesman:/rescue # stat bigfile
>   File: `bigfile'
>   Size: 1099511627777   Blocks: 198896     IO Block: 4096   regular file
> Device: 301h/769d       Inode: 187         Links: 1
> Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
> Access: 2003-02-13 19:56:51.000000000 +0300
> Modify: 2003-02-13 19:56:10.000000000 +0300
> Change: 2003-02-13 19:56:10.000000000 +0300
> 
> tribesman:/rescue # mv bigfile tmp/
> tribesman:/rescue # stat tmp/bigfile
>   File: `tmp/bigfile'
>   Size: 1099511627777   Blocks: 198896     IO Block: 4096   regular file
> Device: 301h/769d       Inode: 187         Links: 1
> Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
> Access: 2003-02-13 19:56:51.000000000 +0300
> Modify: 2003-02-13 19:56:10.000000000 +0300
> Change: 2003-02-13 19:56:10.000000000 +0300
> </LOG>
> 
> 
> However, renaming directory reiserfs did not update its ctime and mtime. Patch to fix that is attached.
> Alex, does it cause tar to behave on reiserfs similar to ext2, ext3, etc?
> 
> Thanks,
> vs
> 
> 
> On Wednesday 19 November 2003 20:30, Hans Reiser wrote:
> > Alex Adriaanse wrote:
> > 
> > >Hi Hans & Vladimir,
> > >
> > >Is there any chance that this patch will make it into 2.4.24 (or 2.6.0 for
> > >that matter)? 
> > >
> > > I'm just curious.
> > >
> > >Thanks,
> > >
> > >Alex
> > >
> > >Alex Adriaanse wrote:
> > >>Hi Hans,
> > >>
> > >>I updated my patch to include Andrew's suggestion of eliminating extra
> > >>    
> > >>
> > >calls
> > >  
> > >
> > >>to CURRENT_TIME.  I also finally got a chance to test it out, and it seems
> > >>to work.  After applying this patch, ctime gets updated after a rename, and
> > >>GNU tar now backs things up properly.  I also could not detect any
> > >>filesystem corruption after doing some renames.
> > >>
> > >>Alex
> > >>
> > >>--- fs/reiserfs/namei.c.orig    Mon Aug 25 06:44:43 2003
> > >>+++ fs/reiserfs/namei.c Fri Oct 24 17:16:33 2003
> > >>@@ -1205,8 +1205,11 @@
> > >>
> > >>    mark_de_hidden (old_de.de_deh + old_de.de_entry_num);
> > >>    journal_mark_dirty (&th, old_dir->i_sb, old_de.de_bh);
> > >>-    old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
> > >>-    new_dir->i_ctime = new_dir->i_mtime = CURRENT_TIME;
> > >>+    ctime = CURRENT_TIME;
> > >>+    old_dir->i_ctime = old_dir->i_mtime = ctime;
> > >>+    new_dir->i_ctime = new_dir->i_mtime = ctime;
> > >>+    old_inode->i_ctime = ctime;
> > >>+    reiserfs_update_sd (&th, old_inode);
> > >>
> > >>    if (new_dentry_inode) {
> > >>       // adjust link number of the victim
> > >>@@ -1215,7 +1218,6 @@
> > >>       } else {
> > >>           new_dentry_inode->i_nlink--;
> > >>       }
> > >>-       ctime = CURRENT_TIME;
> > >>       new_dentry_inode->i_ctime = ctime;
> > >>       savelink = new_dentry_inode->i_nlink;
> > >>    }
> > >>
> > >>

       reply	other threads:[~2003-11-23  4:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <JIEIIHMANOCFHDAAHBHOMENJDAAA.alex_a@caltech.edu>
     [not found] ` <3FBBA8A7.7090802@namesys.com>
     [not found]   ` <200311201746.15843.vs@namesys.com>
2003-11-23  4:22     ` Alex Adriaanse [this message]
     [not found] <Gr0H.1ol.5@gated-at.bofh.it>
2003-10-14  6:57 ` Anton Ertl
2003-10-14  8:40   ` Hans Reiser
2003-10-14 14:08     ` Alex Adriaanse
2003-10-25 14:42     ` Alex Adriaanse
2003-10-12  6:05 Alex Adriaanse
2003-10-12  7:14 ` jw schultz
2003-10-13  5:49   ` Hans Reiser
     [not found]     ` <20031013073154.GL8724@pegasys.ws>
2003-10-13  8:45       ` Hans Reiser
2003-10-14  2:37         ` Alex Adriaanse
2003-10-14  6:09           ` Hans Reiser
2003-10-14  6:49             ` jw schultz
2003-10-14  9:29               ` Jamie Lokier
2003-10-13 10:24     ` Andrew Morton
2003-10-14  6:13       ` Hans Reiser
2003-10-14  6:25         ` Andrew Morton
2003-10-14  6:30           ` Hans Reiser
2003-10-14  6:44             ` Andrew Morton
2003-10-14  7:09           ` jw schultz
2003-10-13  5:32 ` Hans Reiser

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=20031123042216.GA32152@homer.d-oh.org \
    --to=alex_a@caltech.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reiser@namesys.com \
    --cc=reiserfs-dev@namesys.com \
    --cc=vs@namesys.com \
    /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

all inboxes | Powered by JetHome®