Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * include/linux/nfs_ssc.h
0004  *
0005  * Author: Dai Ngo <dai.ngo@oracle.com>
0006  *
0007  * Copyright (c) 2020, Oracle and/or its affiliates.
0008  */
0009 
0010 #include <linux/nfs_fs.h>
0011 #include <linux/sunrpc/svc.h>
0012 
0013 extern struct nfs_ssc_client_ops_tbl nfs_ssc_client_tbl;
0014 
0015 /*
0016  * NFS_V4
0017  */
0018 struct nfs4_ssc_client_ops {
0019     struct file *(*sco_open)(struct vfsmount *ss_mnt,
0020         struct nfs_fh *src_fh, nfs4_stateid *stateid);
0021     void (*sco_close)(struct file *filep);
0022 };
0023 
0024 /*
0025  * NFS_FS
0026  */
0027 struct nfs_ssc_client_ops {
0028     void (*sco_sb_deactive)(struct super_block *sb);
0029 };
0030 
0031 struct nfs_ssc_client_ops_tbl {
0032     const struct nfs4_ssc_client_ops *ssc_nfs4_ops;
0033     const struct nfs_ssc_client_ops *ssc_nfs_ops;
0034 };
0035 
0036 extern void nfs42_ssc_register_ops(void);
0037 extern void nfs42_ssc_unregister_ops(void);
0038 
0039 extern void nfs42_ssc_register(const struct nfs4_ssc_client_ops *ops);
0040 extern void nfs42_ssc_unregister(const struct nfs4_ssc_client_ops *ops);
0041 
0042 #ifdef CONFIG_NFSD_V4_2_INTER_SSC
0043 static inline struct file *nfs42_ssc_open(struct vfsmount *ss_mnt,
0044         struct nfs_fh *src_fh, nfs4_stateid *stateid)
0045 {
0046     if (nfs_ssc_client_tbl.ssc_nfs4_ops)
0047         return (*nfs_ssc_client_tbl.ssc_nfs4_ops->sco_open)(ss_mnt, src_fh, stateid);
0048     return ERR_PTR(-EIO);
0049 }
0050 
0051 static inline void nfs42_ssc_close(struct file *filep)
0052 {
0053     if (nfs_ssc_client_tbl.ssc_nfs4_ops)
0054         (*nfs_ssc_client_tbl.ssc_nfs4_ops->sco_close)(filep);
0055 }
0056 
0057 struct nfsd4_ssc_umount_item {
0058     struct list_head nsui_list;
0059     bool nsui_busy;
0060     /*
0061      * nsui_refcnt inited to 2, 1 on list and 1 for consumer. Entry
0062      * is removed when refcnt drops to 1 and nsui_expire expires.
0063      */
0064     refcount_t nsui_refcnt;
0065     unsigned long nsui_expire;
0066     struct vfsmount *nsui_vfsmount;
0067     char nsui_ipaddr[RPC_MAX_ADDRBUFLEN + 1];
0068 };
0069 #endif
0070 
0071 /*
0072  * NFS_FS
0073  */
0074 extern void nfs_ssc_register(const struct nfs_ssc_client_ops *ops);
0075 extern void nfs_ssc_unregister(const struct nfs_ssc_client_ops *ops);
0076 
0077 static inline void nfs_do_sb_deactive(struct super_block *sb)
0078 {
0079     if (nfs_ssc_client_tbl.ssc_nfs_ops)
0080         (*nfs_ssc_client_tbl.ssc_nfs_ops->sco_sb_deactive)(sb);
0081 }