summaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2018-01-03 16:14:34 +0100
committerJ. Bruce Fields <bfields@redhat.com>2018-02-08 19:40:16 +0100
commit76c479480b9afff4c585a17e19a1efe3457a2d9b (patch)
tree231e1b89853c6428f45cf5d04ab68e8e628dd863 /fs/locks.c
parentnfsd: return RESOURCE not GARBAGE_ARGS on too many ops (diff)
downloadlinux-76c479480b9afff4c585a17e19a1efe3457a2d9b.tar.xz
linux-76c479480b9afff4c585a17e19a1efe3457a2d9b.zip
nfsd: encode stat->mtime for getattr instead of inode->i_mtime
The values of stat->mtime and inode->i_mtime may differ for overlayfs and stat->mtime is the correct value to use when encoding getattr. This is also consistent with the fact that other attr times are also encoded from stat values. Both callers of lease_get_mtime() already have the value of stat->mtime, so the only needed change is that lease_get_mtime() will not overwrite this value with inode->i_mtime in case the inode does not have an exclusive lease. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/locks.c')
-rw-r--r--fs/locks.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 1bd71c4d663a..db374a025811 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1554,9 +1554,9 @@ out:
EXPORT_SYMBOL(__break_lease);
/**
- * lease_get_mtime - get the last modified time of an inode
+ * lease_get_mtime - update modified time of an inode with exclusive lease
* @inode: the inode
- * @time: pointer to a timespec which will contain the last modified time
+ * @time: pointer to a timespec which contains the last modified time
*
* This is to force NFS clients to flush their caches for files with
* exclusive leases. The justification is that if someone has an
@@ -1580,8 +1580,6 @@ void lease_get_mtime(struct inode *inode, struct timespec *time)
if (has_lease)
*time = current_time(inode);
- else
- *time = inode->i_mtime;
}
EXPORT_SYMBOL(lease_get_mtime);