Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165864
b: refs/heads/master
c: ce06e0b
h: refs/heads/master
v: v3
  • Loading branch information
Andi Kleen authored and Al Viro committed Sep 24, 2009
1 parent 52a9e19 commit f3d96ee
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b12536c27043f1c21195e587eb59950428326e22
refs/heads/master: ce06e0b21d6732a2bab10a585a3ec6909499be28
43 changes: 23 additions & 20 deletions trunk/fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1461,34 +1461,37 @@ void file_update_time(struct file *file)
{
struct inode *inode = file->f_path.dentry->d_inode;
struct timespec now;
int sync_it = 0;
int err;
enum { S_MTIME = 1, S_CTIME = 2, S_VERSION = 4 } sync_it = 0;

/* First try to exhaust all avenues to not sync */
if (IS_NOCMTIME(inode))
return;

err = mnt_want_write_file(file);
if (err)
return;

now = current_fs_time(inode->i_sb);
if (!timespec_equal(&inode->i_mtime, &now)) {
inode->i_mtime = now;
sync_it = 1;
}
if (!timespec_equal(&inode->i_mtime, &now))
sync_it = S_MTIME;

if (!timespec_equal(&inode->i_ctime, &now)) {
inode->i_ctime = now;
sync_it = 1;
}
if (!timespec_equal(&inode->i_ctime, &now))
sync_it |= S_CTIME;

if (IS_I_VERSION(inode)) {
inode_inc_iversion(inode);
sync_it = 1;
}
if (IS_I_VERSION(inode))
sync_it |= S_VERSION;

if (sync_it)
mark_inode_dirty_sync(inode);
if (!sync_it)
return;

/* Finally allowed to write? Takes lock. */
if (mnt_want_write_file(file))
return;

/* Only change inode inside the lock region */
if (sync_it & S_VERSION)
inode_inc_iversion(inode);
if (sync_it & S_CTIME)
inode->i_ctime = now;
if (sync_it & S_MTIME)
inode->i_mtime = now;
mark_inode_dirty_sync(inode);
mnt_drop_write(file->f_path.mnt);
}
EXPORT_SYMBOL(file_update_time);
Expand Down

0 comments on commit f3d96ee

Please sign in to comment.