orangefs: Account for jiffies wraparound.
authorMartin Brandenburg <martin@omnibond.com>
Thu, 28 Jul 2016 18:46:36 +0000 (14:46 -0400)
committerMartin Brandenburg <martin@omnibond.com>
Tue, 2 Aug 2016 19:39:13 +0000 (15:39 -0400)
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
fs/orangefs/dcache.c
fs/orangefs/namei.c
fs/orangefs/orangefs-utils.c

index 2521af6707f72983f738ad7c374c1c6a6241eeb8..00235bf644dcfd43b9b7978408270c31f6de0268 100644 (file)
@@ -95,7 +95,7 @@ static int orangefs_d_revalidate(struct dentry *dentry, unsigned int flags)
 {
        int ret;
 
-       if (dentry->d_time > jiffies)
+       if (time_before(jiffies, dentry->d_time))
                return 1;
 
        if (flags & LOOKUP_RCU)
index 77071b78816a4149ee2efdc5e42754e1cb206c70..62c525936ee88f639725553dec920d729c2f9876 100644 (file)
@@ -73,7 +73,7 @@ static int orangefs_create(struct inode *dir,
        d_instantiate(dentry, inode);
        unlock_new_inode(inode);
        dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
-       ORANGEFS_I(inode)->getattr_time = 0;
+       ORANGEFS_I(inode)->getattr_time = jiffies - 1;
 
        gossip_debug(GOSSIP_NAME_DEBUG,
                     "%s: dentry instantiated for %s\n",
@@ -193,7 +193,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
                goto out;
        }
 
-       ORANGEFS_I(inode)->getattr_time = 0;
+       ORANGEFS_I(inode)->getattr_time = jiffies - 1;
 
        gossip_debug(GOSSIP_NAME_DEBUG,
                     "%s:%s:%d "
@@ -323,7 +323,7 @@ static int orangefs_symlink(struct inode *dir,
        d_instantiate(dentry, inode);
        unlock_new_inode(inode);
        dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
-       ORANGEFS_I(inode)->getattr_time = 0;
+       ORANGEFS_I(inode)->getattr_time = jiffies - 1;
 
        gossip_debug(GOSSIP_NAME_DEBUG,
                     "Inode (Symlink) %pU -> %s\n",
@@ -387,7 +387,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
        d_instantiate(dentry, inode);
        unlock_new_inode(inode);
        dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
-       ORANGEFS_I(inode)->getattr_time = 0;
+       ORANGEFS_I(inode)->getattr_time = jiffies - 1;
 
        gossip_debug(GOSSIP_NAME_DEBUG,
                     "Inode (Directory) %pU -> %s\n",
@@ -418,7 +418,7 @@ static int orangefs_rename(struct inode *old_dir,
                     "orangefs_rename: called (%pd2 => %pd2) ct=%d\n",
                     old_dentry, new_dentry, d_count(new_dentry));
 
-       ORANGEFS_I(new_dentry->d_parent->d_inode)->getattr_time = 0;
+       ORANGEFS_I(new_dentry->d_parent->d_inode)->getattr_time = jiffies - 1;
 
        new_op = op_alloc(ORANGEFS_VFS_OP_RENAME);
        if (!new_op)
index cd512a3a9c528f0ccf13e811113408a3611ac721..d13c7291fd054059a52e47f916f5913f7ed075aa 100644 (file)
@@ -262,7 +262,7 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass)
            get_khandle_from_ino(inode));
 
        if (!new && !bypass) {
-               if (orangefs_inode->getattr_time > jiffies)
+               if (time_before(jiffies, orangefs_inode->getattr_time))
                        return 0;
        }
 
@@ -421,7 +421,7 @@ int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr)
                ClearMtimeFlag(orangefs_inode);
                ClearCtimeFlag(orangefs_inode);
                ClearModeFlag(orangefs_inode);
-               orangefs_inode->getattr_time = 0;
+               orangefs_inode->getattr_time = jiffies - 1;
        }
 
        return ret;