Skip to contentSkip to conversation

cifs: fix actimeo=0 corner case when cifs_i->time == jiffies

PATCH In review Jeff Layton 2 participants 2 messages Mar 26, 2014 – Apr 25, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: fix actimeo=0 corner case when cifs_i->time == jiffies

actimeo=0 is supposed to be a special case that ensures that inode attributes are always refetched from the server instead of trusting the cache. The cifs code however uses time_in_range() to determine whether the attributes have timed out. In the case where cifs_i->time equals jiffies, this leads to the cifs code not refetching the inode attributes when it should.

Fix this by explicitly testing for actimeo=0, and handling it as a special case.

---
 fs/cifs/inode.c | 3 +++
 1 file changed, 3 insertions(+)
fs/cifs/inode.c +3 -0
index aadc2b68678b..a22d667f1069 100644
@@ -1737,6 +1737,9 @@ cifs_inode_needs_reval(struct inode *inode)
 	if (cifs_i->time == 0)
 		return true;
 
+	if (!cifs_sb->actimeo)
+		return true;
+
 	if (!time_in_range(jiffies, cifs_i->time,
 				cifs_i->time + cifs_sb->actimeo))
 		return true;
Signature · 1 line
1.8.5.3

A message that is not in the archive (sent off-list or not yet received): 1395843863-12038-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#2 lore raw

Fixed minor typo in comments and merged into cifs-2.6.git

Quoted 33 lines · Jeff Layton

actimeo=0 is supposed to be a special case that ensures that inode attributes are always refetched from the server instead of trusting the cache. The cifs code however uses time_in_range() to determine whether the attributes have timed out. In the case where cifs_i->time equals jiffies, this leads to the cifs code not refetching the inode attributes when it should.

Fix this by explicitly testing for actimeo=0, and handling it as a special case.

---
 fs/cifs/inode.c | 3 +++
 1 file changed, 3 insertions(+)
fs/cifs/inode.c +3 -1
index aadc2b68678b..a22d667f1069 100644
@@ -1737,6 +1737,9 @@ cifs_inode_needs_reval(struct inode *inode)
        if (cifs_i->time == 0)
                return true;
 
+       if (!cifs_sb->actimeo)
+               return true;
+
        if (!time_in_range(jiffies, cifs_i->time,
                                cifs_i->time + cifs_sb->actimeo))
                return true;
--

1.8.5.3

Signature · 3 lines
Thanks,

Steve