Re: [PATCH] fs: Fix truncate never updates m/ctime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> It seems like you need to fix jffs2 to implement the proper semantics in its ->setattr.

Yes I have thought of this solution. However, when I tried to
track this problem down, I found that ftruncate() had similar
problem and it was fixed by commit 6e656be89999 ("ftruncate 
does not always update m/ctime"):

	diff --git a/fs/open.c b/fs/open.c
	index 5fb16e5267dc..303f06d2a7b9 100644
	--- a/fs/open.c
	+++ b/fs/open.c
	@@ -322,7 +322,7 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
 
        error = locks_verify_truncate(inode, file, length);
        if (!error)
	-   	error = do_truncate(dentry, length, 0, file);
	+   	error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
 	out_putf:
        fput(file);
	 out:

In my opinion, there are two advantages if we fix it in
vfs_truncate():

1. All filesystems can reuse the scheme without adapting
Separately, just like what we did for ftruncate().

2. In the case when old_size = new_size, we can avoid
calling do_truncate() and return without doing anything.

Hope that you can consider my suggestion, thanks.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux