]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFS: Adjust delegated timestamps for O_DIRECT reads and writes
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 1 Feb 2025 19:59:03 +0000 (14:59 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2025 17:25:27 +0000 (18:25 +0100)
[ Upstream commit 88025c67fe3c025a0123bc7af50535b97f7af89a ]

Adjust the timestamps if O_DIRECT is being combined with attribute
delegations.

Fixes: e12912d94137 ("NFSv4: Add support for delegated atime and mtime attributes")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/direct.c

index 2784586f93fc0cfe45b6fbe698f6f1f7af1e7ddc..c1f1b826888c983418e0caf8ffcbb8d56c58eb4a 100644 (file)
@@ -56,6 +56,7 @@
 #include <linux/uaccess.h>
 #include <linux/atomic.h>
 
+#include "delegation.h"
 #include "internal.h"
 #include "iostat.h"
 #include "pnfs.h"
@@ -286,6 +287,8 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
        nfs_direct_count_bytes(dreq, hdr);
        spin_unlock(&dreq->lock);
 
+       nfs_update_delegated_atime(dreq->inode);
+
        while (!list_empty(&hdr->pages)) {
                struct nfs_page *req = nfs_list_entry(hdr->pages.next);
                struct page *page = req->wb_page;
@@ -770,6 +773,7 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
 
        spin_lock(&inode->i_lock);
        nfs_direct_file_adjust_size_locked(inode, dreq->io_start, dreq->count);
+       nfs_update_delegated_mtime_locked(dreq->inode);
        spin_unlock(&inode->i_lock);
 
        while (!list_empty(&hdr->pages)) {