Re: ramfs and directory modification time

From: Andrew Morton
Date: Fri Feb 24 2006 - 07:02:26 EST


"Ph. Marek" <philipp.marek@xxxxxxxxxx> wrote:
>
> I believe that I found a problem regarding ramfs and directory modification
> times.
>
>
>
> Observe:
> $ /tmp# mkdir newdir
> $ /tmp# mount -t ramfs none newdir
> $ /tmp# cd newdir/
> $ /tmp/newdir# mkdir sub
> $ /tmp/newdir# cd sub
> $ /tmp/newdir/sub# ls -la --full-time
> total 0
> drwxr-xr-x 2 root root 0 2006-02-23 14:01:37.573655160 +0100 .
> drwxr-xr-x 3 root root 0 2006-02-23 14:01:33.221316816 +0100 ..
> $ /tmp/newdir/sub# touch a-new-file
> $ /tmp/newdir/sub# ls -la --full-time
> total 0
> drwxr-xr-x 2 root root 0 2006-02-23 14:01:37.573655160 +0100 .
> drwxr-xr-x 3 root root 0 2006-02-23 14:01:33.221316816 +0100 ..
> -rw-r--r-- 1 root root 0 2006-02-23 14:01:48.019067216 +0100 a-new-file
>
> On a tmpfs or other (disk-based) filesystems (ext3) it works correctly.

Yes, bug. Thanks.


--- devel/fs/ramfs/inode.c~ramfs-update-dir-mtime-and-ctime 2006-02-24 03:53:46.000000000 -0800
+++ devel-akpm/fs/ramfs/inode.c 2006-02-24 03:54:29.000000000 -0800
@@ -27,6 +27,7 @@
#include <linux/fs.h>
#include <linux/pagemap.h>
#include <linux/highmem.h>
+#include <linux/time.h>
#include <linux/init.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
@@ -104,6 +105,7 @@ ramfs_mknod(struct inode *dir, struct de
d_instantiate(dentry, inode);
dget(dentry); /* Extra count - pin the dentry in core */
error = 0;
+ dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
}
return error;
}
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/