[PATCH] nfs: add dummy definition for nfsd_file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add dummy definition for nfsd_file in both nfslocalio.c and localio.c
so older gcc (e.g. EL8's 8.5.0) can be used.  Older gcc causes RCU
code (rcu_dereference and rcu_access_pointer) to dereference what
should just be an opaque pointer with its use of typeof.

So without the dummy definition compiling with older gcc fails.

Link: https://lore.kernel.org/all/Zsyhco1OrOI_uSbd@xxxxxxxxxx/
Fixes: 55a9742d02eff ("nfs: cache all open LOCALIO nfsd_file(s) in client")
Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxxxxxxx>
---
 fs/nfs/localio.c           | 8 ++++++++
 fs/nfs_common/nfslocalio.c | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/fs/nfs/localio.c b/fs/nfs/localio.c
index 5c21caeae075..830078e5866b 100644
--- a/fs/nfs/localio.c
+++ b/fs/nfs/localio.c
@@ -46,6 +46,14 @@ struct nfs_local_fsync_ctx {
 	struct completion	*done;
 };
 
+/*
+ * nfsd_file structure is purposely kept opaque to NFS client.
+ * This is a dummy definition to make RCU compilation happy.
+ */
+struct nfsd_file {
+	int undefined__;
+};
+
 static bool localio_enabled __read_mostly = true;
 module_param(localio_enabled, bool, 0644);
 
diff --git a/fs/nfs_common/nfslocalio.c b/fs/nfs_common/nfslocalio.c
index 6a0bdea6d644..f3274a70ce5e 100644
--- a/fs/nfs_common/nfslocalio.c
+++ b/fs/nfs_common/nfslocalio.c
@@ -271,6 +271,14 @@ struct nfsd_file *nfs_open_local_fh(nfs_uuid_t *uuid,
 }
 EXPORT_SYMBOL_GPL(nfs_open_local_fh);
 
+/*
+ * nfsd_file structure is purposely kept opaque to NFS client.
+ * This is a dummy definition to make RCU compilation happy.
+ */
+struct nfsd_file {
+	int undefined__;
+};
+
 void nfs_close_local_fh(struct nfs_file_localio *nfl)
 {
 	struct nfsd_file *ro_nf = NULL;
-- 
2.44.0





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux