forked from openbmc/linux
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NFSv4.2: Fix NFS4ERR_STALE error when doing inter server copy
NFS_FS=y as dependency of CONFIG_NFSD_V4_2_INTER_SSC still have build errors and some configs with NFSD=m to get NFS4ERR_STALE error when doing inter server copy. Added ops table in nfs_common for knfsd to access NFS client modules. Fixes: 3ac3711 ("NFSD: Fix NFS server build errors") Signed-off-by: Dai Ngo <dai.ngo@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
- Loading branch information
Showing
8 changed files
with
219 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* fs/nfs_common/nfs_ssc_comm.c | ||
* | ||
* Helper for knfsd's SSC to access ops in NFS client modules | ||
* | ||
* Author: Dai Ngo <dai.ngo@oracle.com> | ||
* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. | ||
*/ | ||
|
||
#include <linux/module.h> | ||
#include <linux/fs.h> | ||
#include <linux/nfs_ssc.h> | ||
#include "../nfs/nfs4_fs.h" | ||
|
||
MODULE_LICENSE("GPL"); | ||
|
||
struct nfs_ssc_client_ops_tbl nfs_ssc_client_tbl; | ||
EXPORT_SYMBOL_GPL(nfs_ssc_client_tbl); | ||
|
||
#ifdef CONFIG_NFS_V4_2 | ||
/** | ||
* nfs42_ssc_register - install the NFS_V4 client ops in the nfs_ssc_client_tbl | ||
* @ops: NFS_V4 ops to be installed | ||
* | ||
* Return values: | ||
* None | ||
*/ | ||
void nfs42_ssc_register(const struct nfs4_ssc_client_ops *ops) | ||
{ | ||
nfs_ssc_client_tbl.ssc_nfs4_ops = ops; | ||
} | ||
EXPORT_SYMBOL_GPL(nfs42_ssc_register); | ||
|
||
/** | ||
* nfs42_ssc_unregister - uninstall the NFS_V4 client ops from | ||
* the nfs_ssc_client_tbl | ||
* @ops: ops to be uninstalled | ||
* | ||
* Return values: | ||
* None | ||
*/ | ||
void nfs42_ssc_unregister(const struct nfs4_ssc_client_ops *ops) | ||
{ | ||
if (nfs_ssc_client_tbl.ssc_nfs4_ops != ops) | ||
return; | ||
|
||
nfs_ssc_client_tbl.ssc_nfs4_ops = NULL; | ||
} | ||
EXPORT_SYMBOL_GPL(nfs42_ssc_unregister); | ||
#endif /* CONFIG_NFS_V4_2 */ | ||
|
||
#ifdef CONFIG_NFS_V4_2 | ||
/** | ||
* nfs_ssc_register - install the NFS_FS client ops in the nfs_ssc_client_tbl | ||
* @ops: NFS_FS ops to be installed | ||
* | ||
* Return values: | ||
* None | ||
*/ | ||
void nfs_ssc_register(const struct nfs_ssc_client_ops *ops) | ||
{ | ||
nfs_ssc_client_tbl.ssc_nfs_ops = ops; | ||
} | ||
EXPORT_SYMBOL_GPL(nfs_ssc_register); | ||
|
||
/** | ||
* nfs_ssc_unregister - uninstall the NFS_FS client ops from | ||
* the nfs_ssc_client_tbl | ||
* @ops: ops to be uninstalled | ||
* | ||
* Return values: | ||
* None | ||
*/ | ||
void nfs_ssc_unregister(const struct nfs_ssc_client_ops *ops) | ||
{ | ||
if (nfs_ssc_client_tbl.ssc_nfs_ops != ops) | ||
return; | ||
nfs_ssc_client_tbl.ssc_nfs_ops = NULL; | ||
} | ||
EXPORT_SYMBOL_GPL(nfs_ssc_unregister); | ||
|
||
#else | ||
void nfs_ssc_register(const struct nfs_ssc_client_ops *ops) | ||
{ | ||
} | ||
EXPORT_SYMBOL_GPL(nfs_ssc_register); | ||
|
||
void nfs_ssc_unregister(const struct nfs_ssc_client_ops *ops) | ||
{ | ||
} | ||
EXPORT_SYMBOL_GPL(nfs_ssc_unregister); | ||
#endif /* CONFIG_NFS_V4_2 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* | ||
* include/linux/nfs_ssc.h | ||
* | ||
* Author: Dai Ngo <dai.ngo@oracle.com> | ||
* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. | ||
*/ | ||
|
||
#include <linux/nfs_fs.h> | ||
|
||
extern struct nfs_ssc_client_ops_tbl nfs_ssc_client_tbl; | ||
|
||
/* | ||
* NFS_V4 | ||
*/ | ||
struct nfs4_ssc_client_ops { | ||
struct file *(*sco_open)(struct vfsmount *ss_mnt, | ||
struct nfs_fh *src_fh, nfs4_stateid *stateid); | ||
void (*sco_close)(struct file *filep); | ||
}; | ||
|
||
/* | ||
* NFS_FS | ||
*/ | ||
struct nfs_ssc_client_ops { | ||
void (*sco_sb_deactive)(struct super_block *sb); | ||
}; | ||
|
||
struct nfs_ssc_client_ops_tbl { | ||
const struct nfs4_ssc_client_ops *ssc_nfs4_ops; | ||
const struct nfs_ssc_client_ops *ssc_nfs_ops; | ||
}; | ||
|
||
extern void nfs42_ssc_register_ops(void); | ||
extern void nfs42_ssc_unregister_ops(void); | ||
|
||
extern void nfs42_ssc_register(const struct nfs4_ssc_client_ops *ops); | ||
extern void nfs42_ssc_unregister(const struct nfs4_ssc_client_ops *ops); | ||
|
||
#ifdef CONFIG_NFSD_V4_2_INTER_SSC | ||
static inline struct file *nfs42_ssc_open(struct vfsmount *ss_mnt, | ||
struct nfs_fh *src_fh, nfs4_stateid *stateid) | ||
{ | ||
if (nfs_ssc_client_tbl.ssc_nfs4_ops) | ||
return (*nfs_ssc_client_tbl.ssc_nfs4_ops->sco_open)(ss_mnt, src_fh, stateid); | ||
return ERR_PTR(-EIO); | ||
} | ||
|
||
static inline void nfs42_ssc_close(struct file *filep) | ||
{ | ||
if (nfs_ssc_client_tbl.ssc_nfs4_ops) | ||
(*nfs_ssc_client_tbl.ssc_nfs4_ops->sco_close)(filep); | ||
} | ||
#endif | ||
|
||
/* | ||
* NFS_FS | ||
*/ | ||
extern void nfs_ssc_register(const struct nfs_ssc_client_ops *ops); | ||
extern void nfs_ssc_unregister(const struct nfs_ssc_client_ops *ops); | ||
|
||
static inline void nfs_do_sb_deactive(struct super_block *sb) | ||
{ | ||
if (nfs_ssc_client_tbl.ssc_nfs_ops) | ||
(*nfs_ssc_client_tbl.ssc_nfs_ops->sco_sb_deactive)(sb); | ||
} |