aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/hpfs/namei.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index a0872f239f04..9e92c9c2d319 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -8,6 +8,17 @@
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include "hpfs_fn.h" 9#include "hpfs_fn.h"
10 10
11static void hpfs_update_directory_times(struct inode *dir)
12{
13 time_t t = get_seconds();
14 if (t == dir->i_mtime.tv_sec &&
15 t == dir->i_ctime.tv_sec)
16 return;
17 dir->i_mtime.tv_sec = dir->i_ctime.tv_sec = t;
18 dir->i_mtime.tv_nsec = dir->i_ctime.tv_nsec = 0;
19 hpfs_write_inode_nolock(dir);
20}
21
11static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) 22static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
12{ 23{
13 const unsigned char *name = dentry->d_name.name; 24 const unsigned char *name = dentry->d_name.name;
@@ -99,6 +110,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
99 result->i_mode = mode | S_IFDIR; 110 result->i_mode = mode | S_IFDIR;
100 hpfs_write_inode_nolock(result); 111 hpfs_write_inode_nolock(result);
101 } 112 }
113 hpfs_update_directory_times(dir);
102 d_instantiate(dentry, result); 114 d_instantiate(dentry, result);
103 hpfs_unlock(dir->i_sb); 115 hpfs_unlock(dir->i_sb);
104 return 0; 116 return 0;
@@ -187,6 +199,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, b
187 result->i_mode = mode | S_IFREG; 199 result->i_mode = mode | S_IFREG;
188 hpfs_write_inode_nolock(result); 200 hpfs_write_inode_nolock(result);
189 } 201 }
202 hpfs_update_directory_times(dir);
190 d_instantiate(dentry, result); 203 d_instantiate(dentry, result);
191 hpfs_unlock(dir->i_sb); 204 hpfs_unlock(dir->i_sb);
192 return 0; 205 return 0;
@@ -262,6 +275,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, de
262 insert_inode_hash(result); 275 insert_inode_hash(result);
263 276
264 hpfs_write_inode_nolock(result); 277 hpfs_write_inode_nolock(result);
278 hpfs_update_directory_times(dir);
265 d_instantiate(dentry, result); 279 d_instantiate(dentry, result);
266 brelse(bh); 280 brelse(bh);
267 hpfs_unlock(dir->i_sb); 281 hpfs_unlock(dir->i_sb);
@@ -340,6 +354,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
340 insert_inode_hash(result); 354 insert_inode_hash(result);
341 355
342 hpfs_write_inode_nolock(result); 356 hpfs_write_inode_nolock(result);
357 hpfs_update_directory_times(dir);
343 d_instantiate(dentry, result); 358 d_instantiate(dentry, result);
344 hpfs_unlock(dir->i_sb); 359 hpfs_unlock(dir->i_sb);
345 return 0; 360 return 0;
@@ -423,6 +438,8 @@ again:
423out1: 438out1:
424 hpfs_brelse4(&qbh); 439 hpfs_brelse4(&qbh);
425out: 440out:
441 if (!err)
442 hpfs_update_directory_times(dir);
426 hpfs_unlock(dir->i_sb); 443 hpfs_unlock(dir->i_sb);
427 return err; 444 return err;
428} 445}
@@ -477,6 +494,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
477out1: 494out1:
478 hpfs_brelse4(&qbh); 495 hpfs_brelse4(&qbh);
479out: 496out:
497 if (!err)
498 hpfs_update_directory_times(dir);
480 hpfs_unlock(dir->i_sb); 499 hpfs_unlock(dir->i_sb);
481 return err; 500 return err;
482} 501}
@@ -595,7 +614,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
595 goto end1; 614 goto end1;
596 } 615 }
597 616
598 end: 617end:
599 hpfs_i(i)->i_parent_dir = new_dir->i_ino; 618 hpfs_i(i)->i_parent_dir = new_dir->i_ino;
600 if (S_ISDIR(i->i_mode)) { 619 if (S_ISDIR(i->i_mode)) {
601 inc_nlink(new_dir); 620 inc_nlink(new_dir);
@@ -610,6 +629,10 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
610 brelse(bh); 629 brelse(bh);
611 } 630 }
612end1: 631end1:
632 if (!err) {
633 hpfs_update_directory_times(old_dir);
634 hpfs_update_directory_times(new_dir);
635 }
613 hpfs_unlock(i->i_sb); 636 hpfs_unlock(i->i_sb);
614 return err; 637 return err;
615} 638}