summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2022-08-13 08:22:25 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-15 11:30:03 +0200
commit3b97deb4abf5aa39785d9915ce3cf0531436c91b (patch)
tree8d772cddd0335615b60495d79bf339f05208e9e3 /include
parent31b992b3c39b2e1a3cfd86085ecf2b8a8730b210 (diff)
downloadlinux-stable-3b97deb4abf5aa39785d9915ce3cf0531436c91b.tar.gz
linux-stable-3b97deb4abf5aa39785d9915ce3cf0531436c91b.tar.bz2
linux-stable-3b97deb4abf5aa39785d9915ce3cf0531436c91b.zip
NFS: Fix another fsync() issue after a server reboot
[ Upstream commit 67f4b5dc49913abcdb5cc736e73674e2f352f81d ] Currently, when the writeback code detects a server reboot, it redirties any pages that were not committed to disk, and it sets the flag NFS_CONTEXT_RESEND_WRITES in the nfs_open_context of the file descriptor that dirtied the file. While this allows the file descriptor in question to redrive its own writes, it violates the fsync() requirement that we should be synchronising all writes to disk. While the problem is infrequent, we do see corner cases where an untimely server reboot causes the fsync() call to abandon its attempt to sync data to disk and causing data corruption issues due to missed error conditions or similar. In order to tighted up the client's ability to deal with this situation without introducing livelocks, add a counter that records the number of times pages are redirtied due to a server reboot-like condition, and use that in fsync() to redrive the sync to disk. Fixes: 2197e9b06c22 ("NFS: Fix up fsync() when the server rebooted") Cc: stable@vger.kernel.org Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/nfs_fs.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index d0855352cd6f..71467d661fb6 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -180,6 +180,7 @@ struct nfs_inode {
/* Regular file */
struct {
atomic_long_t nrequests;
+ atomic_long_t redirtied_pages;
struct nfs_mds_commit_info commit_info;
struct mutex commit_mutex;
};